1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00
Commit Graph

113 Commits

Author SHA1 Message Date
peabody124
c2bdf624e8 OP-269 PIOS/ADC: Previous ADC driver update changed the PCLK2 divider for all
projects which messed up a timer on OP and serial on PipX.  Now this is only
changed for AHRS.  Ideally wouldn't even change for that but then ADC runs too
fast and we get a lot more CRC errors for dealing with all that data.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2459 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-16 23:00:48 +00:00
peabody124
0259b6d1f1 OP-269 PIOS/ADC: First part of conversion to driver structures
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2444 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-16 02:45:39 +00:00
peabody124
81b0c3fdb6 OP-269 PiOS/ADC: Moved AHRS ADC code to PiOS and made all the projects use it
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2440 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-16 02:45:22 +00:00
peabody124
c59a1ff018 OP-265 OP-266: FreeRTOS configuration per project because of available heap
size (may eventually need to be per revision if we get bigger ram).  Typo in a
the ifdefs to get allow disabling SDCARD

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2423 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-14 01:38:42 +00:00
cwabbott
0f965df11e SiTL: Updates for UAVObjects, and for the recent Actuator and Watchdog changes to compile with SiTL. Posix needs to be tested.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2387 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-12 00:39:18 +00:00
peabody124
b173d74821 OP-237 I2C ESC support. This _will_ require you to reconfigure your
ActuatorSettings although for PWM aircrafts it should be done exactly as before

Actuator: Store the update times and maximum update time

OP-14 I2C: Start tracking short history of events and states in driver for
logging
OP-237 Flight/Actuator: Support for I2C based ESCs

OP-237 MK_ESC: Send all four motors as one atomic transfer

OP-237 Flight/Actuator: Allow channels to be mapped to MK I2C interface.  Currently
mixer channels are either PWM or MK but in the future this will change to
support more than 8 channels.

OP-16 PiOS/I2C: Further work to try and make I2C more stable, mstly special case
handline in IRQ

OP-237 I2C ESC: Support for Astect 4 channel ESCs

OP-237: When the I2C Actuator write update fails track this

OP-237 Actuator Settings: Change the way motor types are selected to keep that
information more appropriately within ActuatorSettings instead of MixerSettings

Also make motors stay at or above neutral when armed and throttle > 0

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2366 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-10 01:11:44 +00:00
peabody124
ed11e64bb2 OP-251 Watchdog: Get rid of the old extra watchdog module and instead have
tasks directly update a flag for each module (which they register) and when all
flags set clear the watchdog then.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2365 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-10 00:16:30 +00:00
peabody124
e393000c34 OP-238 PIOS/SPI: Decrease pin clock rate from 50 to 10 Mhz. Since data at
1.125 MHz this should slow down the slew rates

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2361 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-09 20:49:46 +00:00
peabody124
85b7619617 OP-176 OP-238 Flight/IRQ and DMA: Increased the priority of the AHRS DMA
transfer, seems to reduce CRC errors

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2356 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-09 20:49:29 +00:00
peabody124
0f07d7f671 OP-240 OP-176 Flight: Setting the priority group back to 4 (anything higher
priority preempts) and adjusting the priorities around to be more sensible.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2355 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-09 20:49:26 +00:00
vassilis
407e660c97 Flight/TaskMonitor: Create TaskMonitor library, used to monitor the remaining task size of all running tasks.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2349 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-08 23:43:34 +00:00
peabody124
0e7661539e OP-238 AHRS Comms: Bring down clock rate of comms to AHRS to 2.25 MHz. Decrease
to only transmitting one object per transmission too to keep size down.
Also move to using the driver structure so the paramter is in a clear place.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2333 ebee16cc-31ac-478f-84a7-5cbb03baadba
2011-01-05 10:34:42 +00:00
andrew
2f38fe2269 Updated Alarms.c Modified flight alarm code to NOT set SystemAlarms to an "Uninitialised" value on startup.
This allows the UAVObjectGenerator generated code to set the default values.


git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2301 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-12-28 04:19:41 +00:00
andrew
e7e0f6740b Modified flight alarm code to set SystemAlarms to an "Uninitialised" value on startup.
This means that any defined alarms that don't have their flight module compiled in will show uninitialised rather than OK

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2295 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-12-27 07:30:36 +00:00
edouard
d8edab8371 Added a (fake) pios_servo module in PiOS.posix, this makes it possible to compile the Actuator module and see servo output values, or at least
what they would be on a real board. Also fixed a typo in stabilization.c which made me lose time when trying to understand the code...




