AP_HAL_FLYMAPLE: FlymaplePortingNotes.txt improvements to install/build

documentation.
This commit is contained in:
Mike McCauley 2013-10-04 07:46:28 +10:00 committed by Andrew Tridgell
parent 7f9d4a155f
commit 11317dcec4

View File

@ -8,7 +8,7 @@ Flymaple has an ARM based Cortex-3 STM32F103RE, 72MHz processor with 10DOF built
Implementation
Unlike the Arduino versions of ArduPlane, the Flymaple port uses portions of
Unlike the Arduino versions of ardupilot, the Flymaple port uses portions of
the libmaple library, including the stm32f1 core and some other libaries like
Wire, HardwareTimer, HArdwareSPI etc.
@ -42,10 +42,8 @@ get complaints from gcc 4.4.1 caused by collisions with other class names.
New board makefile mk/board/flymaple.mk, plus some other minor changes in
mk/*.mk
In other parts of the ArduPlane tree, the changes have been #ifdefed for
Flymaple except:
- ArduPlane/compat.pde
In other parts of the ardupilot tree, the changes have been #ifdefed for
Flymaple:
- libraries/AP_Compass/AP_Compass_HMC5843.cpp
- libraries/AP_Compass/Compass.h
@ -122,7 +120,163 @@ arm-none-eabi-g++ toolchain, version 4.4.1
on OpenSuSE 12.3
Mission Planner 1.2.78
You need a number of additional resources to build ArduPlane for Flymaple. I
You need a number of additional resources to build ArduPlaneardupilot tree, the changes have been #ifdefed for
Flymaple:
- libraries/AP_Compass/AP_Compass_HMC5843.cpp
- libraries/AP_Compass/Compass.h
- libraries/AP_Baro/AP_Baro_BMP085.cpp
Minor changes to raw data fetches to make them 32bit compatible. Should not
affect other platforms.
Some other minor edits to eliminate compiler warnings
These changes have now all been included in the ardupilot mainline code.
Resource usage
Resources on the Flymaple board have been allocated by the HAL:
Pins
0 AP GPS on Flymaple Serial2 Rx in. This is where you connect the
GPS. 3.3V only, NOT 5V tolerant
1 AP GPS on Flymaple Serial2 Tx out. This is where you connect the GPS.
3.3V
5 I2C SCL. Do not use for GPIO.
6 Receiver PPM in
7 Console and Mavlink on Flymaple Serial1 Rx in. Also on connector
"COM1". 5V tolerant.
8 Console and Mavlink on Flymaple Serial1 Tx out. Also on connector
"COM1". 3.3V
9 I2C SDA. Do not use for GPIO
15 3.3V board VCC analog in. Connect to 3.3V pin.
16 Airspeed analog in (if available). 3.3V, NOT 5V tolerant.
19 Battery current analog in (if available). 3.3V, NOT 5V tolerant.
20 Battery voltage analog in (on-board divider connected to board VIN)
29 Telemetry Tx to radio on Serial3 on connector labelled "GPS". 3.3V
30 Telemetry Rx from radio on Serial3 on connector labelled "GPS". 5V tolerant.
Timers
SysTick 1000Hz normal timers
1 CH1 RCInput
2 CH1 1000Hz Failsafe timer
3 CH1-4, 4 CH1-2 RCOut
8 not used by AP
The I2CDriver on Flymaple uses the libmaple i2c low level hardware I2C
library, configuredfor high speed (400kHz).
As at 2013-10-03, there is a bug in the libmaple git master code, that causes
a crash in the I2C interrupt handler. Therfore it is necessary to use the
patched version of libmaple referred to below.
At 400kHz I2C speed, it takes 500us to read both the 6 byte accelerometer
buffer and the the 6 byte gyro buffer.
The SerialUSB (USB connection) to Flymaple is not used by AP. It can be used for
debugging inside AP_HAL_FLYMAPLE, using SerialUSB.println().
Sensor configuration
The sensors are configured so:
ADXL345 Accelerometer
8g full scale, full resolution mode, 800Hz bandwidth, read at 1kHz sample rate
per sec
ITG3205 Gyro
2000 degrees/sec, 256Hz LPF, 8kHz internal sample rate, read at 1kHz sample rate
The gyro and accelerometers are sampled at about 800Hz in
AP_InertialSensor_Flymaple.cpp, with the samples passed through a software
2-pole low pass filter, to produce filtered data for the main loop.
Installation on Linux
Tested with:
libmaple patched library based on https://github.com/leaflabs/libmaple http://leaflabs.com/docs/unix-toolchain.html
arm-none-eabi-g++ toolchain, version 4.4.1
on OpenSuSE 12.3
Mission Planner 1.2.78
You need a number of additional resources to build ArduPlanardupilot tree, the changes have been #ifdefed for
Flymaple:
- libraries/AP_Compass/AP_Compass_HMC5843.cpp
- libraries/AP_Compass/Compass.h
- libraries/AP_Baro/AP_Baro_BMP085.cpp
Minor changes to raw data fetches to make them 32bit compatible. Should not
affect other platforms.
Some other minor edits to eliminate compiler warnings
These changes have now all been included in the ardupilot mainline code.
Resource usage
Resources on the Flymaple board have been allocated by the HAL:
Pins
0 AP GPS on Flymaple Serial2 Rx in. This is where you connect the
GPS. 3.3V only, NOT 5V tolerant
1 AP GPS on Flymaple Serial2 Tx out. This is where you connect the GPS.
3.3V
5 I2C SCL. Do not use for GPIO.
6 Receiver PPM in
7 Console and Mavlink on Flymaple Serial1 Rx in. Also on connector
"COM1". 5V tolerant.
8 Console and Mavlink on Flymaple Serial1 Tx out. Also on connector
"COM1". 3.3V
9 I2C SDA. Do not use for GPIO
15 3.3V board VCC analog in. Connect to 3.3V pin.
16 Airspeed analog in (if available). 3.3V, NOT 5V tolerant.
19 Battery current analog in (if available). 3.3V, NOT 5V tolerant.
20 Battery voltage analog in (on-board divider connected to board VIN)
29 Telemetry Tx to radio on Serial3 on connector labelled "GPS". 3.3V
30 Telemetry Rx from radio on Serial3 on connector labelled "GPS". 5V tolerant.
Timers
SysTick 1000Hz normal timers
1 CH1 RCInput
2 CH1 1000Hz Failsafe timer
3 CH1-4, 4 CH1-2 RCOut
8 not used by AP
The I2CDriver on Flymaple uses the libmaple i2c low level hardware I2C
library, configuredfor high speed (400kHz).
As at 2013-10-03, there is a bug in the libmaple git master code, that causes
a crash in the I2C interrupt handler. Therfore it is necessary to use the
patched version of libmaple referred to below.
At 400kHz I2C speed, it takes 500us to read both the 6 byte accelerometer
buffer and the the 6 byte gyro buffer.
The SerialUSB (USB connection) to Flymaple is not used by AP. It can be used for
debugging inside AP_HAL_FLYMAPLE, using SerialUSB.println().
Sensor configuration
The sensors are configured so:
ADXL345 Accelerometer
8g full scale, full resolution mode, 800Hz bandwidth, read at 1kHz sample rate
per sec
ITG3205 Gyro
2000 degrees/sec, 256Hz LPF, 8kHz internal sample rate, read at 1kHz sample rate
The gyro and accelerometers are sampled at about 800Hz in
AP_InertialSensor_Flymaple.cpp, with the samples passed through a software
2-pole low pass filter, to produce filtered data for the main loop.
Installation on Linux
Tested with:
libmaple patched library based on https://github.com/leaflabs/libmaple http://leaflabs.com/docs/unix-toolchain.html
arm-none-eabi-g++ toolchain, version 4.4.1
on OpenSuSE 12.3
Mission Planner 1.2.78
You need a number of additional resources to build ardupilot for Flymaple. I
have assumed that you will install them in your home directory, but they can really
go anywhere provided you make the appropriate changes to PATH and config.mk
@ -132,9 +286,18 @@ cd libmaple
wget http://static.leaflabs.com/pub/codesourcery/gcc-arm-none-eabi-latest-linux32.tar.gz
tar xvzf gcc-arm-none-eabi-latest-linux32.tar.gz
export PATH=$PATH:~/libmaple/arm/bin
cp main.cpp.example main.cpp
make
(at this stage you can test your flymaple CPU and the upload process with
'make install', which will upload a simple LED blinking program to your
Flymaple)
edit ArduPlane/config.mk to be something like:
Now download ardupilot:
cd ~
git clone https://github.com/diydrones/ardupilot.git
cd ardupilot
edit config.mk to be something like:
#config.mk START
# Select maple_RET6 for Flymaple
BOARD = maple_RET6
@ -148,6 +311,10 @@ LIBMAPLE_PATH = $(HOME)/libmaple
# export PATH=$PATH:~/libmaple/arm/bin
#config.mk END
cd ArduPlane
make flymaple
make upload
Interrupt disabling on ARM
On AVR, ISRs run by default with the global interrupt enable flag disabled,
@ -221,15 +388,7 @@ Pitching up Y +ve
Remaining issues:
1. For reasons I do not yet understand, the magnetic heading reported by
ArduPlance is 90 degrees away from what I think it should be.
The sensors on the Flymaple are all aligned with the nominal X, Y and Z axes
collinear. Pitch and roll axes point to the _corners_ of the board, not the
flat sides as might be considered normal for a sensor board.
Orientation is set to NONE, and yes, the reading of compass sensor registers
is in teh right order for the HMC5883.
2. Many alignment warnings emitted by the compiler from libraries/GCS_MAVLink
1. Many alignment warnings emitted by the compiler from libraries/GCS_MAVLink
protocol.h eg:
mnt/disk2/src/ArduPlane-2.74b/libraries/GCS_MAVLink/include/mavlink/v1.0/ardupilotmega/../protocol.h: In function 'uint16_t _MAV_RETURN_uint16_t(const mavlink_message_t*, uint8_t)':
/mnt/disk2/src/ArduPlane-2.74b/libraries/GCS_MAVLink/include/mavlink/v1.0/ardupilotmega/../protocol.h:267: warning: cast from 'const char*' to 'const uint16_t*' increases required alignment of target type
/mnt/disk2/src/ardupilot/libraries/GCS_MAVLink/include/mavlink/v1.0/ardupilotmega/../protocol.h: In function 'double _MAV_RETURN_double(const mavlink_message_t*, uint8_t)':
/mnt/disk2/src/ardupilot/libraries/GCS_MAVLink/include/mavlink/v1.0/ardupilotmega/../protocol.h:274: warning: cast from 'const char*' to 'const double*' increases required alignment of target type