Skip to main content
gwillette
Associate II
January 6, 2017
Question

STM32L476 high current draw before programming

  • January 6, 2017
  • 22 replies
  • 6732 views
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
This topic has been closed for replies.

22 replies

Tesla DeLorean
Guru
January 6, 2017
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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
gwillette
gwilletteAuthor
Associate II
January 9, 2017
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

Chris1
Associate II
January 6, 2017
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.

Tesla DeLorean
Guru
January 7, 2017
Posted on January 07, 2017 at 01:29

Good observation, I'll remember that.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Jan Waclawek
Visitor II
January 7, 2017
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

gwillette
gwilletteAuthor
Associate II
January 9, 2017
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.

gwillette
gwilletteAuthor
Associate II
January 9, 2017
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.

waclawek.jan
Super User
January 9, 2017
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

gwillette
gwilletteAuthor
Associate II
January 9, 2017
Posted on January 09, 2017 at 23:02

It could technically be other circuitry on the board, but we have ruled out all connections that may be controlled during bootloader mode. And this high-current scenario only happens in the specific case where there is no application code on the STM32L476. It is very repeatable, and when there is application code present, this high-current scenario does not happen.

The current increase is step-wise. A step at 22mA which holds for 1 sec, then a jump to 75mA which holds for 1 sec, then a jump to 88mA which holds for a short time before dropping almost instantaneously to around 6ma.

waclawek.jan
Super User
January 9, 2017
Posted on January 09, 2017 at 23:28

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

gwillette
gwilletteAuthor
Associate II
January 10, 2017
Posted on January 10, 2017 at 17:38

Thanks, will look into it. The battery is a rechargeable which is only used to power the RTC circuitry when +3V is no longer present.

gwillette
gwilletteAuthor
Associate II
January 12, 2017
Posted on January 12, 2017 at 17:57

I removed the battery BT1 and lifted pin 21 so it is no longer connected to +1.25REF. The issue persists identically as before... And still no word back from anyone at ST help center.

waclawek.jan
Super User
January 12, 2017
Posted on January 12, 2017 at 20:09

Hummm.

I can't then think of nothing but to carefully cut one pin after another to find the culprit.

You can try to do it the other way round - get a 'L4 Nucleo (or Disco, but there are several external parts on that) and try the boot process there, while measuring the current consumption. Then gradually add connections similar to your board.

JW

gregstm
Senior II
January 12, 2017
Posted on January 12, 2017 at 23:53

For current measurements I often start with a bare board, solder on the micro and a few capacitors. For Boot0 the only thing I have connected to it is a weak pull-down and pull it high with a simple slide switch (production applications I pull it high (external to the PCB) with a spring loaded test probe - so for programming all I need is a jig with spring loaded test probes for GND, VCC, TX, RX, BOOT0, RESET contacts on the PCB)

dttworld
Associate II
January 30, 2017
Posted on January 30, 2017 at 04:31

Buy a NUCLEO-L476RG board for $15 and see if the problem exists there for some more clues.