Difference between revisions of "Luftboot"

From PaparazziUAV
Jump to navigation Jump to search
Line 93: Line 93:
* If you flashed luftboot bootloader on the board all following apply to Lisa/M as well as Lisa/MX
* If you flashed luftboot bootloader on the board all following apply to Lisa/M as well as Lisa/MX
* Connect the USB cable to the computer. Does the power LED light up?
* Connect the USB cable to the computer. Does the power LED light up?
* After plugging in the USB cable do the LEDs blink in the "bootloader pattern"?
* Connect the USB cable, what does "dmesg" indicate before and after plugging in the cable? Do you see an indication that the linux kernel finds a USB device?
* Connect the USB cable, what does "dmesg" indicate before and after plugging in the cable? Do you see an indication that the linux kernel finds a USB device?
* Check what "lsusb" is printing out. Do you see the device in there?
* Check what "lsusb" is printing out. Do you see the device in there?

Revision as of 15:37, 19 March 2016

Luftboot is the name for a small piece of software called a bootloader and is used for Lisa/M v2.0 to be able to simply upload new airframe an flightplans to the autopilotboard.

Sourcecode

The sourcecode is available in the paparazzi/luftboot repository on github. It is also integrated into the master branch of paparazzi as a submodule.

Uploading the Luftboot USB Bootloader

If you bought your Lisa/M v2.0 (e.g. from Transition Robotics Inc.) it should already come with the bootloader installed.

Only if you have a strong reason to (re)upload or update the bootloader, read on...

otherwise better visit this page Lisa/M v2.0#Uploading new software

Required components

So now you decided; Yes, because I have good reasons I want to re-upload the luftboot bootloader you need some equipment.

  • Floss-JTAG debugger or Blacksphere mini JTAG
  • Lisa/M board
  • PC

Procedure

The easiest way is to checkout the master branch and use the integrated luftboot git submodule:

  1. Check out the paparazzi master branch
    git checkout master
    
  2. If you were already using the master branch luftboot should already be built, otherwise:
    make ext
    
  3. Change directory into the luftboot/src folder, in paparazzi:
    cd sw/ext/luftboot/src
    
  4. Flash the Lisa/M v2.0 Attach the floss-jtag unit to the PC and connect it to the Lisa/M via the black connector. Power the Lisa/M (easiest way is to connect to the PC via a micro-USB cable).
    make flash DEV_SERIAL="LM2-ser"
    

    where "ser" stands for the serial number of your Lisa/M. So for example if you have lisa/m with the serial number 020 this would be:

    make flash DEV_SERIAL="LM2-020"
    

    To use the BlackMagicProbe instead of OpenOCD and FlossJTAG on linux:

    make flash DEV_SERIAL="LM2-020" BMP_PORT=/dev/ttyACM0
    

    or on OSX:

    make flash DEV_SERIAL="LM2-020" BMP_PORT=/dev/cu.usbmodem<serial>
    


As an alternative, you can also clone the Luftboot repository directly:

git clone https://github.com/paparazzi/luftboot.git

But then you manually have to install a recent version of libopencm3 (for example into /opt/libopencm3) in order to build luftboot. The libopencm3 from the paparazzi-arm-multilib package is not new enough to build luftboot.

Entering Bootloader Mode

Currently Luftboot cannot switch into bootloader mode using software only by USB.
However if you have a recent Luftboot version (since December 2012)

If you are in bootloader mode, the leds will cycle up and down:

Luftboot.gif

The boot sequence is:

  • Luftboot
    • Check if ADC2 is configured as output pull down indicating software bootloader request
      • If ADC2 output pull down: initialize usb and stay in bootloader mode
    • Setting the ADC2 pin to input pull up
    • Checking if the ADC2 pin is low
      • If ADC2 low: initialize USB and stay in bootloader mode
      • If ADC2 high: check if there is a payload at 0x8002000
        • If payload detected: set vector table pointer to be at 0x8002000 and jump to the reset handler of the payload
        • If payload not detected: initialize USB and stay in bootloader mode

Force bootloader on old versions

To enter the bootloader mode of old luftboot versions (before December 2012), you need a small cable to force the bootloader to run. This cable should bridge pin GND and ADC2 on your Lisa/M v2.0. Make sure you do not shortcircuit your board. Once your "Boot mode connector" is inserted, connect the Lisa/M to the PC via a micro-usb cable and it should start in bootloader mode. You should disconnect the "Boot mode connector" after enforcing the bootloader.

Luftboot USB permissions

Copy the udev-rules file is needed for the upload software to get permission to use this hardware in your PC for uploading. For short: the Python program "stm32_mem.py" needs permission to write to the the Luftboot USB device. If you do not have set this rules already you get an error message, which explanation what is wrong is quite obscure due to the way python-libusb accesses the device.

Troubleshooting

  • If you have a stock Lisa/MX it will not have a DFU boot loader, USB flashing is not supported by default
  • If you flashed luftboot bootloader on the board all following apply to Lisa/M as well as Lisa/MX
  • Connect the USB cable to the computer. Does the power LED light up?
  • After plugging in the USB cable do the LEDs blink in the "bootloader pattern"?
  • Connect the USB cable, what does "dmesg" indicate before and after plugging in the cable? Do you see an indication that the linux kernel finds a USB device?
  • Check what "lsusb" is printing out. Do you see the device in there?
  • Test with a different USB cable. It is a known issue that some USB cables work and others don't. Find a better quality shorter USB cable and try again.
  • If it is there and it still is not flashing. Did you install the paparazzi udev rules?
  • Did you try flashing as root and it worked? Then your permissions are wrong, go back and install the udev rules again.
  • If the flashing get's stuck in the middle of the process try different USB cable.
  • Are you using a virtual machine to run Linux? Try with a native linux installation instead, virtual machines are often problematic in the way they handle USB interfaces. It is very easy to install Ubuntu next to your Windows installation.
  • All fails use Black Magic Probe. It is the recommended way of programming the Lisa autopilots. If you have one do not use the USB boot loader.