cancel
Showing results for 
Search instead for 
Did you mean: 

Program won't run after upload

Qwyntex
Associate III

I have designed my own PCB and I have the problem that while the code uploads successfully, it doesn't run.Qwyntex_0-1716384046463.png

I have checked NRST and BOOT0 and both should not be the problem. I have found a similar issue where the chip didn't get a clock signal and therefor was stuck. I have used the debugger to step through the code and it went past HAL_Init but I never come past SystemClock_Config, when trying to step into it the debugger throws 'Cannot find bounds of current function'. I am new to designing PCBs and I don't really know where to go from here or what the issue could be.

It is not the debugger itself as I can run the blinking sketch with no problems on a dev board that I have bought, which is why I have attached the schematic. I can also provide the PCB layout but I think it is much more likely that I made a basic mistake than that the layout is the culprit.

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

You have not connected anything to VCAP1, although 4.7µF must be connected to your UFQFPN48 (see data sheet, table 16)?

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

22 REPLIES 22
Peter BENSCH
ST Employee

You have not connected anything to VCAP1, although 4.7µF must be connected to your UFQFPN48 (see data sheet, table 16)?

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

I don't know how I missed that, thank you. I will try and solder it on and when it works I'll mark your answer as the solution

Qwyntex
Associate III

I have soldered the capacitor and now the program gets past the SystemClock_Config function. The blink script still doesn't work though. After inspecting it with the debugger I narrowed it down to the HAL_Delay function, specifically inside it in the HAL_GetTick function that returns uwTick, which I am assuming should change but for me it stays at zero. I wanted to try the internal clock but the IDE keeps crashing.

Make sure HSE and PLL are set with the anticipation that it's using 25 MHz, check HSE_VALUE define. Make sure the clock starts, or use the initial HSI clock to run the part, at least until you've established things are working.

Have Error_Handler() and HardFault_Handler() indicate if you've died there.

PC13, PC14, PC15 are assumed to be Low Current, and in the backup/low power domain.

SysTick not working, double check the base address of the firmware, check vector table, and that you haven't disabled interrupts.  Often SysTick set up in HAL_Init(),  Vectors in SystemInit()

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

Hi

according to your schematic , NRST has no pullup resistor.

connect like 4.7k pullup resistor.

 

I.N

It is NOT recommended to use a pull-up at NRST, because it is already built-in.

You will find details in the reference manual.

[edit] Even though such pull-ups are familiar from MCUs of the last millennium and can be found in some horribly constructed Blue, Black or other Pills, this does not mean that they are actually recommended or useful. [/edit]

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Peter ,,

Thanks for information.

regards

I.N

Qwyntex
Associate III

HSE and PLL should both be expecting a 25MHz clock. I have probed the oscillator with an oscilloscope and it works fine. I don't know if that means the clock actually started nor how to check for that.
When I change the clock source to internal my IDE crashes whenever I try to have it automatically resolve the clock and manually changing it doesn't work either because it insists that something is wrong even if there isn't. Manually changing it in the code would probably work but I have not done that yet and don't know what parameters I would need to change where, I would probably introduce more issues (but I want to ditch HAL sometime anyways, so any good resources will help me later).

The error handlers don't trigger as it is just stuck in a while loop waiting for uwTick to increment.

I am not sure of the relevance of the pins being assumed to be low current. Do you mean that drawing too much current on them could introduce odd behavior? I have only one red LED and a 120ohm resistor connected to PC13.

For the last part I assume they are correct because if they weren't it shouldn't work on the same chip model on a different board, right?

This is what puzzles me the most, I can upload the same sketch to a different f411ceu6 chip and it works just fine. But it doesn't work on my custom PCB.

As Tesla mentioned PC13 is not a good choice to drive an LED.

Datasheet footnote:

PC13, PC14 and PC15 are supplied through the power switch. Since the switch only sinks a limited amount of current (3mA), the use of GPIOs PC13 to PC15 in output mode is limited:
- The speed should not exceed 2 MHz with a maximum load of 30 pF.
- These I/Os must not be used as a current source (e.g. to drive an LED).