Error flashing firmware

Discussions related to embedded firmware, driver, and user mode application software development
spcutler
Posts: 28
Joined: Fri Mar 01, 2013 3:12 am

Error flashing firmware

Post by spcutler »

I have my bladeRF now recognized both in Windows (Win7-64) and Linux (Mint Linux under VirtualBox), and am trying to update the firmware via bladeRF-cli. I have the tool built successfully, but I get essentially the same error in both cases.

Windows:

Code: Select all

>bladeRF-cli.exe -p
[ERROR] Failed to retrieve serial number                                                                                
                                                                                                                        
    Backend:        libusb                                                                                              
    Serial:                                                                                                             
    USB Bus:        2                                                                                                   
    USB Address:    5        
    
>bladeRF-cli.exe -f latest.img    
[INFO] Found a bladeRF                                                                                                  
[ERROR] Failed to retrieve serial number                                                                                
[INFO] Claimed all inferfaces successfully                                                                              
********************************************************************************                                        
* ENTERING LEGACY MODE, PLEASE UPGRADE TO THE LATEST FIRMWARE BY RUNNING:                                               
* wget http://nuand.com/fx3/latest.img ; bladeRF-cli -b -f latest.img                                                   
********************************************************************************                                        
Flashing firmware...                                                                                                    
[INFO] Legacy change to interface 2                                                                                     
[INFO] Erasing 3 sectors starting @ sector 0                                                                            
[ERROR] Failed to erase sector 0                                                                                        
[ERROR] Received erase failure status from FX3.                                                                         
Error: failed to flash firmware: File or device I/O failure                                                             
Could not flash firmware
Linux:

Code: Select all

>sudo ./bladeRF-cli -p
[ERROR] Failed to retrieve serial number

    Backend:        libusb
    Serial:         
    USB Bus:        1
    USB Address:    2

>sudo ./bladeRF-cli -b -f ~/Code/bladeRF/latest.img
[INFO] Found a bladeRF
[ERROR] Failed to retrieve serial number
[INFO] Claimed all inferfaces successfully
********************************************************************************
* ENTERING LEGACY MODE, PLEASE UPGRADE TO THE LATEST FIRMWARE BY RUNNING:
* wget http://nuand.com/fx3/latest.img ; bladeRF-cli -b -f latest.img
********************************************************************************
Flashing firmware...
[INFO] Legacy change to interface 2
[INFO] Erasing 3 sectors starting @ sector 0
[ERROR] Failed to erase sector 0
[ERROR] Received erase failure status from FX3.
Error: failed to flash firmware: File or device I/O failure
Could not flash firmware
I had to use sudo, else I got other LibUSB errors. Any ideas as to what's going on? I'll try out another machine soon, but I haven't had any other problems with this machine. It's only USB 2.0, but I'd think that should still work.
spcutler
Posts: 28
Joined: Fri Mar 01, 2013 3:12 am

Re: Error flashing firmware

Post by spcutler »

I tried a separate machine, running Win7-64, and get the same error as above--with the exception of this additional text:

Code: Select all

[ERROR] could not access peripheral
[ERROR] could not access peripheral
[ERROR] could not access peripheral
[ERROR] could not access peripheral
This is with a USB 2 cable. With USB 3.0, I get a different error:

Code: Select all

[ERROR] Couldn't populate devinfo - LIBUSB_ERROR_NOT_SUPPORTED
[ERROR] Could not open bladeRF device: LIBUSB_ERROR_OVERFLOW

probe: Failed to probe for devices: Operation not supported
My main machine (used in my original post) is USB 2 only.
bpadalino
Posts: 303
Joined: Mon Mar 04, 2013 4:53 pm

Re: Error flashing firmware

Post by bpadalino »

Under linux, can you lspci | grep -i xhci so we can see which xhci controller you have? Could you also try running with --verbose verbose on the commandline? Hopefully it should print out extra debug information for us.

Lastly, it might be good to make this an issue on Github. It's easier to track that way and gets more visibility.
spcutler
Posts: 28
Joined: Fri Mar 01, 2013 3:12 am

Re: Error flashing firmware

Post by spcutler »

There's no xhci in the text, but there is EHCI:

Code: Select all

00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter
00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
00:04.0 System peripheral: InnoTek Systemberatung GmbH VirtualBox Guest Service
00:05.0 Multimedia audio controller: Intel Corporation 82801AA AC'97 Audio Controller (rev 01)
00:06.0 USB controller: Apple Inc. KeyLargo/Intrepid USB
00:07.0 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:0b.0 USB controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controller
00:0d.0 SATA controller: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 02)
Thanks for the github pointer. I'll file an issue. I tried "-v verbose", but it showed no additional output.

I can see that the libusb_control_transfer call successfully retrieves 4 bytes. However, the returned value (in erase_ret) is 0, which I guess is some generic erase failure.
bpadalino
Posts: 303
Joined: Mon Mar 04, 2013 4:53 pm

Re: Error flashing firmware

Post by bpadalino »

I just re-read this thread and you said you can get things to work if you use sudo? Is that correct, or you just get different errors?
spcutler
Posts: 28
Joined: Fri Mar 01, 2013 3:12 am

Re: Error flashing firmware

Post by spcutler »

