Page 1 of 1

reboot from a python program

Posted: Mon May 11, 2015 3:22 pm
by ellesse
Can you reboot crazyflie 2.0 from a python program (i.e without using the main switch)?

Re: reboot from a python program

Posted: Thu May 28, 2015 9:40 am
by arnaud
Yes you can. By sending "magic packets" you can reboot to bootloader or to firmware. This was intended as a bootloader hot-boot but we do not have it stable yet.

To restart to firmware:

Code: Select all

from crazyradio import Crazyradio

cr = Crazyradio()


print cr.send_packet((0xff, 0xfe, 0xff)).ack   # Init the reboot
# print cr.send_packet((0xff, 0xfe, 0xf0, 0)).ack   # Reboot to Bootloader
print cr.send_packet((0xff, 0xfe, 0xf0, 1)).ack   # Reboot to Firmware
One trick is that when rebooting to bootloader that way, the bootloader will take another radio address. This address is send back when the reboot-init packet is sent to the copter.

Re: reboot from a python program

Posted: Wed Jun 10, 2015 4:52 pm
by ellesse

Re: reboot from a python program

Posted: Tue Aug 27, 2019 3:20 pm
by sstroobants
Hi, very late reply to this old message:
My on/off button broke and I tried resetting it to bootloader using this method and it seems to work (blue lights showing). I just cannot update the firmware, since (I guess because you said this in your previous response) the address has changed. As you said, the address should be sent back with the first message. But I am not quite sure how to get this new address. Will this be in the data property? This property returns ['B', 243]. Let me know if you can help me!

Re: reboot from a python program

Posted: Wed Aug 28, 2019 6:45 am
by arnaud
The bootloader command line sofware has a mode to handle the address change. It is done using the -w flag, if you are developing with the Crazyflie firmware you can add this line in your ... xample#L48

If you want to flash a release zip you can use the same flag in the console: "python3 -m cfloader -w radio://0/100/2M/E7E7E7E7E7 flash".

Re: reboot from a python program

Posted: Wed Aug 28, 2019 7:43 am
by sstroobants
Thanks! I totally forgot about the cfloader... Only tried it with make cfload. Now I get the same problem as in this thread however: viewtopic.php?t=3837&p=17662. But I'll post a reply there.

EDIT: Just pulled the latest version of both the crazyflie-clients-python and crazyflie-lib-python and reinstalled them and now it works.