STM32F4 openocd configuration with WFI sleep

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
andresv
Posts: 15
Joined: Tue Nov 29, 2016 11:09 am
Been thanked: 5 times

STM32F4 openocd configuration with WFI sleep

Post by andresv »

I enabled sleep with CORTEX_ENABLE_WFI_IDLE define, however after that it is very tricky to connect to the device.
Now I am aware that it also makes attaching debugger impossible without touching special registers that would still provide clock for debugger. But actually I am interested in measuring power consumption and therefore debugger is not needed, so typically I will just reflash controller with this command which worked nicely before adding WFI support:

[font=Courier New]openocd -f interface/stlink-v2.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x.cfg -c "program build/$(PROJECT).elf verify reset exit"[/font]

Is there any flag in openocd that still allows doing reset and uploading new binary but not making "debug" connection.
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: STM32F4 openocd configuration with WFI sleep

Post by RoccoMarco »

Hi,
I have worked a little bit with OpenOCD. Anyway I am unable to answer this question. BTW, I have a suggestion: do this question on the OpenOCD IRC channel (#openocd). They have a very active and kind community.
andresv
Posts: 15
Joined: Tue Nov 29, 2016 11:09 am
Been thanked: 5 times

Re: STM32F4 openocd configuration with WFI sleep

Post by andresv »

I got answer from #openocd.

First of all physical reset pin must be connected to debugger and there should be following line in .cfg file:
[font=Courier New]reset_config srst_only connect_assert_srst[/font]

Oneliner to just upload new image:
[font=Courier New]openocd -f interface/stlink-v2.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x.cfg -c "reset_config srst_only connect_assert_srst" -c "program build/$(PROJECT).elf verify reset exit"[/font]
Attachments
stlink.png
Last edited by andresv on Tue Apr 11, 2017 8:22 am, edited 1 time in total.
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: STM32F4 openocd configuration with WFI sleep

Post by RoccoMarco »

On discovery this should be already done. Check out ths schematic on user manual.

About ARM JTAG 20 pin connector, I wrote an article on my blog about how interfacing STLink with a microe clicker 2 which is based on STM32F407.
Post Reply