bpadalino wrote:I just re-read this thread and you said you can get things to work if you use sudo? Is that correct, or you just get different errors?
I just got different errors if I don't use sudo. Actually, I can't seem to reproduce the problem (libusb errors) that I got without sudo (maybe restarting the VM fixed it?). At any rate, I am still getting the "failed to erase sector 0" message.
spcutler
Posts: 28
Joined: Fri Mar 01, 2013 3:12 am

Re: Error flashing firmware

Post by spcutler »

For the sake of completeness, I tried loading FPGA as well. I get some different looking errors:

Code: Select all

[INFO] Found a bladeRF
[ERROR] Failed to retrieve serial number
[INFO] Claimed all inferfaces successfully
********************************************************************************
* ENTERING LEGACY MODE, PLEASE UPGRADE TO THE LATEST FIRMWARE BY RUNNING:
* wget http://nuand.com/fx3/latest.img ; bladeRF-cli -b -f latest.img
********************************************************************************
Loading fpga...
[INFO] Legacy change to interface 0
[INFO] Legacy change to interface 1
[ERROR] could not access peripheral
[ERROR] could not access peripheral
[ERROR] could not access peripheral
[ERROR] could not access peripheral
[ERROR] could not access peripheral
[ERROR] could not access peripheral
Incidentally--the "-b" switch in the text listed no longer seems to exist. Anyone know what it does, or did?
spcutler
Posts: 28
Joined: Fri Mar 01, 2013 3:12 am

Re: Error flashing firmware

Post by spcutler »

And another weirdness: on both Windows and Linux, the "version" command crashes the command line utility. On Linux, it segfaults before printing anything. On Windows, I see this:

Code: Select all

[INFO] Found a bladeRF                                                                                                  
[ERROR] Failed to retrieve serial number                                                                                
[INFO] Claimed all inferfaces successfully                                                                              
[INFO] Legacy change to interface 1                                                                                     
[INFO] Changed into RF link mode: LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLETED                                            
********************************************************************************                                        
* ENTERING LEGACY MODE, PLEASE UPGRADE TO THE LATEST FIRMWARE BY RUNNING:                                               
* wget http://nuand.com/fx3/latest.img ; bladeRF-cli -b -f latest.img                                                   
********************************************************************************                                        
bladeRF> version                                                                                                        
[WARNING] FPGA currently does not have a version number.                                                                
                                                                                                                        
Serial #:               ════════════════════════════════════════☺                                                       
VCTCXO DAC calibration: 0xcdcd                                                                                          
FPGA size:              -842150451 KLE                                                                                  
Firmware version:       1.0                                                                                             
FPGA version:           0.0                                                                                             
Is it possible my unit is in some weird state that is confusing the software? I'm not sure "who" is doing the flashing, but presumably the FX3 has a bootloader or the like, and that is handling the flashing. Is it possible that it's corrupt on my unit?
cde
Posts: 7
Joined: Sat Aug 24, 2013 3:01 am

Re: Error flashing firmware

Post by cde »

AFAIK this is a know issue when flashing from a virtual machine. Please try using a non-virtualized Linux host.
spcutler
Posts: 28
Joined: Fri Mar 01, 2013 3:12 am

Re: Error flashing firmware

Post by spcutler »

cde wrote:AFAIK this is a know issue when flashing from a virtual machine. Please try using a non-virtualized Linux host.
I'll try that, but is it also a known issue with (native) Windows? I get the same error in both environments.
dsalomon
Posts: 25
Joined: Fri Jul 19, 2013 4:56 pm

Re: Error flashing firmware

Post by dsalomon »

I'm getting exactly the same error. Just compiled on Windows 7 64-bit. Tried it on 2 different USB controllers (VIA chipset and ASMedia chipset) as well as a USB2 controller. Exact same error messages on all 3.
dsalomon
Posts: 25
Joined: Fri Jul 19, 2013 4:56 pm

Re: Error flashing firmware

Post by dsalomon »

spcutler -

i was chatting with BzztPloink on the #bladerf IRC node, explaining this problem. He checked the source, and fixed it. You can either wait until he merges the change into the source and do a get, or just make the change to the source, as follows (this is what I did):

(7:56:54 PM) BzztPloink: http://pastebin.com/pKH5t8Mf
(7:57:10 PM) BzztPloink: in libusb.c replace the change_setting function with this

After making the change, recompile and it should work. I was just able to load the "latest.img" firmware file to the FX chip, then load the FPGA, then receive samples.

Woo hoo! :-)
spcutler
Posts: 28
Joined: Fri Mar 01, 2013 3:12 am

Re: Error flashing firmware

Post by spcutler »

Nice! I'll give that a shot tonight.
LazyDodo
Posts: 30
Joined: Fri Mar 01, 2013 6:49 am

Re: Error flashing firmware

Post by LazyDodo »

My pastebin probably expires in a couple of hours, I've moved it to the issue tracker at https://github.com/Nuand/bladeRF/issues/101
spcutler
Posts: 28
Joined: Fri Mar 01, 2013 3:12 am

Re: Error flashing firmware

Post by spcutler »

LazyDodo wrote:My pastebin probably expires in a couple of hours, I've moved it to the issue tracker at https://github.com/Nuand/bladeRF/issues/101
BTW, the fix works for me as well. I'm capturing samples! Now I just have to figure out what's wrong with my async buffer code...
Post Reply