cancel
Showing results for 
Search instead for 
Did you mean: 

Can't flash, debug or even erase STM32

JonasHSLU
Associate III

Hi,

I made some custom PCB's with a STM32L476RG. Here are some of the features:
-USB-C connector (CC channel configured as device) with DM/DP routed to PA11/PA12.
-Step down converter 5V (VBUS USB) to 3.3V (VCC for most components)
-Tactile switches for BOOT and RESET
-10 Pin SWD Debug header: SWDIO/SWDCLK -> PA13/PA14. SWO not routed.
-no external crystals
I soldered one PCB up and checked the connections under the microscope and with some resistance measuring. So that should be fine.

Now to my problem: I cannot flash or debug it. What I tried so far.
-Using the bootloader via USB doesnt work. The MuP doesn't even show up in the device manager.
Using an ST-Link from a Nucleo-L476RG board:
-Run / Debug with CubeIDE gives error: "Could not read registers; remote failure reply 'E31'". When trying different debug settings and pressing RESET and/or BOOT while trying to debug sometimes gives different errors.
-Trying to flash with CubeProgrammer gives warning "Warning: The core is locked up" and some errors (mainly "failed to erase memory")
-Erase chip with ST-Link Utility doesn't work aswell.

I was quite in a hurry when leaving work, so I don't have all the exact error messages. I could provide them tomorrow if necessary.

I could also provide my schematics and software but only to ST employees as it is somewhat confidential.

If you have any suggestions to what the problem might be or if you need additional information let me know.

Best regards,
Jonas

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JonasHSLU
Associate III

Update: used a segger j-link debugger and it works without any trouble.

View solution in original post

7 REPLIES 7
Andrew Neil
Super User

@JonasHSLU wrote:

I made some custom PCB's with a STM32L476RG. Here are some of the features:


Schematics would be more useful than a list of features

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

Well with no crystals the boot loader isn't going to support USB DFU operation

https://www.st.com/resource/en/application_note/an2606-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf#page=369

Wouldn't expect ST-Link Utilities to support L4+, but might

So probably an issue with power or orientation.

Check voltage presented on NRST pin.

Check all supply pins, analogue and digital.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

As mentionend, I don't think I can share the whole schematics. But in hindsight I could have posted at least some parts:

JonasHSLU_0-1747817896590.png

 

Well with no crystals the boot loader isn't going to support USB DFU operation

https://www.st.com/resource/en/application_note/an2606-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf#page=369


I see... I'll include HSE in version 2. But in the document I see that it's possible to use USART for bootloading using only HSI. That would also work, as I have USART2 on a pin-header. I will look into that.

 


Wouldn't expect ST-Link Utilities to support L4+, but might


With ST-Link Utility it can at least detect and connect to the MuP. For me this is a sign that the IC ist intact and oriented correctly.
11:40:06 : ST-LINK SN : 066DFF3234584D3043214244
11:40:06 : V2J46M31
11:40:06 : Connected via SWD.
11:40:06 : SWD Frequency = 4,0 MHz.
11:40:06 : Connection mode : Connect Under Reset.
11:40:06 : Debug in Low Power mode enabled.
11:40:06 : Device ID:0x415
11:40:06 : Device flash Size : 1MBytes
11:40:06 : Device family :STM32L4x1/L4x5/L4x6

 


So probably an issue with power or orientation.


Do you mean orientation in terms of package placement? If yes I was quite unsure at first too, because the LQFP64 has two circular markings. However, pin 1 should be on the lower left when the text is readable if I'm not mistaken.

 

Check voltage presented on NRST pin.

Check all supply pins, analogue and digital.


I checked the voltage on all 6 supply pins (see schematics in my reply to @Andrew Neil) and on NRST and they all have 3V. Before I had some problems with my DCDC converter only giving 2.4V but to my understanding that shouldn't have done any damage, as the Vin range is 1.8-3.6V. Now it still doesn't quite reach the targeted 3.3V, could that cause some problems?

 

LCE
Principal II

Using an ST-Link from a Nucleo-L476RG board

I would check the Nucleo manual for some connections / jumpers / solder bridges you might have got wrong.
I did the same with an F767 Nucleo, and it was working as ST-Link - but only after correctly placing the jumpers on the Nucleo.

Have you checked the UART bootloader (if available on these pins) ?

Have you checked if there's excessive current draw or if the MCU gets warm?

Did you buy the STM32 from a reliable source?


@LCE wrote:

I would check the Nucleo manual for some connections / jumpers / solder bridges you might have got wrong.
I did the same with an F767 Nucleo, and it was working as ST-Link - but only after correctly placing the jumpers on the Nucleo.

Have you checked the UART bootloader (if available on these pins) ?


I checked the manual before and configured the connections and jumpers accordingly. I have not yet tried to use the UART bootloader.
However, ( @Tesla DeLorean ) I now managed to program the target using the ST-Link Utility after setting the frequency to 1.8MHz. But it's not really stable as most of the time I still get error messages when trying to perform a full erase or program my SW on it. Also: debug and run still don't work.

 


Have you checked if there's excessive current draw or if the MCU gets warm?

Did you buy the STM32 from a reliable source?


I got the STM32 from mouser and it doesn't get warm. The DCDC converter that supplies the MuP gets quite warm and doesn't reach the 3.3V (it is a fixed output variant, settles at ~3V).

JonasHSLU
Associate III

Update: used a segger j-link debugger and it works without any trouble.