Difference between revisions of "Luftboot"

From PaparazziUAV
Jump to navigation Jump to search
Line 13: Line 13:
If you want to (re)upload or update the bootloader, read on... otherwise see [[Lisa/M v2.0#Uploading new software]]
If you want to (re)upload or update the bootloader, read on... otherwise see [[Lisa/M v2.0#Uploading new software]]


'''The libopencm3 from the paparazzi-arm-multilib package is not new enough to build luftboot.'''
'''The libopencm3 from the paparazzi-arm-multilib package is not new enough to build luftboot.'''<br />
You must manually install libopencm3 (for example into /opt/libopencm3) in order to build luftboot.
You must manually install libopencm3 (for example into /opt/libopencm3) in order to build luftboot.<br />
To compile libopencm3 with the ppz arm-none-eabi toolchain the examples folder must be removed.
To compile libopencm3 with the ppz arm-none-eabi toolchain the examples folder must be removed.



Revision as of 09:35, 21 February 2013

Luftboot is a bootloader for STM32 based boards and used for Lisa/M v2.0.
The source is available in the paparazzi/luftboot repository on github. It is also integrated into the master branch 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.
If you want to (re)upload or update the bootloader, read on... otherwise see Lisa/M v2.0#Uploading new software

The libopencm3 from the paparazzi-arm-multilib package is not new enough to build luftboot.
You must manually install libopencm3 (for example into /opt/libopencm3) in order to build luftboot.
To compile libopencm3 with the ppz arm-none-eabi toolchain the examples folder must be removed.

Required components

  • 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.
Otherwise clone the Luftboot repository directly:

git clone https://github.com/paparazzi/luftboot.git
  1. Change directory into the luftboot/src folder, in paparazzi:
    cd sw/ext/luftboot/src
    
  2. If you are using the submodule in the Paparazzi directory (sw/ext/luftboot) it should already be built, otherwise:
    make clean && make
    
  3. 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:

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

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.