Page 1 of 1

Firmware "Failed to flash" error

Posted: Mon Nov 01, 2021 11:34 pm
by traffens
Good evening all,

I've created my own custom firmware by following the guide:
https://www.bitcraze.io/documentation/r ... ystemtask/

I followed this guide to a T except I replaced any word "example" with "pairing". after doing this, the makefile successfully runs, however when I run

Make cload


it will fail with the following message:

Code: Select all

bitcraze@ubuntu:~/Desktop/projects/crazyflie-firmware$ make cload
python3 -m cfloader  flash  cf2.bin stm32-fw
Restart the Crazyflie you want to bootload in the next
 10 seconds ...
Failed to flash: 'NoneType' object has no attribute 'group'





EDIT: I imported traceback and have it here:

Code: Select all

bitcraze@ubuntu:~/Desktop/projects/crazyflie-firmware$ make cload
python3 -m cfloader  flash  cf2.bin stm32-fw
Restart the Crazyflie you want to bootload in the next
 10 seconds ...
Failed to flash: 'NoneType' object has no attribute 'group'
Traceback (most recent call last):
  File "/home/bitcraze/projects/crazyflie-clients-python/src/cfloader/__init__.py", line 155, in main
    bl.flash_full(None, filename, warm_boot, targets)
  File "/home/bitcraze/projects/crazyflie-lib-python/cflib/bootloader/__init__.py", line 207, in flash_full
    if not self.start_bootloader(warm_boot=warm, cf=cf):
  File "/home/bitcraze/projects/crazyflie-lib-python/cflib/bootloader/__init__.py", line 105, in start_bootloader
    uri = self._cload.scan_for_bootloader()
  File "/home/bitcraze/projects/crazyflie-lib-python/cflib/bootloader/cloader.py", line 86, in scan_for_bootloader
    res = link.scan_selected(self._available_boot_uri)
  File "/home/bitcraze/projects/crazyflie-lib-python/cflib/crtp/radiodriver.py", line 362, in scan_selected
    one_to_scan['channel'] = int(uri_data.group(4))
AttributeError: 'NoneType' object has no attribute 'group'
'NoneType' object has no attribute 'group'



How can I troubleshoot this further? is there something not shown in the guide above that I need to do?

Re: Firmware "Failed to flash" error

Posted: Tue Nov 02, 2021 1:03 pm
by arnaud
Have you started your Crazyflie in bootloader mode? This is done by holding the ON/OFF switch until the M2 LED starts blinking, then both M2 and M3 should blink and you should be able to run make cload without problems.

Re: Firmware "Failed to flash" error

Posted: Thu Nov 04, 2021 2:11 am
by traffens
Regardless of whether or not it's in bootloader mode (and yes I did), the error still comes.

Re: Firmware "Failed to flash" error

Posted: Thu Nov 04, 2021 12:19 pm
by arnaud
This is strange, I have seen this error when another Crazyflie was present on channel 0 or 80, so I could imagine it happening if you are not in bootloader mode. Though, it should work if the bootloader is launched on the Crazyflie

Are both blue LED blinking when the Crazyflie is in bootloader mode? Does the M4 LED blink a little bit when you launch the make cload?

You can also make sure you are running the latest version of the lib by running the update all script in the VM an that your USB radio is well passed to the VM.

Re: Firmware "Failed to flash" error

Posted: Thu Nov 04, 2021 4:41 pm
by traffens
both blue LEDs are blinking when I start the cload. I haven't actually watched them when I run the command, I'll try that later today.

I'll try updating all the projects and then flash again.


What's confusing to me is that the make cload should time out after 10 seconds, not immediately error out when I run make cload. This leads me to believe the problem lies elsewhere.

Re: Firmware "Failed to flash" error

Posted: Sun Nov 07, 2021 1:05 am
by traffens
I've rotated through like 4 vms during this process due to anomalistic errors that come up outta nowhere. Did some cloning/copying on to Ubuntu 20.04 and it worked.

So why does this happen on the bitcraze VM though? how can I keep troubleshooting this?

Re: Firmware "Failed to flash" error

Posted: Tue Nov 09, 2021 5:36 am
by jonasdn
Perhaps this is better suited as a GitHub issue as it regards code directly, would you mind filing one at https://github.com/bitcraze/crazyflie-lib-python/issues ?

Please include what version of the lib you are using, you can get this information by: $ pip show cflib

The code that has problem seem to be:

Code: Select all

def scan_selected(self, links):
        to_scan = ()
        for link in links:
            one_to_scan = {}
            uri_data = re.search('^radio://([0-9]+)((/([0-9]+))'
                                 '(/(250K|1M|2M))?)?',
                                 link)

            one_to_scan['channel'] = int(uri_data.group(4))
Where uri_data seem to be None so it does not detect a radio-uri for some reason. Are you sure the VM has detected the dongle?
You could modify the code to print the 'link' variable here to see what the lib things it is working with.

Jonas

Re: Firmware "Failed to flash" error

Posted: Wed Dec 01, 2021 12:19 am
by traffens
The error I had was an out-of-date radiodriver.py. Apologies for the frustrations. You guys are great