git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2260 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-12-20 16:38:17 +00:00
kokomojoe
6499da40e3 OP-185 Flight Added init function for PIOS_IAP helper functions.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1892 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-10-06 02:07:11 +00:00
zedamota
e8d6e7c557 Flight - Centralized board specific files, BL and User FW uses the same board definitions, no need to have 2.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1663 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-16 19:19:38 +00:00
pip
73c8194acc Added PIOS_COM_TELEM_BAUDRATE, PIOS_COM_GPS_BAUDRATE, PIOS_COM_AUX_BAUDRATE & PIOS_COM_SPEKTRUM_BAUDRATE defines in pios_board.h with '#if defines' in pios_board.c for easier baudrate changing.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1644 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-15 17:18:38 +00:00
stac
ac6989fbeb bmp085: fix configuration of EOC interrupt
The EOC EXTI interrupt configuration was incorrectly
pointing at GPIOG pin 8 rather than GPIOC pin 15.
This was preventing the EOC interrupt from working
properly.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1626 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-15 14:20:59 +00:00
stac
95595664c3 telemetry: fix comments around #ifdef
No functional changes.

The closing comment on some of the USB_HID related
ifdefs was outdated.  Fixed.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1541 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-09-05 23:10:34 +00:00
peabody124
a084d21804 Merge branch 'watchdog'
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1281 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-13 05:18:17 +00:00
stac
f74c6ffdd5 i2c: rewrite i2c layer
The STM32 I2C block has a number of errata associated with it.
These errata are primarily related to timing sensitivities between
the peripheral and the interrupt handler.  In particular, the
correct generation of the stop bit relies on the I2C IRQ running
immediately and not being held off for any reason.

NOTE: The I2C interrupts must be the highest priority IRQs in the
      system to ensure correct operation.

I2C protocol is now implemented as a formal state machine.
See: stm32_i2c_fsm.{dot,jpg} for FSM description.

I2C init is now expressed by const initializers in pios_board.c
for both OP and AHRS boards.

I2C device drivers (ie. bmp085/hmc5843) now pass in const arrays
of an unlimited number of bus transfers to be done atomically.
The I2C adapter driver now handles all bus-level locking across the
list of transactions.  Generation of start/restart/stop conditions
are handled automatically over the list of transactions.

Timeouts have been removed from the API for now.  May be added
back later.

This driver has run error free on both the OP and AHRS boards for
up to 48hrs but it still sometimes fails earlier than that on the OP
board.  There is another possible set of improvements to the driver
that could employ the DMA engine for transfers of >= 2bytes.  This
change would reduce the timing sensitivities between the peripheral
and the driver but unfortunately, both the SPI and I2C interfaces
share the DMA1 engine.  That means only one of these two peripherals
can use the DMA engine and right now, SPI between OP and AHRS is
already using it.

Failures are currently fatal and will lock up the CPU.  This allows
useful information to be obtained in the failure cases.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1241 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-08 04:15:08 +00:00
sambas
7f6336d324 OP-22 Flight/PiOS: Spektrum reworked, input is mapped to old aux in receiver connector, works nicely with calibration plugin. Also bind works, just needs config flag to bind on powerup
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1189 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-08-01 10:34:07 +00:00
corvus
c8486d08e4 Fixed some bugs in OpenPilot Core.
- syntax error in pios_board_posix.c introduced with Doxygen comment blocks
- platform dependant code had been added to openpilot.c instead of pios_board.c
- redundant header inclusion (stm32... already included by PiOS)


