====== PIDflight Lap ====== ===== Flashing firmware to lap timing device ===== The following are two options you may use to flash the firmware HEX file to the Arduino nano board. * The **Xloader** option is available only for Windows operating system, it may also be used within Windows virtual machines. * The **avrdude** option is packaged with the [[https://www.arduino.cc/|Arduino IDE]] and can be used on all platforms. ==== Drivers ==== The CH340 chip is used by a number of Arduino compatible boards to provide USB connectivity. You may need to install the following driver to connect and flash firmware to these boards. * Windows: http://www.wch.cn/download/CH341SER_ZIP.html * Mac OS X: http://www.wch.cn/download/CH341SER_MAC_ZIP.html * Linux: http://www.wch.cn/download/CH341SER_LINUX_ZIP.html ---- ===== Xloader ===== - Download and open {{:pidflight:xloader.zip|Xloader}}. - Select the PIDflight Lap HEX file. - Select "Device" as "Duemilanove/Nano (ATmega328)" - Specify "COM port" as the COM port of the Arduino. - Ensure "Baud rate" is set to 57600. - Select "Upload" to flash the firmware HEX to the Arduino board. {{ :pidflight:xloader_laprssi.png?nolink&200 |}} ---- ===== avrdude ===== Using avrdude to flash the HEX file to the Arduino Nano board. avrdude -U flash:w:**[HEX FILE]**:i -e -p atmega328p -b 57600 -c arduino -P **[COM PORT]** Example: $ avrdude -U flash:w:pidflight-lap-firmware-1.2.0.hex:i -e -p atmega328p -b 57600 -c arduino -P /dev/ttyUSB0 avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e950f (probably m328p) avrdude: erasing chip avrdude: reading input file "pidflight-lap-firmware-1.2.0.hex" avrdude: writing flash (7350 bytes): Writing | ################################################## | 100% 2.26s avrdude: 7350 bytes of flash written avrdude: verifying flash memory against pidflight-lap-firmware-1.2.0.hex: avrdude: load data flash data from input file pidflight-lap-firmware-1.2.0.hex: avrdude: input file pidflight-lap-firmware-1.2.0.hex contains 7350 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 1.73s avrdude: verifying ... avrdude: 7350 bytes of flash verified avrdude: safemode: Fuses OK (E:00, H:00, L:00) avrdude done. Thank you. ---- ===== Troubleshooting ===== * **No COM port showing when Arduino is plugged in Xloader or Device Manager** -- try installing the CH340 driver from the [[#drivers|drivers]] section. * **Failing to flash the HEX file to the Arduino** -- try another USB cable and/or USB port.