cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476 high current draw before programming

gwillette
Associate II
Posted on January 06, 2017 at 22:16

Our application uses the SMT32L4 in a 4-20mA loop-powered transmitter. VCC on this device is 3V. The typical current draw once the product is operational is approximately 8mA @ 3v. We are utilizing the bootloader to program the mcu with UART1 on pins 68-69 (PA9 and PA10). On some boards, prior to programming, there is approximately 40-50mA current draw on the 3V supply. Our supply is rated for 50mA and once we attempt to initiate bootloading, the current consumption increases beyond that limit. If we provide enough current by increasing the supply, the device programs successfully. Once programmed, the total draw on the 3V supply is the expected 8mA.

I am wondering if there is a known operation/current consumption for these devices before they are initially programmed. Also, I see that the bootloader can use USART1/2/3, I2C1/2/3, and DFU (USB). Which ports/pins are utilized for the USART and I2C channels during bootloader operation? There are several ports that can be configured for each of these channels during normal operation, so it is difficult to determine the exact pin configuration of the device when it is in bootloader mode.

Thank you!

Gary

#programming #high-current #bootloader #stm32
22 REPLIES 22
Posted on January 06, 2017 at 22:28

For the USART pins, the System Loader has the RX pins connected to timers to allow it to watch for signals and auto-baud.

It is supposed to be looking for transitions on key pins it might get connectivity on.

I'd perhaps focus on the USB pins, and if you have pull up/down on the BOOTx pins.

If there are some boards which are much lower initially than the 40-50mA quoted, then I'd probably see what's different about them, and if you have some shorts, either in the solder of the pads, or within the board structure. Perhaps pull the STM32 and see if things are still oddly high. See if it follows the STM32 if place on a different board. I'd expect consistency, the lack of it tends to be a red flag.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Chris1
Senior III
Posted on January 06, 2017 at 23:01

One thing we discovered is that the L4 devices' bootloader enables the CAN peripheral, configures PB9 as output and drives that pin high.

Posted on January 07, 2017 at 01:29

Good observation, I'll remember that.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Jan Waclawek
Senior II
Posted on January 07, 2017 at 11:50

Which ports/pins are utilized for the USART and I2C channels during bootloader operation?

The bootloader appnote (AN2606? Not sure with number I am not at a computer) goes into deep details with this.

JW

Posted on January 08, 2017 at 04:26

My STM32L4 application uses the 100 pin LQFP and has 49 leds to individual pins. I was surprised when I first entered the Bootloader that 5 Leds lit up (some only dimly). Pity there is no way to tell the chip I only ever want to use USART1.  My application also draws about 10 mA (most of the time), but during programming my board draws around 50mA - but 30 mA of that is probably the FET driven white Led it lights up.

gwillette
Associate II
Posted on January 09, 2017 at 15:15

Thanks everyone for the helpful comments, I appreciate it. I had overlooked AN2026 section detailing specific pins and their initial states... I have found that info now. I was also able to read the Bootloader ID to determine that we have v9.2 bootloader which uses USART 1/2/3, CAN 1, USB, I2C 1/2/3, and SPI 1/2. I have confirmed our pinout is not an issue for v10.x which does not use CAN or SPI. I will check our pinout for SPI 1/2 and CAN now that I know we have the v9.x bootloader.

Posted on January 09, 2017 at 15:45

Thanks! USB terminals not connected to anything. Only one BOOT pin on this device, BOOT0, which has a pull-down

gwillette
Associate II
Posted on January 09, 2017 at 21:31

We have adjusted the 3V supply in our test environment so that it can provide as much current as is required for programming a board which has no valid firmware (new unit or erased). We got some interesting results...

AN2606 states that 'pattern 7' must be applied in order to enter bootloader. Pattern 7 can be any one of the following:

Boot0(pin) = 1, nBoot1(bit) = 1 and BFB2(bit) = 0

Boot0(pin) = 0, BFB2(bit) = 1 and both banks don’t contain valid code

Boot0(pin) = 1, nBoot1(bit) = 1 and BFB2(bit) = 1

Interestingly, the case where a device is brand new or has been erased is not listed. In this case, the condition would be:

Boot0(pin) = 0, BFB2(bit) = 0 and both banks don’t contain valid code

What I have to assume this to mean is that if [Boot0(pin) = 0, BFB2(bit) = 0 and both banks don’t contain valid code], the device will not enter bootloader. But if it is brand new, there is no valid code to run, so what does it do??

We found that when power is applied to a new or erased unit, regardless of the BOOT0 pin state, it will draw about 22mA for a second, then 75mA for about a second, then 88mA for about 0.5 seconds, then about 6mA forever until programming begins. Programming/erasing etc usually draws around 32mA. Our issue is that since this is not noted anywhere, we designed our 3V supply @ 50mA (65mA short-circuit). So we have some units that are able to get over the 88mA peak 'on accident' and therefore can program, while other units can't, and just sit there pulling down the 3V supply to around 2V, preventing any interaction.

Does anyone know what the STM32L476 is doing during it's startup that could possibly consume that much current??? We can't explain it, but it is repeatable across several units.

Posted on January 09, 2017 at 22:53

Anything beyond 10mA sounds rather suspicious, but can't that be other circuitry on the board? Are there significant capacitances to be charged? How exactly are the NRST, VDDA/VSSA, VBAT, VDDIO pins connected? Are all ground pins connected? Is the rise of VDD monotonic?

JW