I’m experiencing a strange effect when using ST-LINKST-LINKModules, instruments and finished devices…ot add the serial usb device… suspect flashing failed…. Do I need to debrick it with st-link ? (which I don’t have lol) BennehBoy Mon Jan 23, 2017 8:11 pm NM managed to rescue it…View in hardware catalog ↗ as upload tool. Some I/O pins are not usable (PB3, PB4, PA15, PA12, PA11). I test this with a simple blink sketch, using the standard digitalWrite command. All other pins work fine. Same on all my STM boards (2x Maple MiniMaple MiniDevelopment and computing boards…8MHz petertumler Thu Sep 24, 2015 10:58 am Hi, I’m trying to underclock a STM32F103 ( Maple Mini ) to 48MHz (for energy efficiency reasons). According to the datasheet .. The full…View in hardware catalog ↗ and 2x Blue PillBlue PillDevelopment and computing boards…as become my new favorite board. I am calling it “blue pad” and it is kind of super “ blue pill ”. Pito Thu Jul 27, 2017 8:53 pm [victor_pv – Thu Jul 27, 2017 3:58 pm] – Just for…View in hardware catalog ↗).
Using the bootloader as upload tool the missing pins work, except PA12 and PA11, these are now in use for the USB so left alone.
I can’t get my head arround it, why is this ? I was thinking that the same code is flashed in both methods, only using a different transport method.
Are these pins reserved for something else or am I missing something basic info here ?
Replies20
Thu May 26, 2016 6:12 pm
This is because those pins are JTAG pins.
When using ST-LINKST-LINKModules, instruments and finished devices…ot add the serial usb device… suspect flashing failed…. Do I need to debrick it with st-link ? (which I don’t have lol) BennehBoy Mon Jan 23, 2017 8:11 pm NM managed to rescue it…View in hardware catalog ↗, it doesn’t do any call to disable SWD and JTAG.
The relevant code is located in STM32F1STM32F1Microcontrollers and processors…w I am not able to compile. Error message: “C:\arduino-1.6.12\hardware\Arduino_STM32\ STM32F1 \cores\maple/boards.h:39:25: fatal error: board/board.h: No such file or directory” I…View in hardware catalog ↗/system/libmaple/STM32F1STM32F1Microcontrollers and processors…w I am not able to compile. Error message: “C:\arduino-1.6.12\hardware\Arduino_STM32\ STM32F1 \cores\maple/boards.h:39:25: fatal error: board/board.h: No such file or directory” I…View in hardware catalog ↗/include/series/gpio.h, triggered by define in board.cpp of the variant.
/*** @brief Debug port configuration** Used to configure the behavior of JTAG and Serial Wire (SW) debug* ports and their associated GPIO pins.** @see afio_cfg_debug_ports()*/typedef enum afio_debug_cfg {/** Full Serial Wire and JTAG debug */AFIO_DEBUG_FULL_SWJ = AFIO_MAPR_SWJ_CFG_FULL_SWJ,/** Full Serial Wire and JTAG, but no NJTRST. */AFIO_DEBUG_FULL_SWJ_NO_NJRST = AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_NJRST,/** Serial Wire debug only (JTAG-DP disabled, SW-DP enabled) */AFIO_DEBUG_SW_ONLY = AFIO_MAPR_SWJ_CFG_NO_JTAG_SW,/** No debug; all JTAG and SW pins are free for use as GPIOs. */AFIO_DEBUG_NONE = AFIO_MAPR_SWJ_CFG_NO_JTAG_NO_SW,} afio_debug_cfg;
Beware that with AFIO_DEBUG_NONE you won’t be able to debug using ST-LINKST-LINKModules, instruments and finished devices…ot add the serial usb device… suspect flashing failed…. Do I need to debrick it with st-link ? (which I don’t have lol) BennehBoy Mon Jan 23, 2017 8:11 pm NM managed to rescue it…View in hardware catalog ↗, but with AFIO_DEBUG_SW_ONLY it is allowed.
Thu May 26, 2016 7:47 pm
Yes, thanks, have to dive into this debug functions later, on my “to learn” list !
Sun Jan 15, 2017 2:22 pm
Well, I also got infected by this “PB4 not toggling” virus…
I cannot find the place in the repo where the afio will configure the ports to debug/non-debug.
I am using the Blue PillBlue PillDevelopment and computing boards…as become my new favorite board. I am calling it “blue pad” and it is kind of super “ blue pill ”. Pito Thu Jul 27, 2017 8:53 pm [victor_pv – Thu Jul 27, 2017 3:58 pm] – Just for…View in hardware catalog ↗ with “Stm32duino bootloader” upload method, and I cannot toggle PB4 unless I call afio_cfg_debug_ports(AFIO_DEBUG_NONE);
Sun Jan 15, 2017 2:45 pm
Hm, strange, I have found in line 48 of board.cpp where the debug port should be disabled, but it will be not disabled, although the compiler will be called with the appropriate directive:
Yepp, that was it.
And also that in boards.txt I should’t have had that define (don’t know where is this coming from).
I removed that define and everything is ok now.
Sun Jan 15, 2017 6:38 pm
That is pretty normal to have this flag in the stlink upload method, since otherwise, you can only upload one time and then the SWD becomes disabled.
Sun Jan 15, 2017 7:50 pm
Yes for Stlink, but i had it for stm32duino bootloader upload method, which i think is not wanted.
Sun Jan 15, 2017 8:44 pm
You’re right ! Roger did that change on December 26th, I don’t know why other than allowing SWD debugging whatever upload method is used.
Well, i think we need to find another solution for the original idea to enable debugging, because i lost 2 days to find this issue, and maybe there will be more users who will complain about this.
Sun Jan 15, 2017 10:52 pm
I’m confused now
People wanted the SWD pins enabled all the time, so I changed it.
Is this not what was wanted by the majority of users?
Mon Jan 16, 2017 5:26 am
Idea: enable SWD always, and disable it from pinMode if somebody wants one of its pins.
Mon Jan 16, 2017 5:57 am
I’m just wondering how many of us are debugging when uploading with DFU, having no debugger connected.
I admit, this may be not the right place to post my issue, because this happens without using Stlink. And obviously i missed that majority vote.
This issue i see citical since the affected pin cannot be corrected with pinMode alone, one really have to use the afio cfg function, too.
But i don’t want to push my opinion, i obey the majority, i just hope that others will find this post and will know that they should use an Arduino non-compatible function “afio_cfg_debug_ports(AFIO_DEBUG_NONE);” in order to get their pin toggle in any simple sketch.
Me, I will just remove the respective define from “boards.txt” for my local and github version.
Mon Jan 16, 2017 2:52 pm
I think that daniel’s idea is a good one :
maybe the disableDebug() should within the pinMode when those specific pins are specified.
Mon Jan 16, 2017 3:29 pm
I don’t know whether my opinion counts, but I would suggest an IDE menu entry, this way is left to the user to enable/disable debugging according to his needs. Yes, you could say that we already have a lot of menu entries. Indeed. But still, this would be essential in my opinion. And this could be done across multiple platforms/boards.
The more because the parallel TFT libraries do set pin modes without calling pinMode() for each pin, but rather use direct register writes for multiple pin mode setting in one shot (btw, this was the way I meet this issue).
This should be linked (but can be done also independently) with information (on wiki?) pointing out the involved GPIO pins.
We anyway need some nice wiki pages regarding debugging.
Mon Jan 16, 2017 4:08 pm
stevestrong wrote:…But i don’t want to push my opinion, i obey the majority, i just hope that others will find this post and will know that they should use an Arduino non-compatible function “afio_cfg_debug_ports(AFIO_DEBUG_NONE);” in order to get their pin toggle in any simple sketch.
Mon Jan 16, 2017 5:42 pm
Rick, I did not overlooked that post, I just wanted to repeat the solution for people who browse this thread, looking for the solution.
Rick Kimball wrote:There is no majority way to use these boards. There are many different people using many different boards all in different ways.