Dev/LisaL

From PaparazziUAV
Jump to navigation Jump to search

This page describes the whereabouts of Lisa/L from a developer point of view


Hardware

Lisa/L is based on the 64 pins STM32F103RE processor featuring 64k of RAM and 512k of FLASH. All the pins are exposed, providing access to the complete set of the STM32 peripherals.

Power Supply

The board features a pair of two amps switching power supply module, one on 5V for external peripherals ( like modems, servos, USB webcams or wifi sticks) and one on 3V3 for the rest of the avionics. A third linear supply is available for providing clean power to inertial sensors.

The Lisa/L v0.99 and 0.101 (1.0-r1) has an input range of 8V to 18V. Upper limit due to PTH08080WAH switcher, and lower limit is due to LM317MDTXFS linear reg for intermediate voltage for analog components. (source Piotr)

MCU

In brief, the STM32 features 3 USARTS, 2 SPI, 2 I2C, 1 CAN, a plethora of timers, ADCs and a generic DMA able to serve all of them. On the board, a number of the communication interfaces are level shifted with user selectable voltage to allow interfacing with all kind of peripherals.

Pressure sensors

The board is equipped with a pair of pressure sensors, one absolute to measure altitude and one differential to measure airspeed. The sensors are amplified and low passed before being sampled by a pair of 16 bits ADCs.

The absolute pressure sensor is the freescale MPXh6115 and the differential one is the MPXV5004DP The following plots displays the output of the sensors versus altitude or airspeed

Absolute pressure.png Differential pressure.png


FT2232H

This chip is heart of the communications with the board while developing. It provides JTAG on the STM32 and SERIAL/USB conversion for the Overo console. It is powered by the USB bus and hence unpowered while in flight.

datasheet: URL

mini module used for dev : URL

The design of that module is based on FLOSS-JTAG.

Gumstix Overo COM

[1] mechanical drawings

The gumstix Overo is a single board computer module featuring a 600Mhz OMAP35 processor. It communicates with the STM32 through SPI, offering throughput up to 48Mbps and served by DMA on both sides. Exposed peripherals comprise two level shifted UARTs and two USB controllers ( one Host and one OTG )

CAN

There are several passives around the CAN transceiver that are responsable for the bus configuration and termination.

For termination there are three options:

  • Option 1 (Standard Termination):
R57: 120 Ohm
R59: DNP
R58: DNP
C42: DNP
R60: DNP
R61: DNP
  • Option 2 (Split Termination):
R57: DNP
R59: 60 Ohm
R58: 60 Ohm
C42: 4.7 nF
R60: DNP
R61: DNP
  • Option 3 (Biased Split Termination):
R57: DNP
R59: 60 Ohm
R58: 60 Ohm
C42: 4.7 nF
R60: 4.7k Ohm
R61: 4.7k Ohm

For more detailed description refer to Microchip Application Note 228

For the waveform (maximal speed/range) there are also few options:

  • High speed mode, 1Mbit maximal speed:
R55: 0 Ohm
R56: DNP
  • Slope control, decreases EMI and decreases the maximal speed but increases theoretical length of wiring:
R55: 10k Ohm - 120k Ohm
R56: DNP
  • Sleep mode, disable the transceiver and make it sleep:
R55: DNP
R56: 0Ohm

For more detailed description refer to MCP2551 Datasheet

Schematics

You can find the schematics of Lisa/L in the svn repository here:

svn co svn://svn.savannah.nongnu.org/paparazzi/paparazzi-hardware/trunk paparazzi-hardware

in lisa/V1.1 directory.

If you have no Eagle PCB software or just need a quick peek you can also look at Dev/LisaL/Schematics/V1.0 or Dev/LisaL/Schematics/V1.1. This page also includes the place plans to find positions of parts.

Software

Airframe in the svn currently running on lisa/L

- Poine/h_hex : this is an hexarotor with mikrokopter motor controllers and running booz2 code in the stm32
- Poine/booz2_a7 : this is an asctec quadrotor with astec motor controllers and running booz2 code in the stm32
- Poine/booz2_a8 : this is a biplan with asctec motor controllers and using stm32 only as io processor - this one is in progress
- esden/lisa_asctec : this is an asctec quadrotor with asctec motor controllers and running booz2 code in the stm32 using xtend based rc remote control.

STM32 toolchain

Install paparazzi-stm32 package available in the ENAC karmic and lucid repository. This toolchains contains gcc, newlib, libstm32, gdb and openocd

apt-get install paparazzi-stm32

Don't forget the udev rule to get the correct permission for JTAG

in /conf/system/udev/rules/10-paparazzi.rules add :

#needed for lisa usb upload
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010",
MODE="0666", GROUP="plugdev"

and folow Setting access rights for USB download on this page: Installation

Bug in package paparazzi-stm32, will be fixed in the next version, change ft2232_device_desc to "Lisa/L" in /opt/paparazzi/stm32/share/openocd/scripts/interface/openocd-lisa-jtag.cfg

replace:

ft2232_device_desc "Dual RS232 A"

by

ft2232_device_desc "Lisa/L"

STM32 programs

Booz code now runs in the stm32. booz2_a6.xml is an airframe for an hexarotor using mikrokopter controller and booz2_a7 is an airframe for an asctec using asctec controllers.

make AIRCRAFT=BOOZ2_A7 ap.upload

will compile and upload the booz autopilot on the stm32 through jtag

There are a number of test programs ( see targets in conf/autopilot/lisa_test_progs.makefile )

make AIRCRAFT=BOOZ2_A7 test_led.upload

will compile and upload a simple led blinking program in the stm32

Open Embedded

Open Embedded is the linux distribution used on the overo. LisaOveroImage summarizes the instructions for building the development tree.

