The Tunnel is serial-to-serial pass-through. It connects an autopilot serial port, e.g. from the GPS, directly to the modem serial port or a USB-to-serial connection. This I/O in turn can go to your development PC for example. There are other uses no doubt, but this in the most common use.
The Tunnel completely replaces the normal autopilot code, leaving the USB bootloader intact). Use this for example to gain direct access to the GPS for debugging or testing. Also for configuration with U-Center it will be quite useful.
You can either use a serial UART tunnel or USB tunnel:
You have to add the tunnel targets to your airframe file. The tunnel targets must be part of a firmware section of
name="setup". If it doesn't already exist in your airframe file, just add it.
An example on a Lisa M autopilot board
<firmware name="setup"> <target name="tunnel" board="lisa_m_2.0" /> <target name="usb_tunnel_0" board="lisa_m_2.0" /> </firmware>
Note, that you must replace the value of
board with your board name.
At the current state of the code only UART1 goes to UART2 and Vice versa and is sadly not configurable. Due to the opensource nature of PPRZ this can be made so ofcourse, you are welcomed to enhance the arch/uart_tunnel.c to add more and better functionality flexible tunnel port configuration.
Note that UART1 TX has no simple Physical connection on a Lisa/M
Use this if you have a serial cable to connect. The LEDs will blink when data is transferred. Type the following command from your paparazzi folder, substituting the name of your airframe and paying attention to case sensitivity:
make AIRCRAFT=myplane tunnel.upload
Connect the USB cable and power on the autopilot to receive the code.
This can be done without the USB bootloader by appending FLASH_MODE=ISP to the command line (specifying ISP serial loading). This will require a serial cable connection (i.e. FTDI USB-to-TTL). WARNING! Installing tunnel code with the ISP method will erase any USB bootloader code. Make sure you are able to install a bootloader yourself.
This can be done without a serial cable just by having USB. The LEDs will blink when data is transferred. It can connect to either serial port on the autopilot (for Tiny 2.11: uart0=gps, uart1=modem). To connect USB to the gps type the following command from your paparazzi folder, substituting the name of your airframe and paying attention to case sensitivity:
make AIRCRAFT=myplane usb_tunnel_0.upload
Connect the usb cable and power on the autopilot to receive the code. The code will switch the USB to emulate a serial port that you can access at /dev/ttyACMx. Windows user can extract the usbser.sys file from .cab file in C:\WINDOWS\Driver Cache\i386 and store it somewhere (C:\temp is a good place) along with the usbser.inf file. Windows then creates an extra COMx port that you can use in a terminal program or with ucenter. To use the USB tunnel make sure you first power the autopilot before connecting USB not to end up in the USB bootloader.
- USB cable
- USB to 8-pin Molex Picoblade Male-connector cable (optional, can use wireless link)
- Connect USB Cable + 8-pin Molex adapter to USB on your laptop
- Connect 8-pin Molex Connector on the Adapter cable to "usb" on Tiny2.11
- Power on Tiny2.11
- Enter this command in a terminal: make AIRCRAFT=Twinjet tunnel.upload
Success will show this in the last lines of the terminal window
Found USB device BootROM code: 2.12 Part ID: 0x0402FF25 (LPC2148, 512k Flash, 32k+8k RAM) BootLoader version: 1.3 # Starting software at 0x00004000
Now your Tiny2.11 will tunnel UART1 from the GPS direct to the serial connector on the board. So, using the 8-pin Molex to FTDI cable adapter (or use the wireless link e.g. XBee) you can use your computer to interact with the GPS module. One example is using u-blox u-center program to configure your GPS module. Like the bootloader if you bought your Tiny2.11 assembled check with your 3rd party vendors configured your GPS. Good chance you won't need to use the tunnel or configure the GPS module.The required cable may included with 3rd party vendors!