git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1171 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-28 14:34:48 +00:00
dankers
32e6d53b23 Small comment issue that was causing build to fail
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1170 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-28 11:28:18 +00:00
edouard
9145a4b1a6 Doxygen work: created "OpenPilot System" group for system libraries and core files. Changed a typo on the Osd Doxygen. Let me know if you're OK with this approach.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1169 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-28 07:28:21 +00:00
peabody124
7d7802593e Oops, sorry missed these files
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1160 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-27 08:08:50 +00:00
corvus
fa57e42efa Deleted OpenPilot.posix branch. Integrated portability modifications into main tree
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1086 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-13 16:23:41 +00:00
vassilis
9f2a01a78a Flight/Servo Fix Servo driver buffer overflow, was messing up the I2C and altitude readings, now working fine. Servo index used to be 1-8 but the Servo driver was indexing a buffer out of bounds. Changed everything to use index 0-7 for servo outputs.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1061 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-11 01:54:43 +00:00
stac
a3a2dbd634 spi: Add support for hardware CRC generation/checking
PIOS SPI devices may now make use of automatic CRC generation
and checking on block transfers.  Only supports CRC8 for now.

Since the SPI interface CRC calculation continues across message
boundaries (ie. not reset on every transfer), we must manually reset
the CRC registers for every transfer to allow the two sides of the
link to resynchronize.

Unfortunately, resetting the CRC registers requires disabling the
SPI peripheral which must now be done on every block transfer.

Note: The last byte of the tx buffer is never sent and is assumed to
      be a place holder for the tx CRC8.
Note: The last byte of the rx buffer is expected to hold the rx CRC8.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1011 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-04 02:21:42 +00:00
stac
0e6294ca27 spi: remove internal pull-up from input data lines
The input data lines between the OP and AHRS boards had internal
pull-ups enabled.  This seemed to be causing issues early on
during development of the inter-board comms.  Not sure if this
is still necessary but this is how the current code was tested.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1006 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-04 02:21:26 +00:00
stac
3eceef43d3 spi: Connect device specific DMA IRQ handlers
Mark the device specific DMA IRQ handlers as strongly linked
aliases for the genericly named interrupt vector symbol.

Here's how this works...
 * The address of the symbol DMA1_Channel2_IRQHandler is written
   into the DMA1/Channel2 interrupt vector by the linker script.
 * The startup_*.S file specifies Default_Handler() as a weakly
   linked alias for DMA1_Channel2_IRQHandler.
 * We now override the weakly linked alias with the strongly linked
   PIOS_SPI_sdcard_irq_handler().
 * This results in the address of PIOS_SPI_sdcard_irq_handler() being
   written to the vector table for the DMA1/Channel2 interrupt.
 * The PIOS_SPI_sdcard_irq_handler() function is now called whenever
   the DMA1/Channel2 interrupt fires.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1003 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-04 02:21:13 +00:00
