STM32F4 openocd configuration with WFI sleep

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

Moderators: RoccoMarco, barthess

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

STM32F4 openocd configuration with WFI sleep

Postby andresv » Mon Apr 10, 2017 2:36 pm

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:

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

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
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: STM32F4 openocd configuration with WFI sleep

Postby RoccoMarco » Mon Apr 10, 2017 2:43 pm

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.
Ciao,
RM

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

Re: STM32F4 openocd configuration with WFI sleep

Postby andresv » Tue Apr 11, 2017 7:48 am

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:
reset_config srst_only connect_assert_srst

Oneliner to just upload new image:
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"
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
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: STM32F4 openocd configuration with WFI sleep

Postby RoccoMarco » Tue Apr 11, 2017 8:01 am

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.
Ciao,
RM


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 39 guests