I have STM32 blue pill, I make a simple LED blinking code within the CubeIDE, and it works fine
however, when I’ve tried to write the same code in Platformio, it doesn’t work at all while there is no error
Okay, that matches the clock init code implicitly selected by board = bluepill_f103c8 (source), which is also HSE + PLL with factor 9 (source).
Since you upload via ST-Link, you should also be able to use debugging as normally. Add
debug_init_break = break setup
(docs) to the platformio.ini and save. Then, in the debugging sidepanel in VSCode, make sure the default “PIO Debug (project name)” is selected and press the play button.
Does it break in your setup() function at all? If no, press the ‘Pause’ button. Where is it stuck? If yes, does it reach loop()? Does the LED state change after the digitalWrite()?
Okay, so firmware code is being executed. The pin definition of PC13 shuold also be totall okay. And you also set the GPIO mode as OUTPUT.
In the lower left corner of the debug session you have “Peripherals”. Can you take a screenshot of the GPIOC perpiheral with the CRH and ODR registers expanded, one screenshot for when the execution is at line 13 and when it’s at line 16?
Sorry limited time right now, can you decode the aforementioned GPIOC registers and see if they match GPIO mode “output” and whether the ODR register shows a 1-bit after a digitalWrite(high) and 0-bit after a digitalWrite(low) at the 13th bit position from the right? (Counting the rightmost bit as index 0).
tnx @maxgerhardt , I debug the same program via cubeIDE and noticed the address are totally different
in Arduino address is 0x080030C0 (internal flash ) while according to the cudeIDE SRF tab, the address is 0x4001100C ( the last peripheral address is 0x40029054)
what configuration did I do wrong?
What’s the meaning of the red note in platformio? Info: halted PC : 0x000
@maxgerhardt , sorry to bother you again, but can you please look at my debugging images, platformio Arduino debugger shows it reads from the flash address (not surprised) while the cubeIDE precisely indicates the peripheral register address , so in that case memory address in platformio Arduino debugger is not helpful
any advice really appreciated
find it
ODR2 from GPIOB has changed, whenever digitalWrite will be called
is there any way to export all peripheral registers to a text file and compare it on each step?