Difference between revisions of "Tunnel"

From PaparazziUAV
Jump to navigation Jump to search
(Making sure ppl will not repeat my mistake and will understand that they may need to add another firmware section when using the tunnel.)
Line 4: Line 4:
|}
|}


This completely replaces the normal autopilot code (leaving the USB bootloader intact) with a simple serial-to-serial pass-through that essentially connects the serial port (e.g. from the GPS) directly to the modem serial port or a USB-to-serial connection that creates a USB serial port that goes to GPS port or modem port. Use this only to gain direct access to the GPS for testing/configuration with [[GPS#GPS_configuration_using_U-Center|U-Center]] or other software.
The Tunnel is serial-to-serial pass-through that connects the serial port, e.g. from the GPS, directly to the modem serial port or a USB-to-serial connection.
 
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 [[GPS#GPS_configuration_using_U-Center|U-Center]] it will be quite useful.


You can either use a serial UART tunnel or USB tunnel:
You can either use a serial UART tunnel or USB tunnel:


You have to add the tunnel targets to your airframe file if you want to use them. The tunnel targets must be part of a firmware section of <code>name="setup"</code>. Add this too, if it doesn't already exist in your airframe file.  
You have to add the tunnel targets to your airframe file. The tunnel targets must be part of a firmware section of <code>name="setup"</code>. If it doesn't already exist in your airframe file, just add it.
 
An example on a Lisa M autopilot board
 
   <firmware name="setup">
   <firmware name="setup">
     <target name="tunnel" board="twog_1.0" />
     <target name="tunnel" board="lisa_m_2.0" />
     <target name="usb_tunnel_0" board="twog_1.0" />
     <target name="usb_tunnel_0" board="lisa_m_2.0" />
   </firmware>
   </firmware>
Note, that you must replace the value of <code>board</code> with your board name.  
 
Note, that you must replace the value of <code>board</code> with your board name.
 
At the current state of the code only UART1 goes to UART2 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.
 
== UART tunnel ==
== UART tunnel ==



Revision as of 03:36, 22 November 2017

The Tunnel is serial-to-serial pass-through that connects the serial port, e.g. from the GPS, directly to the modem serial port or a USB-to-serial connection.

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 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.

UART tunnel

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.

USB tunnel

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.

Required Cables:

  1. USB cable
  2. USB to 8-pin Molex Picoblade Male-connector cable (optional, can use wireless link)

Steps:

  1. Connect USB Cable + 8-pin Molex adapter to USB on your laptop
  2. Connect 8-pin Molex Connector on the Adapter cable to "usb" on Tiny2.11
  3. Power on Tiny2.11
  4. 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!