2020-03-10 03:41 AM
Hi,
We're using an STM32L47xx which connects to a number of other peripherals. On our first board spin, we can see the device enter bootloader mode. We weren't aware of the bootloader addition, so it wasn't accounted for during the early design phases. This drives various pins as output on an unprogrammed device.
The problem for us lies in our use of these pins. Many of them are used as inputs from other ICs. This means, that for the duration that the bootloader is running, up until the point we are able to program the device, these pins will be outputting in the wrong direction, parasitically powering other ICs. This is pretty dangerous and has the potential to do quite some damage to the board.
Just now, I'm seeing this as a bit of a chicken and egg situation. The bootloader won't disable until we program it, but we can't power it up to program it without starting the bootloader.
What is the best way to mitigate this (ideally without redesigning the whole board)?
Are there chip variants that don't start the bootloader when unprogrammed? Is there a way to force the bootloader not to start?
We have BOOT0 tied to ground, which when programmed is sufficient to stop the device kicking off the bootloader. It's just on virgin boards, where this is a huge issue as BOOT0 is overridden by the device being unprogrammed.
Is there a pin that could be looped to the reset line, that keeps the device in reset when the bootloader is running? Do we just need to add a manual switch to hold the device in reset until first programming? Can the device be programmed in some kind of low-power mode (i.e. power from the programmer)?
Any one else had this issue?
Any suggestions welcome.
Thanks
- Oliver
2020-03-10 03:55 AM
What MCU variant you are speaking of ?
None of the MCUs I dealt with (F0, F1, F3, F4, F7) shows this behavior, one needs to force them into system BL mode (BOOT0/BOOT1 pins).
Check the datasheet/reference manual of the MCU family you are using.
2020-03-10 04:11 AM
Yes, meant to correct that, the full chip variant is STM32L4S7ZIT6.
An2606 does detail the pins that change when entering bootloader mode and the patterns that are required to get it into bootloader mode. Apparently using the "unprogrammed" state as part of the bootloader patter is pretty new.
The pattern we see is BOOT0 = 0 & device unprogrammed. Though BOOT0 can be 0 or 1 and it will go into bootloader mode if the device is unprogrammed.
Ideally we are looking for it to stay in a reset, until it can be programmed through JTAG.
Thanks Ozone, I've exhausted that avenue already.
NB: The datasheet could do with noting the pins that are used in bootloader mode, it's pretty poor that you have to go to an app note to find that. Even a footnote would have avoided this issue for us.
2020-03-10 04:27 AM
I have no experience with the L4 devices, and thus not seen the documentation yet.
However, calling the system BL if the device is unprogrammed could be a use case a designer could come up with. Not that I think it is a good idea.
Perhaps others with explicit knowledge could comment.
2020-03-10 04:55 AM
I know the feeling. I came across the list of "pins used by the bootloader" late on in the design of one board.
That's a LQFP part isn't it?
So you could put a blank stm32l4s7 into a ZIF socket and put a "default" program into it - just so the bootloader isn't invoked due to lack of program. (In sufficient quantities manufacturers / distributors used to do this as an (extra-cost) service). And then get a rework house to swap the processor. I've had them change BGAs as well.
Hope this helps,
Danish
2020-03-10 05:11 AM
Hi Danish,
Thanks for the suggestion. Wow, that's a pain.
I'll forward that onto the H/W guys here, I suspect there will be some choice language when they read that.
I'm not sure we have a ZIF socket for that size of chip either.
Thanks.
2020-03-10 05:19 AM
JTAG/SWD pins accessible? If yes, keep NRST asserted while powering on and until debugger connected. Then program option bytes and/or flash.
2020-03-10 05:24 AM
While this might be a valid option for prototypes, it is hardly feasible for commercial production.
2020-03-10 05:28 AM
Hi Andreas,
Yeah, that was my question about needing a physical button (or jumper) to keep the device in reset until it can be programmed. I think, if we need to redesign the board, then we will just avoid using the BL pins altogether.
I was wondering if there is a way to program the chip, without power on VDD. E.g. some Microchip parts can be programmed with power from the debugger. I don't know if this would be a possibility? Can the ST-Link over JTAG/SWD program a chip that has no VDD?
Cheers Andreas
2020-03-10 05:34 AM
Find a distributor or CM that will preprogram the ICs prior to delivery or board stuffing. Probably don't do sufficient quantities to get ST to jump through hoops.