Gumstix Open Embedded image building Howto

obsolete, left for reference : Setting_up_a_build_environment_for_overo-oe

OMAP programs

There are a couple of demo programs ( at the top of conf/autopilot/lisa_test_progs.makefile )

overo_test_periodic : shows how to use the high precision timers

overo_test_telemetry : shows how to send telemetry through UDP

overo_test_link_stm32 : shows how to exchange data through SPI with the stm32

make AICRAFT=BOOZ2_A7 overo_test_telemetry.upload

will compile and copy the demo program to the gumstix ( using scp ) . You need to configure the variable HOST in the airframe file for the hostname of your overo, and you might want to have ssh keys to avoid typing your password ( man ssh-copy-id )

Compiler optimizations to add to Makefile.omap

VFP

The following requests that the compiler generate vfp code (should speed up floats and doubles).

CFLAGS += -O$(OPT) -march=armv7-a -mtune=cortex-a8 -mfpu=vfp -mfloat-abi=softfp

You can confirm that it's working by looking at the assembly (hint: use -save-temps) and looking for the instructions.

fldd    d26, [r2, #0]
faddd   d19, d19, d16
faddd   d17, d18, d17

On a beth control algorithm using floats, a very qualitative test using top showed CPU util drop from ~10% to ~5%.

NEON

The following asks the compiler to use neon. neon is 32 bit so no doubles. neon is wicked fast but I haven't had success in using it yet on lisa

CFLAGS = -save-temps -O$(OPT) -march=armv7-a -mtune=cortex-a8 -mfloat-abi=softfp -mfpu=neon -ftree-vectorize -fomit-frame-pointer -ffast-math

Misc Notes

Running booz on stm32: see http://paparazzi.enac.fr/wiki/Lisa_Asctec_Bringup

testing spi link between overo and stm32:

  make AIRCRAFT=BETH clean_ac stm_test_spi_link.upload
  make AIRCRAFT=BETH clean_ac overo_test_spi_link.upload

Pending TODO

Here are listed known Software and Hardware TODO topics. If there is no person listed working on them or they are not striked through just grab one of them if you want to help. Also when a person is listed and you are interested in the particular topic just contact them on the Mailinglist and coordinate your efforts.

Software TODO

  • upload schematics and bloc diagram
  • make stm32 able to interrupt overo ( spi link ) to implement data_ready functionality, possibly use that as source o timing for overo program
  • add a checksum to the spi link between overo and stm32 (Tobi is working on it)
  • make asctec v2 code able to send settings ( address, direction ) to controllers
  • move sign of IMU calibration coef to a the board/hardware header
  • write ppm decoder for the stm32
  • improve spektrum protocol decoder to automatically handle the different models and modes of transmitters

Hardware TODO

  • add termination on adg3308 ( Saccade-Horizontal Overshoot 1 Overshoot 2 ) - maybe not, our PCB tracks are short enough not to need them
  • add missing bypass capacitors to: STM32 (4.7uF), PCA levelshifters (100nF), CAN Transceiver (100nF)
  • change i2c pullups to 1k Ohm : I think the pullups on each side of the PCA don't need to be the same - please someone read the datasheet and tell me what they understand - 1k is really small :(
  • Add breakout pads for another SPI interface to Overo : I don't undetsand this one - overo SPI can have a second slave on a connector on the top - I don't think gumstix exposed a second SPI on the 70pinc connector, but I may be wrong - MCBSP3 does the job (esden)
  • Brekout Overo memory bus for optional peripherals : memory bus!!! what kind of connectors . where do we find the space ? - I agree that is a crazy idea, dropping it (esden)
  • Change molex connectors for Overo USB host and Overo USB on the go to mini or micro usb connectors : i disagree with this one , usb connector don't have locking mechanisms, theu are meant to be plug and unplugged, which is exactly what we don't want on an autopilot - I agree and thus dropping this todo (esden)
  • Expose another UART to allow use of two Specktrum satellite receivers. This can most easily be achieved by exchanging PB2 and PD2. PB2 is IMU_DRDY at the moment and PD2 is on the "spare connector". UART5_RX can me mapped to PB2. - done (esden)
  • Remove 3v3 supply for the i2c level shifters as those can not translate with a unity gain
  • Add jumper resistors as alternative to the i2c level shifters to make 3v3 i2c available
  • Fix orientation of the 1uF polar capacitor used in the analogue supply of the stm32
  • Clean up the silkscreen so that we have two separate sets: one for the assembler featuring part designators and one printed as silkscreen for the user featuring pinout documentation and population options (tPlace and bPlace are for silkscreen - tNames, tDocu, bNames and bDocu are for the assembler)
  • Add either resistors or a buffer chip to the servo outputs, it was observed that the stm32 gpio's used for servos burnt through when connected directly to servos. - Current solution: resistors (Esden)
  • Update the BOM and crosscheck for changes made between revision 1 and 2 of the board

spektrum example

Written in basic this code implements an RC receiver that uses two Spektrum satellite receivers. The code implements binding and selection of the receiver with the strongest signal.

http://www.mcselec.com/index.php?option=com_docman&task=doc_download&gid=225&Itemid=54

STM32 I2C Issues discussion

If a data bit is lost during an I2C transfer then it is possible for the I2C slave counter to stop and wait for a bit that never comes. The slave keeps SDA low and SCL up. Thus the bus is seen to be busy. A possible solution to this is to bit bang SCL until the slave is happy and the bus becomes available again.

https://my.st.com/public/STe2ecommunities/mcu/Lists/ARM%20CortexM3%20STM32/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fARM%20CortexM3%20STM32%2fi2c%20busy%20flag&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000626BE2B829C32145B9EB5739142DC17E&currentviews=645