dankers
e47f755c30 Minini removed from OpenPilot
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@965 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-07-01 08:57:06 +00:00
FredericG
3bc938d45e lowered I2C timoout whne using RTOS
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@842 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-21 09:19:02 +00:00
FredericG
fba5164634 Enable AUX UART with ENABLE_AUX_UART in Makefile
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@838 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-20 18:01:21 +00:00
FredericG
e5c795e42b Remapped UART_AUX from PA9/10 (RX inputs) to PB6/7 (Servo output)
Rationale: (http://forums.openpilot.org/topic/800-rev-761-mkserial-adapt-to-com-usartx-pios-com-x/page__view__findpost__p__2203_)
  

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@836 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-20 17:48:59 +00:00
FredericG
eac1d8a06b No need to include telemetry.h in openpilot.c
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@835 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-20 17:43:00 +00:00
fredericg
4e15413fc9 MkSerial, adapt to COM_USARTX => PIOS_COM_X
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@761 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-13 11:18:42 +00:00
stac
771a56ca9d com/usart: generalize com driver API
- Created a pluggable COM layer
- Converted COM + USART init into static initializers
  rather than typedefs
- Generalized the USB HID COM API to match the USART
  API.
- Changed USART and COM layers to be data driven rather
  than #ifdef'ing/switching on the specifics of each port

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@760 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-13 04:24:26 +00:00
stac
8d015a57d0 pios spi: support both master and slave configs
Added support for SPI slave configurations to the pios SPI layer.

Converted the board specific configuration for the PIOS SPI layer to
use const static initializers rather than #defines (see pios_board.c).

SPI interface between the OP board and the AHRS is now operational at
a basic level, capable of moving simple single byte messages between
boards.  Multi-byte, CRC protected messages will be added on top of this.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@759 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-13 04:23:44 +00:00
fredericg
2e6e2537f5 Fix: including of Example Module did not work any more
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@724 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-07 11:12:58 +00:00
FredericG
8a7eba0675 List of modules in Makefile - Automatic init of included modules
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@716 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-06-05 15:17:31 +00:00
stac
d678720855 i2c: i2c errors no longer mapped to event channel
Both EVents and ERrors were mistakenly being mapped to the
EVent IRQ channel.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@659 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-24 16:33:49 +00:00
stac
874239154a Turn on -Werror on openpilot firmware build
This commit fixes all existing warnings.

All basic compiler warnings will now be treated as errors.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@658 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-24 16:33:46 +00:00
stac
6b2760da1a USB HID: basic COM functionality over USB HID
This fixes the COM interface over USB HID to the point where
it can establish and maintain solid communications with the UAVObject
Browser in the GCS.

Tested only on Linux.  The USB HID interface is still disabled for now
until it is tested successfully by a wider group.

Edit telemetry.c and set ALLOW_HID_TELEMETRY to 1 to enable telemetry
over the USB HID interface and report your results in the forum.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@656 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-24 16:33:40 +00:00
stac
69de42db49 Add AHRS attitude module and driver skeletons
- New Attitude module for AHRS (skeleton)
 - New AttitudeSettings UAVobject
 - New AttitudeActual UAVobject
 - Regenerated UAVobjects
 - Added new UAVobjects to OpenPilot and GCS builds
 - New PiOS driver for OpenPilot AHRS (stubs only)

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@655 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-24 16:33:36 +00:00
stac
cc6348934f bmp085: Add missing include for altitude module
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@653 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-24 16:33:29 +00:00
stac
d02a3325d9 altitude: Add altitude module which reads BMP085
This module reads from the BMP085 pressure sensor.  It periodically
updates the pressure (kPa) and temperature (C) as well as the
calculated altitude (m).

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@640 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-19 04:55:56 +00:00
sambas
0e81831399 OP-25 Flight/GPS: port speed corrected for OPGPS
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@638 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-18 11:42:57 +00:00
stac
514d46f5b6 freertos: fix RTOS API calls from interrupt level
FreeRTOS has a strict requirement that even interrupt-safe API calls (ie.
those ending in "FromISR") can only be called from ISRs that are at lesser
or equal priorities to configMAX_SYSCALL_INTERRUPT_PRIORITY.  See the
"configKERNEL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY"
section at:
  http://www.freertos.org/a00110.html

The interrupt numbers used on the Cortex-M3 CPU has a somewhat backward
representation of the interrupt numbers so 255 = lowest priority and
0 = highest priority.

The calculation is further complicated by the STM32 implementation only using
the upper 4 bits of the priority value.  Only 0x00, 0x10, 0x20, ..., 0xE0, 0xF0
represent useful interrupt priorities.

FreeRTOS requires that MAX_SYSCALL and KERNEL interrupt priorities are expressed
as raw unshifted 8-bit values to be programmed directly into the BASEPRI register.

The priority values passed to the NVIC initialization, however, are expected
to be 4-bit values and are shifted up by 4 within NVIC_Init() for you.

The end result is that we need this arrangement:

[highest priority]
   NVIC_0 (Non-maskable-interrupt)
   NVIC_1
   NVIC_2
[Must NOT call FreeRTOS APIs above here]
   configMAX_SYSCALL_INTERRUPT_PRIORITY (now at 48 = 0x30 = NVIC_3)
   PIOS_IRQ_PRIO_HIGHEST (cur. NVIC_4)
   PIOS_IRQ_PRIO_HIGH    (cur. NVIC_5)
   PIOS_IRQ_PRIO_MID     (cur. NVIC_8)
   PIOS_IRQ_PRIO_LOW     (cur. NVIC_12)
   configKERNEL_INTERRUPT_PRIORITY (240 = 0xF0 = NVIC_15)
[lowest priority]

The previous config had configMAX_SYSCALL_INTERRUPT_PRIORITY set at
191 (0xBF) which is effectively NVIC_11.  This was allowing all of
the MID, HIGH and HIGHEST interrupt handlers to preempt the OS in
its critical sections.  Since some of these ISRs were calling
FreeRTOS APIs, this would result in corrupting internal data structures
within the OS.

It should be ok to move the configKERNEL_INTERRUPT_PRIORITY to a higher
priority as long as it is less than configMAX_SYSCALL_INTERRUPT_PRIORITY.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@637 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-05-18 04:50:38 +00:00