cancel
Showing results for 
Search instead for 
Did you mean: 

Code won't run without pressing reset button

IPrin.1
Associate II

My code runs without issue when the STM Nucleo is connected to the laptop, but if I try to run it without connection to PC, I have to press the reset button before the code will run.

I am using STM32CubeIDE and cannot find a solution relevant to that environment.

I can of course create a hardware solution to this but I would rather achieve a solution programmatically if possible.

13 REPLIES 13

Which Nucleo? What code? What is the expected behaviour, and how do you know that "code won't run"?

> if I try to run it without connection to PC

Is the problem that the code does not start as expected after powerup? How are you powering the Nucleo?

Try with simple blinky. Still problem?

JW

IPrin.1
Associate II

Thanks for getting back to me, and apologies for not including more information. I have created a new simple blinking LED project which behaves in the same way as my original project code, ie; requires a reset after power up to behave as expected. As such I assume it is an issue with the configuration of CubeIDE maybe?

I am using Nucleo-F746zGT6, I have attached a photo of my setup along with a zip of my simple project exported. I'm supplying <12V on Vin.

Cheers.

IPrin.1
Associate II
 
C. Mart
Associate III

Did you try building with the release configuration and not debug? I'm only guessing, but in debug it maybe waits for you to press "play" on the debugger which obviously won't happen if you're not connected to STM32CubeIDE via USB

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_ETH_Init();
  MX_USART3_UART_Init();
  MX_USB_OTG_FS_PCD_Init();

This is not *simple*.

JW

I have tried in both debug mode and release version but behaviour remains the same.

IPrin.1
Associate II

Having returned to work after a few days off site I have tried a number of boards to rule out a hardware issue. I have 4 boards, all the same format, all with the same boot loader code. 2 function as expected without needing a reset on power up, and 2 will not work until physically reset.

Has anybody any experience of this differing behaviour between apparently identical boards?

Thanks

Ulysses HERNIOSUS
ST Employee

Hi,

I would suspect an effect coming from the ST-Link not being properly powered/starting up. What is the setting of JP1? I would also experiment with closing SB107 or opening SB111 (Putting ST-Link into reset state / decoupling F7 reset from ST-Link).

BR, Ulysses

IPrin.1
Associate II

Thanks for getting back to me.

JP1 is open

Manually closing briefly SB107 after power up makes the board function

Opening SB111 prevented the programmer from resetting the micro-controller.

Adding a short delay at the start of main() has fixed the startup issue so I will continue with this rather than modifying the boards.

Thanks to everyone who gave constructive responses, much appreciated.

Ian