NRF Firmware

Discussions about quadcopters/multi-rotors
Post Reply
leonana69
Beginner
Posts: 21
Joined: Wed Apr 27, 2016 9:43 am

NRF Firmware

Post by leonana69 »

After I tried to flash the NRF chip, I can't connect to the drone anymore.

Here is what I get when trying to flash the NRF.

Code: Select all

make flash
openocd -d2 -f interface/stlink-v2-1.cfg  -f target/nrf51.cfg  -c init -c targets -c "reset halt" \
                 -c "flash write_image erase cf2_nrf.hex" -c "verify_image cf2_nrf.hex" \
                 -c "reset run" -c shutdown
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v33 API v2 SWIM v25 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 2.889334
Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* nrf51.cpu          hla_target little nrf51.cpu          running
target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0
auto erase enabled
Warn : Unknown device (HWID 0x00000138)
Warn : using fast async flash loader. This is currently supported
Warn : only with ST-Link and CMSIS-DAP. If you have issues, add
Warn : "set WORKAREASIZE 0" before sourcing nrf51.cfg to disable it
wrote 65536 bytes from file cf2_nrf.hex in 5.972767s (10.715 KiB/s)
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000002e msp: 0x000007c0
verified 64528 bytes in 0.534844s (117.821 KiB/s)
shutdown command invoked
Here is what I get when trying to flash the STM32.

Code: Select all

leonana69@ubuntu:~/Desktop/crazyflie-firmware-leo$ make cload
python3 -m cfloader -w radio://0/80/2M/E7E7E7E7E7 flash  cf2.bin stm32-fw
Reset to bootloader mode ...
Traceback (most recent call last):
  File "/home/leonana69/Desktop/crazyflie-clients-python/src/cfloader/__init__.py", line 139, in main
    if bl.start_bootloader(warm_boot=True):
  File "/home/leonana69/Desktop/crazyflie-lib-python/cflib/bootloader/__init__.py", line 112, in start_bootloader
    self._cload.request_info_update(TargetTypes.NRF51)
  File "/home/leonana69/Desktop/crazyflie-lib-python/cflib/bootloader/cloader.py", line 247, in request_info_update
    return self.targets[target_id]
KeyError: 254
254
kimberly
Bitcraze
Posts: 1050
Joined: Fri Jul 06, 2018 11:13 am

Re: NRF Firmware

Post by kimberly »

Hi!

Just to make your post a bit more clear:
  • When you try to flash the NRF, are you using the debug adapter right? You are not trying to flash the NRF through the white connector that is already connected to the Crazyflie?
  • And are you using an stlink or another debugger?
leonana69
Beginner
Posts: 21
Joined: Wed Apr 27, 2016 9:43 am

Re: NRF Firmware

Post by leonana69 »

kimberly wrote: Tue Sep 22, 2020 6:56 am Hi!

Just to make your post a bit more clear:
  • When you try to flash the NRF, are you using the debug adapter right? You are not trying to flash the NRF through the white connector that is already connected to the Crazyflie?
  • And are you using an stlink or another debugger?
Yes, I flashed the NRF through the debug adapter and used a stlink2.1. I tried several more times and managed to make it work (that is after running the "make factory_reset_21", I can control the drone through the doggle). But another problem comes, I still can't flash the firmware for the stm32 through doggle. Here is the result:

Code: Select all

make cload
python3 -m cfloader -w radio://0/80/2M/E7E7E7E7E7 flash  cf2.bin stm32-fw
Reset to bootloader mode ...
Traceback (most recent call last):
  File "/home/leonana69/Desktop/crazyflie-clients-python/src/cfloader/__init__.py", line 139, in main
    if bl.start_bootloader(warm_boot=True):
  File "/home/leonana69/Desktop/crazyflie-lib-python/cflib/bootloader/__init__.py", line 112, in start_bootloader
    self._cload.request_info_update(TargetTypes.NRF51)
  File "/home/leonana69/Desktop/crazyflie-lib-python/cflib/bootloader/cloader.py", line 247, in request_info_update
    return self.targets[target_id]
KeyError: 254
254
The program stopped at "Reset to bootloader mode..." and the drone keeped blinking with its two blue LEDs.
kimberly
Bitcraze
Posts: 1050
Joined: Fri Jul 06, 2018 11:13 am

Re: NRF Firmware

Post by kimberly »

If both LEDS are one with bootloader mode, than luckily the bootloader on the STM is still intact.

So before anything else, lets see if flashing the whole firmware (both nrf and stm) in one go through the cfclient, exactly like this: https://www.bitcraze.io/documentation/r ... re-upgrade. That solves a lot of issues already.

Did you make an config.mk for the stm build (tools/make/config.mk) ? Maybe it would be good to remove the address there. Then make cload will only do this:

Code: Select all

python3 -m cfloader  flash  cf2.bin stm32-fw
Post Reply