FRDM-Copter is an attempt to build firmware for mbed based multicopter running on FRDM boards from Freescale.
Dependencies: FXAS21000 FXOS8700Q PID mbed-dsp mbed-rtos mbed
FRDM-Copter
Hardware
So far the following boards are used:
In addition I am planning on using:
- FRDM-CR20A 2.4Ghz module for communication with Frsky Taranis X9D+
Implementation
I decided to use mbed platform as it allows easy CMSIS-DAP debugging and firmware can be easily ported to other mbed enabled devices in future.
Phase 1
Sensor fusion will be implemented and estimated orientation plotted over blue-tooth in the Android application.
Phase 2
PID controller will be used to maintain orientation and control the motors using PWM channels, tuning will be possible in the Android application.
Phase 3
Controll will be implemented with CR20A 2.4Ghz module for use with Frsky Taranis.
Phase 4
All schematics will be transferred to KiCad on a single board.
Revision 2:05aaa453fbac, committed 2015-07-08
- Comitter:
- Mashu
- Date:
- Wed Jul 08 14:35:47 2015 +0000
- Parent:
- 1:b55a0bb3a4f4
- Commit message:
- Removed not working BLE_API
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b55a0bb3a4f4 -r 05aaa453fbac main.cpp --- a/main.cpp Wed Jul 08 13:38:12 2015 +0000 +++ b/main.cpp Wed Jul 08 14:35:47 2015 +0000 @@ -4,10 +4,6 @@ #include "FXAS21000.h" #include "FXOS8700Q.h" -#include <BLE.h> -#include <BLEInstanceBase.h> -#include "UARTService.h" - Serial pc(USBTX, USBRX); I2C i2c(PTE25, PTE24); I2C i2c_gyro(A4, A5); @@ -15,19 +11,7 @@ FXOS8700QAccelerometer acc(i2c, FXOS8700CQ_SLAVE_ADDR1); // Configured for the FRDM-K64F with onboard sensors FXOS8700QMagnetometer mag(i2c, FXOS8700CQ_SLAVE_ADDR1); FXAS21000Gyroscpe gyro(i2c_gyro, FXAS21000_SLAVE_ADDR); - -BLEDevice ble; -UARTService *uart; -void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason) -{ - ble.startAdvertising(); -} - -void periodicCallback(void) -{ -} - int main(void) { motion_data_units_t acc_data, mag_data, gyro_data; @@ -38,26 +22,7 @@ //printf("FXOS8700QAccelerometer Who Am I= %X\r\n", acc.whoAmI()); //printf("FXOS8700QMagnetometer Who Am I= %X\r\n", acc.whoAmI()); //printf("FXAS21000Gyroscope Who am I= %X\r\n", gyro.whoAmI()); - - Ticker ticker; - ticker.attach(periodicCallback, 1); - - ble.init(); - ble.onDisconnection(disconnectionCallback); - - uart = new UARTService(ble); - - /* setup advertising */ - ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED); - ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); - ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME, - (const uint8_t *)"BLE UART", sizeof("BLE UART") - 1); - ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS, - (const uint8_t *)UARTServiceUUID_reversed, sizeof(UARTServiceUUID_reversed)); - - ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */ - ble.startAdvertising(); - + while (true) { // unit based results acc.getAxis(acc_data); @@ -69,6 +34,6 @@ */ printf("%1.4f,%1.4f,%1.4f\r\n", gyro_data.x, gyro_data.y, gyro_data.z); - ble.waitForEvent(); + wait(0.5f); } } \ No newline at end of file