|
|
|
@@ -32,6 +32,11 @@
|
|
|
|
|
|
|
|
|
|
// Serial Port
|
|
|
|
|
#include "mcu_periph/uart.h"
|
|
|
|
|
#include "mcu_periph/usb_serial.h"
|
|
|
|
|
|
|
|
|
|
#include "led.h"
|
|
|
|
|
|
|
|
|
|
#include "libopencm3/cm3/scb.h"
|
|
|
|
|
|
|
|
|
|
// define coms link for px4io f1
|
|
|
|
|
#define PX4IO_PORT (&((PX4IO_UART).device))
|
|
|
|
@@ -39,20 +44,20 @@
|
|
|
|
|
|
|
|
|
|
// weird that these below are not in protocol.h, which is from the firmware px4 repo
|
|
|
|
|
// below is copied from qgroundcontrol:
|
|
|
|
|
#define PROTO_INSYNC 0x12 ///< 'in sync' byte sent before status
|
|
|
|
|
#define PROTO_EOC 0x20 ///< end of command
|
|
|
|
|
#define PROTO_INSYNC 0x12 //< 'in sync' byte sent before status
|
|
|
|
|
#define PROTO_EOC 0x20 //< end of command
|
|
|
|
|
// Reply bytes
|
|
|
|
|
#define PROTO_OK 0x10 ///< INSYNC/OK - 'ok' response
|
|
|
|
|
#define PROTO_FAILED 0x11 ///< INSYNC/FAILED - 'fail' response
|
|
|
|
|
#define PROTO_INVALID 0x13 ///< INSYNC/INVALID - 'invalid' response for bad commands
|
|
|
|
|
#define PROTO_OK 0x10 //< INSYNC/OK - 'ok' response
|
|
|
|
|
#define PROTO_FAILED 0x11 //< INSYNC/FAILED - 'fail' response
|
|
|
|
|
#define PROTO_INVALID 0x13 //< INSYNC/INVALID - 'invalid' response for bad commands
|
|
|
|
|
// Command bytes
|
|
|
|
|
#define PROTO_GET_SYNC 0x21 ///< NOP for re-establishing sync
|
|
|
|
|
#define PROTO_GET_DEVICE 0x22 ///< get device ID bytes
|
|
|
|
|
#define PROTO_CHIP_ERASE 0x23 ///< erase program area and reset program address
|
|
|
|
|
#define PROTO_LOAD_ADDRESS 0x24 ///< set next programming address
|
|
|
|
|
#define PROTO_PROG_MULTI 0x27 ///< write bytes at program address and increment
|
|
|
|
|
#define PROTO_GET_CRC 0x29 ///< compute & return a CRC
|
|
|
|
|
#define PROTO_BOOT 0x30 ///< boot the application
|
|
|
|
|
#define PROTO_GET_SYNC 0x21 //< NOP for re-establishing sync
|
|
|
|
|
#define PROTO_GET_DEVICE 0x22 //< get device ID bytes
|
|
|
|
|
#define PROTO_CHIP_ERASE 0x23 //< erase program area and reset program address
|
|
|
|
|
#define PROTO_LOAD_ADDRESS 0x24 //< set next programming address
|
|
|
|
|
#define PROTO_PROG_MULTI 0x27 //< write bytes at program address and increment
|
|
|
|
|
#define PROTO_GET_CRC 0x29 //< compute & return a CRC
|
|
|
|
|
#define PROTO_BOOT 0x30 //< boot the application
|
|
|
|
|
|
|
|
|
|
bool_t setToBootloaderMode;
|
|
|
|
|
|
|
|
|
@@ -63,82 +68,111 @@ void px4ioflash_init(void)
|
|
|
|
|
|
|
|
|
|
void px4ioflash_event(void)
|
|
|
|
|
{
|
|
|
|
|
// setToBootloaderMode=true;
|
|
|
|
|
if (PX4IO_PORT->char_available(PX4IO_PORT->periph)) {
|
|
|
|
|
if (!setToBootloaderMode) {
|
|
|
|
|
//ignore anything coming from IO if not in bootloader mode (which should be nothing)
|
|
|
|
|
} else {
|
|
|
|
|
//relay everything from IO to the laptop
|
|
|
|
|
unsigned char b = PX4IO_PORT->get_byte(PX4IO_PORT->periph);
|
|
|
|
|
TELEM2_PORT->put_byte(TELEM2_PORT->periph, b);
|
|
|
|
|
while (PX4IO_PORT->char_available(PX4IO_PORT->periph)) {
|
|
|
|
|
unsigned char b = PX4IO_PORT->get_byte(PX4IO_PORT->periph);
|
|
|
|
|
TELEM2_PORT->put_byte(TELEM2_PORT->periph, b);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TODO: check if timeout was surpassed
|
|
|
|
|
//TODO: check if bootloader timeout was surpassed
|
|
|
|
|
if (TELEM2_PORT->char_available(TELEM2_PORT->periph) && !setToBootloaderMode) {
|
|
|
|
|
//data was received on the pc uart, so
|
|
|
|
|
//stop all intermcu comminication:
|
|
|
|
|
disable_inter_comm(true);
|
|
|
|
|
//send the reboot to bootloader command:
|
|
|
|
|
// TMP TEST
|
|
|
|
|
// while (TELEM2_PORT->char_available(TELEM2_PORT->periph)) {
|
|
|
|
|
// unsigned char bla = TELEM2_PORT->get_byte(TELEM2_PORT->periph);
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,bla);
|
|
|
|
|
// }
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
//check whether this is flash related communication, and for who (ap/fbw)
|
|
|
|
|
int state = 0;
|
|
|
|
|
while (state < 4 && TELEM2_PORT->char_available(TELEM2_PORT->periph)) {
|
|
|
|
|
unsigned char b = TELEM2_PORT->get_byte(TELEM2_PORT->periph);
|
|
|
|
|
switch (state) {
|
|
|
|
|
case (0) :
|
|
|
|
|
if (b == 'p') { state++; } else { return; }
|
|
|
|
|
break;
|
|
|
|
|
case (1) :
|
|
|
|
|
if (b == 'p') { state++; } else { return; }
|
|
|
|
|
break;
|
|
|
|
|
case (2) :
|
|
|
|
|
if (b == 'r') { state++; } else { return; }
|
|
|
|
|
break;
|
|
|
|
|
case (3) :
|
|
|
|
|
if (b == 'z') { state++; } else { return; }
|
|
|
|
|
break;
|
|
|
|
|
default :
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state != 4) {return;}
|
|
|
|
|
//TODO: check if/how this interferes with flashing original PX4 firmware
|
|
|
|
|
unsigned char target = TELEM2_PORT->get_byte(TELEM2_PORT->periph);
|
|
|
|
|
if (target == '1') { //target ap
|
|
|
|
|
//the target is the ap, so reboot to PX4 bootloader
|
|
|
|
|
scb_reset_system();
|
|
|
|
|
|
|
|
|
|
} else { // target fbw
|
|
|
|
|
//the target is the fbw, so reboot the fbw and switch to relay mode
|
|
|
|
|
|
|
|
|
|
//stop all intermcu communication:
|
|
|
|
|
disable_inter_comm(true);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The progdieshit define is very usefull, if for whatever reason the (normal, not bootloader) firmware on the IO chip became disfunct.
|
|
|
|
|
* In that case:
|
|
|
|
|
* 1. enable this define
|
|
|
|
|
* 2. build and upload the fmu f4 chip (ap target in pprz center)
|
|
|
|
|
* 3. build the io code, and convert the firmware using the following command:
|
|
|
|
|
* /home/houjebek/paparazzi/sw/tools/pixhawk/px_mkfw.py --prototype "/home/houjebek/px4/Firmware/Images/px4io-v2.prototype" --image /home/houjebek/paparazzi/var/aircrafts/Iris/fbw/fbw.bin > /home/houjebek/paparazzi/var/aircrafts/Iris/fbw/fbw.px4
|
|
|
|
|
* /home/houjebek/paparazzi/sw/tools/px4/px_mkfw.py --prototype "/home/houjebek/px4/Firmware/Images/px4io-v2.prototype" --image /home/houjebek/paparazzi/var/aircrafts/Iris/fbw/fbw.bin > /home/houjebek/paparazzi/var/aircrafts/Iris/fbw/fbw.px4
|
|
|
|
|
* 4. Start the following command:
|
|
|
|
|
* /home/houjebek/paparazzi/sw/tools/pixhawk/px_uploader.py --port "/dev/serial/by-id/usb-FTDI_TTL232R-3V3_FT906KBO-if00-port0" /home/houjebek/paparazzi/var/aircrafts/Iris/fbw/fbw.px4
|
|
|
|
|
* /home/houjebek/paparazzi/sw/tools/px4/px_uploader.py --port "/dev/ttyACM0" /home/houjebek/paparazzi/var/aircrafts/Iris/fbw/fbw.px4
|
|
|
|
|
* 5a. Either, boot the Pixhawk (reconnect usb) holding the IO reset button until the FMU led stops blinking fast (i.e. exits its own bootloader)
|
|
|
|
|
* 5b Or, press the IO reset button on the pixhawk
|
|
|
|
|
* 6. Watch the output of the command of step 4, it should recognize the IO bootloader and start flashing. If not try repeating step 5a.
|
|
|
|
|
* 7. Don forget to disable the define and upload the ap again :)
|
|
|
|
|
*/
|
|
|
|
|
//#define progdieshit
|
|
|
|
|
// #define progdieshit
|
|
|
|
|
|
|
|
|
|
#ifndef progdieshit
|
|
|
|
|
static struct IOPacket dma_packet;
|
|
|
|
|
dma_packet.count_code = 0x40 + 0x01;
|
|
|
|
|
dma_packet.crc = 0;
|
|
|
|
|
dma_packet.page = PX4IO_PAGE_SETUP;
|
|
|
|
|
dma_packet.offset = PX4IO_P_SETUP_REBOOT_BL;
|
|
|
|
|
dma_packet.regs[0] = PX4IO_REBOOT_BL_MAGIC;
|
|
|
|
|
dma_packet.crc = crc_packet(&dma_packet);
|
|
|
|
|
struct IOPacket *pkt = &dma_packet;
|
|
|
|
|
uint8_t *p = (uint8_t *)pkt;
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[0]);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[1]);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[2]);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[3]);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[4]);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[5]);
|
|
|
|
|
//send the reboot to bootloader command:
|
|
|
|
|
static struct IOPacket dma_packet;
|
|
|
|
|
dma_packet.count_code = 0x40 + 0x01;
|
|
|
|
|
dma_packet.crc = 0;
|
|
|
|
|
dma_packet.page = PX4IO_PAGE_SETUP;
|
|
|
|
|
dma_packet.offset = PX4IO_P_SETUP_REBOOT_BL;
|
|
|
|
|
dma_packet.regs[0] = PX4IO_REBOOT_BL_MAGIC;
|
|
|
|
|
dma_packet.crc = crc_packet(&dma_packet);
|
|
|
|
|
struct IOPacket *pkt = &dma_packet;
|
|
|
|
|
uint8_t *p = (uint8_t *)pkt;
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[0]);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[1]);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[2]);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[3]);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[4]);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, p[5]);
|
|
|
|
|
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'E');
|
|
|
|
|
// for (int i=0;i<6;i++) {
|
|
|
|
|
// unsigned char tmp[3];
|
|
|
|
|
// itoa(p[i],tmp,16);
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,tmp[0]);
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,tmp[1]);
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\n');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\r');
|
|
|
|
|
// }
|
|
|
|
|
sys_time_usleep(5000); // this seems to be close to the minimum delay necessary to process this packet at the IO side
|
|
|
|
|
//the pixhawk IO chip should respond with:
|
|
|
|
|
// 0x00 ( PKT_CODE_SUCCESS )
|
|
|
|
|
// 0xe5
|
|
|
|
|
// 0x32
|
|
|
|
|
// 0x0a
|
|
|
|
|
//After that, the IO chips reboots into bootloader mode, in which it will stay for a short period
|
|
|
|
|
//The baudrate in bootloader mode ic changed to 115200 (normal operating baud is 1500000, at least for original pixhawk fmu firmware)
|
|
|
|
|
|
|
|
|
|
sys_time_usleep(5000); // this seems to be close to the minimum delay necessary to process this packet at the IO side
|
|
|
|
|
//the pixhawk IO chip should respond with:
|
|
|
|
|
// 0x00 ( PKT_CODE_SUCCESS )
|
|
|
|
|
// 0xe5
|
|
|
|
|
// 0x32
|
|
|
|
|
// 0x0a
|
|
|
|
|
//After that, the IO chips reboots into bootloader mode, in which it will stay for a short period
|
|
|
|
|
//The baudrate in bootloader mode ic changed to 115200 (normal operating baud is 1500000, at least for original pixhawk fmu firmware)
|
|
|
|
|
//state machine
|
|
|
|
|
state = 0;
|
|
|
|
|
while (state < 4 && PX4IO_PORT->char_available(PX4IO_PORT->periph)) {
|
|
|
|
|
|
|
|
|
|
//state machine
|
|
|
|
|
int state = 0;
|
|
|
|
|
while (state < 4 && PX4IO_PORT->char_available(PX4IO_PORT->periph)) {
|
|
|
|
|
|
|
|
|
|
unsigned char b = PX4IO_PORT->get_byte(PX4IO_PORT->periph);
|
|
|
|
|
switch (state) {
|
|
|
|
|
unsigned char b = PX4IO_PORT->get_byte(PX4IO_PORT->periph);
|
|
|
|
|
switch (state) {
|
|
|
|
|
case (0) :
|
|
|
|
|
if (b == PKT_CODE_SUCCESS) { state++; } else { state = 0; }
|
|
|
|
|
break;
|
|
|
|
@@ -152,107 +186,50 @@ void px4ioflash_event(void)
|
|
|
|
|
if (b == 0x0a) { state++; } else { state = 0; }
|
|
|
|
|
break;
|
|
|
|
|
default :
|
|
|
|
|
TELEM2_PORT->put_byte(TELEM2_PORT->periph, 'b');
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'S');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,state+48);
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\n');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\r');
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
int state = 4;
|
|
|
|
|
#endif
|
|
|
|
|
if (state == 4) {
|
|
|
|
|
#ifndef progdieshit
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'S');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'6');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\n');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\r');
|
|
|
|
|
#endif
|
|
|
|
|
uart_periph_set_baudrate(PX4IO_PORT->periph, B115200);
|
|
|
|
|
/* look for the bootloader for 150 ms */
|
|
|
|
|
int ret = 0;
|
|
|
|
|
for (int i = 0; i < 15 && !ret ; i++) {
|
|
|
|
|
sys_time_usleep(10000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//send a get_sync command in order to keep the io in bootloader mode
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, PROTO_GET_SYNC);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, PROTO_EOC);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef progdieshit
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'S');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'6');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'a');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\n');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\r');
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//get_sync should be replied with, so check if that happens and
|
|
|
|
|
//all other bytes are discarded, hopefully those were not important
|
|
|
|
|
//(they may be caused by sending multiple syncs)
|
|
|
|
|
while (PX4IO_PORT->char_available(PX4IO_PORT->periph)) {
|
|
|
|
|
unsigned char b = PX4IO_PORT->get_byte(PX4IO_PORT->periph);
|
|
|
|
|
|
|
|
|
|
#ifndef progdieshit
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'S');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'6');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'b');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\n');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\r');
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (b == PROTO_INSYNC) {
|
|
|
|
|
#ifndef progdieshit
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'S');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'7');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\n');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\r');
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
setToBootloaderMode = true;
|
|
|
|
|
ret = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (setToBootloaderMode) {
|
|
|
|
|
|
|
|
|
|
#ifndef progdieshit
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'S');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'8');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\n');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\r');
|
|
|
|
|
#else
|
|
|
|
|
int state = 4;
|
|
|
|
|
#endif
|
|
|
|
|
if (state == 4) {
|
|
|
|
|
uart_periph_set_baudrate(PX4IO_PORT->periph, B115200);
|
|
|
|
|
/* look for the bootloader for 150 ms */
|
|
|
|
|
int ret = 0;
|
|
|
|
|
for (int i = 0; i < 15 && !ret ; i++) {
|
|
|
|
|
sys_time_usleep(10000);
|
|
|
|
|
|
|
|
|
|
//if successfully entered bootloader mode, clear any remaining bytes (which may have a function, but I did not check)
|
|
|
|
|
while (PX4IO_PORT->char_available(PX4IO_PORT->periph)) {PX4IO_PORT->get_byte(PX4IO_PORT->periph);}
|
|
|
|
|
//send a get_sync command in order to keep the io in bootloader mode
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, PROTO_GET_SYNC);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, PROTO_EOC);
|
|
|
|
|
|
|
|
|
|
//get_sync should be replied with, so check if that happens and
|
|
|
|
|
//all other bytes are discarded, hopefully those were not important
|
|
|
|
|
//(they may be caused by sending multiple syncs)
|
|
|
|
|
while (PX4IO_PORT->char_available(PX4IO_PORT->periph)) {
|
|
|
|
|
unsigned char b = PX4IO_PORT->get_byte(PX4IO_PORT->periph);
|
|
|
|
|
|
|
|
|
|
if (b == PROTO_INSYNC) {
|
|
|
|
|
setToBootloaderMode = true;
|
|
|
|
|
ret = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (setToBootloaderMode) {
|
|
|
|
|
//if successfully entered bootloader mode, clear any remaining bytes (which may have a function, but I did not check)
|
|
|
|
|
while (PX4IO_PORT->char_available(PX4IO_PORT->periph)) {PX4IO_PORT->get_byte(PX4IO_PORT->periph);}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
TELEM2_PORT->put_byte(TELEM2_PORT->periph, 'E'); //TODO: find out what the PX4 protocol for error feedback is...
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifndef progdieshit
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'S');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'9');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\n');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\r');
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
TELEM2_PORT->put_byte(TELEM2_PORT->periph, 'E');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'r');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'r');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'o');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'r');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\n');
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,'\r');
|
|
|
|
|
}
|
|
|
|
|
} else if (TELEM2_PORT->char_available(TELEM2_PORT->periph)) {
|
|
|
|
|
//already in bootloader mode, just directly relay data
|
|
|
|
|
unsigned char b = TELEM2_PORT->get_byte(TELEM2_PORT->periph);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, b);
|
|
|
|
|
// TELEM2_PORT->put_byte(TELEM2_PORT->periph,b);
|
|
|
|
|
while (TELEM2_PORT->char_available(TELEM2_PORT->periph)) {
|
|
|
|
|
unsigned char b = TELEM2_PORT->get_byte(TELEM2_PORT->periph);
|
|
|
|
|
PX4IO_PORT->put_byte(PX4IO_PORT->periph, b);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|