CPU halted - Only one blue light is on

Firmware/software/electronics/mechanics
Post Reply
malintha
Beginner
Posts: 17
Joined: Thu Dec 07, 2017 4:58 pm

CPU halted - Only one blue light is on

Post by malintha »

Hi All,

I'm trying to debug a crazyflie 2.0 (STM32F4) with a J-link EDU and after some iterations of flashing it started to keep giving me the following output. Right now only one blue LED (M2) is lit and when I tried to enter the bootloader by keep pressing the power button, only that blue LED keeps blinking, instead of two. I tried erasing the ROM with J-Link but couldn't see any difference. As far as I remember, the only change I did was just related to the stabilizerTask. Any ideas?

Update: I tried reflashing the STM32F4 firmware using the DFU mode, but still only one blue light is lit.

Code: Select all

 bitcraze@bitcraze-vm:~/projects/crazyflie-firmware$ make flash
openocd -d2 -f interface/jlink.cfg -c "transport select swd" -f target/stm32f4x.cfg -c init -c targets -c "reset halt" \
                 -c "flash write_image erase cf2.bin 0x8004000 bin" \
                 -c "verify_image cf2.bin 0x8004000 bin" -c "reset run" -c shutdown
GNU ARM Eclipse 32-bits Open On-Chip Debugger 0.9.0-00073-gdd34716-dirty (2015-05-19-09:59)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
Info : JLink SWD mode enabled
swd
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
cortex_m reset_config sysresetreq
Info : J-Link V10 compiled Apr 20 2018 16:47:09
Info : J-Link caps 0xb9ff7bbf
Info : J-Link hw version 101000
Info : J-Link hw type J-Link
Info : J-Link max mem block 14456
Info : J-Link configuration
Info : USB-Address: 0x0
Info : Kickstart power on JTAG-pin 19: 0xffffffff
Info : Vref = 3.25 TCK = 0 TDI = 0 TDO = 0 TMS = 0 SRST = 1 TRST = 1
Info : J-Link JTAG Interface ready
Info : clock speed 2000 kHz
Info : SWD IDCODE 0x2ba01477
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f4x.cpu       cortex_m   little stm32f4x.cpu       halted
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
auto erase enabled
Info : device id = 0x10076413
Info : flash size = 1024kbytes
wrote 376832 bytes from file cf2.bin in 9.132847s (40.294 KiB/s)
verified 342072 bytes in 2.933342s (113.882 KiB/s)
Error: stm32f4x.cpu -- clearing lockup after double fault
target state: halted
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x00000003 pc: 00000000 msp: 0x464c4558
Polling target stm32f4x.cpu failed, trying to reexamine
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
shutdown command invoked
malintha
Beginner
Posts: 17
Joined: Thu Dec 07, 2017 4:58 pm

Re: CPU halted - Only one blue light is on

Post by malintha »

I found this post [1] which says basically stm32 will goes to a double fault status if there is an error in the startup code. It seems like I might have accidentally done something that removes the bootloader on the chip. So my guess is if everything is flashed from the beginning, most probably the error will disappear. Does anybody know the sequence of flashing the stm32 from the beginning? Which bootloader needs to be flashed first and then which one etc.

Thanks in advance!

[1] https://electronics.stackexchange.com/q ... le_rich_qa
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: CPU halted - Only one blue light is on

Post by tobias »

Yes that is probably it, you probably accidentally flashed over the bootloader. First flash the STM32 bootloader again and then when building/flashing the CF FW make sure CLOAD=1 so it is placed after the bootloader.
malintha
Beginner
Posts: 17
Joined: Thu Dec 07, 2017 4:58 pm

Re: CPU halted - Only one blue light is on

Post by malintha »

Nice! It worked! Thanks a lot Tobias!
For anybody who is looking for a solution for a similar issue with STM32, you can first flash the stm32 bootloader[1] as in [2]. Then flash the cf-fw [3] using CLOAD=1 option.
[1] https://github.com/bitcraze/crazyflie2-stm-bootloader
[2] https://wiki.bitcraze.io/projects:crazy ... opment:dfu
[3] https://github.com/bitcraze/crazyflie-firmware/
Post Reply