2024-11-19 01:06 AM
Hello,
I need to use a nRST pin as MCO in my aplication and programm my STM with STlink v3-set. I set up a MCO to output 8MHz signal and set nRST pin to GPIO with code you can see bellow. Now I have a problem with booting - I cannot connect to STM, CubeProgrammer have a error: 10:00:55 : Error: Data read failed
Can you please help me, how to fix that? I tried to used software reset, which does not help.
btw I can connect to STM only via STlink - I made a custom PCB for my application
Thank you
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
OBInit.OptionType = OPTIONBYTE_USER;
OBInit.USERType = OB_USER_NRST_MODE;
OBInit.USERConfig = FLASH_OPTR_NRST_MODE_1;
HAL_FLASHEx_OBProgram(&OBInit);
HAL_FLASH_OB_Launch();
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
Solved! Go to Solution.
2024-11-19 02:28 AM
Unless you have disabled SWDIO or SWCLK, the debug connection should still work - no hardware reset is neede. Set the debug interface to reset method - sysresetrq, normal connection of live/hot connection.
2024-11-19 02:28 AM
Unless you have disabled SWDIO or SWCLK, the debug connection should still work - no hardware reset is neede. Set the debug interface to reset method - sysresetrq, normal connection of live/hot connection.
2024-11-19 02:32 AM
11:31:31 : Debug in Low Power mode is not supported for this device.
11:31:32 : UPLOADING OPTION BYTES DATA ...
11:31:32 : Bank : 0x00
11:31:32 : Address : 0x40022020
11:31:32 : Size : 84 Bytes
11:31:32 : UPLOADING ...
11:31:32 : Size : 1024 Bytes
11:31:32 : Address : 0x8000000
11:31:32 : Read progress:
11:31:32 : Error: Data read failed
2024-11-19 02:36 AM
So the debug connection is basically working. Try to restore the factory settings - reset option bytes and do a full chip erase, then play again, more carefully.
2024-11-19 03:00 AM
Thank you,
can you please me with reseting memory? I am kinda lost...
I set NRST_MODE back to 1, as you can see bellow
Then I tried to erase flash memory, but it give me a error
2024-11-19 03:05 AM
I figured out, how it works, so thank you for help.
Anyway, what should I do to properly activate MCO instead of nRST on my STM, but still keep debugger functional? I read something about delay (or timer?) before changing nRST to MCO...