Hi,
Apologies if this has all been answered before, but I've spent some time looking around for answers before bothering you with my questions. I'm new to ARM programming so I followed the helpful guides here to set up Chibios 2.4.3 with Eclipse (Juno)/Yagarto/Openocd6.1 on Windows 7. I'm using an STM32F4-DISCOVERY board with an 'A' revision MPU. I've got the latest (ie. as of a couple of days ago) ST-Link/V2 drivers etc. and updated the SWD/ST-Link firmware on the discovery board. I start Openocd using:
openocd-x64-0.6.1.exe -f E:\tools\openocd\scripts\board\stm32f4discovery.cfg
I built the Chibios 'blink' demo and managed to get it working but it took a while. It built OK but couldn't download the code to the target until I changed the debugger startup commands from the two 'monitor soft_reset_halt' commands to 'monitor reset init'.
So the first question is why doesn't soft_reset_halt work for me? I guess it doesn't necessarily matter if I have a working solution but I don't like mysteries.
Having a quick poke around the OPENOCD source code, In target/stm32_stlink.c I found stm32_stlink_soft_reset_halt(_) which appears to be a NULL function, implying that soft_reset_halt isn't implemented for this interface - presumably I'm looking in the wrong place?
Whilst searching for answers, it seems that this issue is not that well understood by many given the large variety of combinations of reset, halt and wait commands used by various developers, often multiple times, sometimes only before flashing the device, sometimes afterwards as well!
Using 'monitor reset init' (reset halt also seemed to work) I could then flash the device - but the debugger couldn't see any symbols until I checked the 'Load Image' option in the debugger configuration startup tab in Eclipse, as well as the 'Load Symbols' option as shown in your guide. Is this an oversight in the guide or am I missing something - I'm not very familiar with GDB?
Having finally got the demo running, I thought it wasn't working but it turned out that the 'Getting started with the STM32F4-Discovery board' guide has the blue and the green LED descriptions interchanged - the blue LED duty cycle is actually controlled by the ADC2 input and the green by the internal temperature sensor. It wasn't helped by the comments in the demo's main.c (line 246):
'The pin PC0 on the port GPIOC is programmed as analog input.'
But the code actually configures PC1 as the input. Trivial stuff when you've worked around all the Hal header files etc to understand whether the port bit numbering starts at 0 or 1, but very confusing to a beginner.
Thanks for your patience for anyone who could be bothered to read this far,
Tony H
stm32f4discovery soft_reset_halt not working
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: stm32f4discovery soft_reset_halt not working
Hi,
Thanks for finding.
The "PC0" was corrected in the demo on the repository, I updated the 2.4.x branch too. The "reset init" is how the initialization is done in "ChibiStudio", the guide has been written using older OpenOCD versions and that program seems to change very often, I will update the guides.
Giovanni
Thanks for finding.
The "PC0" was corrected in the demo on the repository, I updated the 2.4.x branch too. The "reset init" is how the initialization is done in "ChibiStudio", the guide has been written using older OpenOCD versions and that program seems to change very often, I will update the guides.
Giovanni