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

2428 Commits

Author SHA1 Message Date
James Cotton
1971ba30dc No longer hardcode baudrate 2012-01-24 23:42:43 -06:00
James Cotton
5ad37e691c USB: Update the USB configuration structure to include the GPIO that is used
for sensing and then load different config for CC and CC3D.  Updated the
bootloader as well.  Also changed the PIOS_USB_CheckAvailability function to
only return the sense signal and not the transfer_possible flag as this is not
set in time for the bootloader on CC3D for some reason.
2012-01-24 22:15:43 -06:00
James Cotton
bc3703ce33 Need more irq stack for CC3D 2012-01-24 19:48:52 -06:00
James Cotton
104c091590 Correct the range constants for the L3GD20 driver 2012-01-24 19:48:14 -06:00
James Cotton
a25d52785b Change the bus speed for the L3GD20 to 10MHz and some small cleanups 2012-01-24 19:17:49 -06:00
James Cotton
3880b0ddc3 CC3D and CC use different CS lines for the flash chip. Add a second cfg
structure for each SPI interface.
2012-01-24 16:21:48 -06:00
James Cotton
587ec5a615 Revert earlier patch on filesystem for Revolution. Need to make erase command
and positioning of filesystem dependent on board type.

Reverted 99123372d0
2012-01-24 16:14:41 -06:00
James Cotton
b6c056fef2 Use the updated L3GD20 format and make attitude.c use the gyro data from the
fifo
2012-01-24 15:52:17 -06:00
James Cotton
c9263cb8c0 L3GD20: Dynamically allocate buffer structure when used 2012-01-24 15:51:38 -06:00
James Cotton
5efbfb02fa Make the BMA180 sensor system acquire from the queue. Correct the orientation
and speed it up to 10 MHz communications.
2012-01-24 15:09:20 -06:00
James Cotton
8c208412c9 Give the BMA180 a dynamically allocated device structure and also make it
properly bind to a SPI and slave number.  Temporarily reducing spi bus to
slowest possible speed.
2012-01-24 14:38:00 -06:00
James Cotton
aec7dd0b00 Initialize the LEDs early in the bootup process 2012-01-24 14:37:04 -06:00
James Cotton
8e79bc2ee2 Temporarily refactor attitude to directly read the sensors instead of pull from
their queues until the interrupts are working properly
2012-01-24 11:54:23 -06:00
James Cotton
e9552065a9 Reenable the CC3D sensors 2012-01-24 11:03:33 -06:00
James Cotton
466992a907 Migrate some of the CC board settings to the new board_hw_defs 2012-01-24 10:58:40 -06:00
James Cotton
c242ab8b86 Merge branch 'next' into revolution3
Conflicts:
	flight/AHRS/ahrs.c
	flight/AHRS/pios_board.c
	flight/Bootloaders/Revolution/Makefile
	flight/CopterControl/System/pios_board.c
	flight/INS/pios_board.c
	flight/OpenPilot/Makefile
	flight/OpenPilot/System/openpilot.c
	flight/OpenPilot/System/pios_board.c
	flight/PiOS/Boards/STM32103CB_CC_Rev1.h
	flight/PiOS/Boards/STM32F4xx_Revolution.h
	flight/Revolution/Makefile
	flight/Revolution/System/inc/pios_config.h
	flight/Revolution/test.c
2012-01-24 10:46:35 -06:00
James Cotton
f029567e66 Remove meaningless settings from CC config file 2012-01-24 10:39:35 -06:00
James Cotton
66293a9788 Merge remote-tracking branch 'origin/stac/led-boottime-config' into next 2012-01-24 10:38:33 -06:00
James Cotton
7c22215e0b Patch from Sambas to fix F4 on windows 2012-01-24 10:33:07 -06:00
James Cotton
486cdb5dbb Got CC running again although with altitude and bmp085 disabled as well as the
CC3D drivers.
2012-01-24 10:32:42 -06:00
James Cotton
be50c00b7c Make sure BMA180/L3GD20 can be disabled 2012-01-24 09:23:13 -06:00
James Cotton
4d3af7afbf Add ID test to ADXL345 2012-01-24 09:23:12 -06:00
James Cotton
946c6a7f1d Fix small bugs in pios_board.c relating to adxl345 spi configuration 2012-01-24 09:23:12 -06:00
James Cotton
728c05f973 Crude implementation of sensor reading for CC3D 2012-01-24 09:23:12 -06:00
James Cotton
0cb6b13d33 Add BMA180 to CopterControl 3D. Had to reduce the stack space by 256 bytes.
Some can be reclaimed by making the BMA180 allocate its fifo dynamically but
I'll do that later when it uses FreeRTOS queues for the FIFO.
2012-01-24 09:23:12 -06:00
James Cotton
11471ff68b Update drivers for CC to the new EXTI system and SPI calls 2012-01-24 09:23:12 -06:00
James Cotton
a20d654744 Update the attitude algorithm for CC to use the Gyros and Accels UAVObjects
instead of AttitudeRaw
2012-01-24 09:23:12 -06:00
James Cotton
4cf82815ce Get the right pios_iap.c from next 2012-01-24 09:23:07 -06:00
James Cotton
aaf1c5dfdd Update the F1 SPI library to support multiple NSS lines 2012-01-23 23:27:02 -06:00
James Cotton
5fd458426a Merge branch 'cc3d' into revolution3
Conflicts:
	flight/PiOS/inc/pios_l3gd20.h
	flight/PiOS/pios.h
	flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj
2012-01-23 22:09:45 -06:00
Stacey Sheldon
5907022b6d Merge remote-tracking branch 'origin/stac/ld-2.22-fix' into next 2012-01-23 23:05:52 -05:00
James Cotton
bcb49cbd33 Merge branch 'next' into cc3d
Conflicts:
	flight/PiOS/STM32F10x/pios_exti.c
2012-01-23 17:09:47 -06:00
James Cotton
2524662475 Copy the BMP085 back from next 2012-01-23 16:58:07 -06:00
James Cotton
b01d5c6b87 Include the drivers from the common directory 2012-01-23 16:58:07 -06:00
James Cotton
886d5456ac Update pios_exti for F4 2012-01-23 16:55:54 -06:00
James Cotton
9a12299074 Update the driver cfg structures for the EXTI changes. Make the drivers call
the pios_exti_init instead of their individual implementations.
2012-01-23 16:55:52 -06:00
James Cotton
b2a292e9c4 Move all the drivers to the PiOS/Common directory to prepare for refactoring
the EXTI calls they make to the portable version
2012-01-23 10:11:46 -06:00
James Cotton
c84240e485 Merge branch 'next' into revolution3
Conflicts:
	flight/PiOS/STM32F10x/pios_bmp085.c
	flight/PiOS/STM32F10x/pios_exti.c
2012-01-23 06:51:30 -06:00
James Cotton
21ae37b3de Remove BMP085 driver from F4 target 2012-01-23 06:44:25 -06:00
James Cotton
d864b481a1 Fix a few more merge conflicts 2012-01-23 04:47:35 -06:00
Stacey Sheldon
bfe6676eed exti: rewrite exti layer to improve portability
The exti layer now allows drivers to register interrupt callbacks
during board initialization.  All details of the driver using a
particular EXTI pin have been removed from the EXTI layer so it
can now be used on any board without board-specific modification.

This includes some nice refinements provided by Mike Smith during
initial review.  His original commits have been squashed into this
one.
2012-01-22 23:23:41 -05:00
Stacey Sheldon
dc4aa07a32 board_hw_defs: factor out board-specific hw config definitions
Board specific HW configuration is now collected in a single .c
file for each board.  This HW configuration is #include'd into
the FW, BL and BU builds for each board.

These new .c files are found in:
  flight/board_hw_defs/<board_name>/board_hw_defs.c

Parts of this information were previously duplicated between
the BL and FW builds.  This commit cleans up the duplication.

Using a #include on a .c file is a bit ugly but it allows us
to ensure that all of the symbols in the board_hw_defs.c file
are *ONLY* used in the PIOS_Board_Init() function for each
software build.
2012-01-22 19:41:41 -05:00
Stacey Sheldon
6bb4f0c61d leds: use boot-time config for PiOS LED layer
LEDs are now configured based on a board-specific initialization
in PIOS_BOARD_Init().

LEDs are now named:
  PIOS_LED_HEARTBEAT
  PIOS_LED_ALARM
2012-01-22 18:22:59 -05:00
Stacey Sheldon
3cbf4499e1 ld: make sure current pointer never goes backwards
Fixes linking on ld version 2.22.
2012-01-21 21:18:06 -05:00
James Cotton
cc0cbf0381 Enable IAP code on revolution now 2012-01-21 13:22:39 -06:00
James Cotton
fe44a3d37a Reference correct taskmonitor file compiled in to revolution 2012-01-21 13:22:17 -06:00
James Cotton
e505de7ba0 Remove redundant remap field from merge 2012-01-21 13:22:00 -06:00
James Cotton
838370b3a4 Fix calls to backup registers on F4 2012-01-21 13:21:37 -06:00
James Cotton
bb0bfe0ae4 Merge branch 'next' into revolution3
Conflicts:
	flight/Bootloaders/CopterControl/Makefile
	flight/Bootloaders/PipXtreme/Makefile
	flight/Bootloaders/Revolution/inc/pios_config.h
	flight/CopterControl/Makefile
	flight/INS/inc/pios_config.h
	flight/Libraries/taskmonitor.c
	flight/Modules/Altitude/altitude.c
	flight/Modules/Attitude/attitude.c
	flight/OpenPilot/Makefile
	flight/OpenPilot/Makefile.posix
	flight/OpenPilot/System/inc/pios_usb_board_data.h
	flight/OpenPilot/System/inc/taskmonitor.h
	flight/OpenPilot/System/pios_board.c
	flight/OpenPilot/System/taskmonitor.c
	flight/PiOS/Boards/STM32F4xx_Revolution.h
	flight/PiOS/STM32F4xx/pios_bmp085.c
	flight/PiOS/STM32F4xx/pios_iap.c
	flight/PiOS/pios.h
	flight/Revolution/System/inc/pios_config.h
	flight/Revolution/System/inc/taskmonitor.h
	flight/Revolution/System/taskmonitor.c
	ground/openpilotgcs/src/plugins/serialconnection/serialplugin.cpp
	shared/uavobjectdefinition/systemalarms.xml
	shared/uavobjectdefinition/taskinfo.xml
2012-01-21 11:27:03 -06:00
James Cotton
f8e59443b8 If the BMA180 isn't read when an IRQ fires (because the flash chip has claimed
the bus) then it won't fire another interrupt until read.  For now this is
dealt with in the sensor loop by forcing a read when the fifo is empty.
2012-01-21 10:13:46 -06:00
James Cotton
f6db859e4f Fix bug in flash driver where it could assert CS line after failing to claim
the bus.  Also added a "claimed" flag to the device structure.
2012-01-21 09:57:12 -06:00
James Cotton
5dbbfec8a9 Make the BMA180 driver use the appropriate claim method from the ISR. Also
slow down this bus to 10 MHz.
2012-01-21 09:57:02 -06:00
James Cotton
ff0bd87f4e PIOS SPI: Add a second claim bus method for use in ISR. This has no timeout
and uses an ISR safe queue claiming method.  This avoids deadlocks when ISR
blocks other tasks from freeing the bus.
2012-01-21 09:07:06 -06:00
James Cotton
ec903449cd Remove line that bypassed the BMA180 startup test 2012-01-21 08:46:32 -06:00
James Cotton
6d72678086 Add timeout in the sensor task for reading sensors to stop the watchdog firing.
All sensors should later be converted to use FreeRTOS queues.
2012-01-21 08:32:41 -06:00
James Cotton
476cb4d9c2 Unfortunately for now hardcoding new LED configuration. Need to generalize LED
out to a proper run-time configuration.  This unfortunately breaks a general
firmware for now.
2012-01-20 15:45:51 -06:00
James Cotton
8935614a3f Switch the gyro driver loaded based on the board revision flag from the
bootloader
2012-01-20 14:52:05 -06:00
James Cotton
a252ee134a Fix the l3gd20 initialization in pios_board.c and also change the (ugly)
hardcoded exti system to use line3 on F1xx for L3GD20
2012-01-20 14:39:05 -06:00
James Cotton
c76e9f2d7a Updates to the l3gd20 driver for stm32f1xx. Need to eventually merge these
drivers with F4 drivers.
2012-01-20 14:36:16 -06:00
James Cotton
4f28c8d48e Change the init structures to be const in the std periph library for exti 2012-01-20 14:35:27 -06:00
James Cotton
a5d006d1a9 Set up the SPI interface to the l3gd20 2012-01-20 14:20:37 -06:00
James Cotton
8f535bd28c Import of l3gd20 driver from revo branch 2012-01-20 13:42:58 -06:00
James Cotton
7f284596f2 Attempting to get flash and BMA180 to coexist 2012-01-20 13:33:21 -06:00
James Cotton
1e8811362e On revolution attach the flash chip to the accel bus now. Also extended the
flash chip driver to take in the slave number during initialization so this is
no longer a hardcoded option.
2012-01-20 07:37:47 -06:00
Stacey Sheldon
64202ce092 Merge remote-tracking branch 'origin/stac/i2c_decoupling' into next 2012-01-17 22:35:36 -05:00
Stacey Sheldon
ad141c908a Merge remote-tracking branch 'origin/stac/usb-composite-device-v2' into next 2012-01-17 22:26:38 -05:00
James Cotton
1b5e776dc5 Hardcoded scale for now since it isn't picking up from the cfg structure. 2012-01-17 19:53:20 -06:00
James Cotton
ce2d0fcbb1 L3GD20 data now running through IRQ -> FIFO 2012-01-17 19:36:32 -06:00
James Cotton
35025303cd Getting data from gyro. 2012-01-17 19:29:38 -06:00
Stacey Sheldon
bffb184b7a usb: add standard boilerplate to new files 2012-01-16 21:32:52 -05:00
Stacey Sheldon
ee0895aa77 usb hid: remove stale files from pipx
These files are no longer relevent for USB configuration.
2012-01-16 21:31:07 -05:00
Stacey Sheldon
3bda0f450d bootfault: force fault when no telemetry available on OP too
If no telemetry link is configured, this will force the board
to reset before finishing init.  The BootFault logic will
catch this after 3 resets and will boot with default hwsettings
on the next reset.

This won't currently ever fire on OP though since we always
configure the serial telemetry interface.  This just makes sure
the pattern is present in case anyone decides to compile without
serial telemetry.
2012-01-15 23:04:31 -05:00
Stacey Sheldon
8cd4816d7b taskmonitor: move taskmonitor into flight/Libraries
taskmonitor.[ch] existed as (nearly) identical copies under
CC and OP directories.  Both builds now reference the common
version under Libraries.
2012-01-15 21:37:10 -05:00
Stacey Sheldon
387ea77d30 diagnostics: enable DIAG_TASKS on OP board by default 2012-01-15 18:16:50 -05:00
Stacey Sheldon
b05697c2cf taskinfo: ensure usage of TaskInfo uavo is covered by DIAG_TASKS
OpenPilot platform (and thus sim too) was missed when the
DIAG_TASKS macro was broken out from the DIAGNOSTICS macro.

This allowed accesses to the TaskInfo UAVO even though it hadn't
been initialized.
2012-01-15 18:16:50 -05:00
Stacey Sheldon
0575b45378 usb: make USB usage depend on PiOS config
USB is not supported on sim platforms.  Let PiOS
config determine when we use it.
2012-01-15 18:16:49 -05:00
Stacey Sheldon
c97b108a1f bootfault: make IAP usage depend on PiOS config
The sim platforms don't support an IAP mechanism.  Let
PiOS config control when we try to use it.
2012-01-15 18:16:49 -05:00
Stacey Sheldon
27ceb7ea92 modules: Allow optional modules to be used as built-in
Some modules are written such that they can be included
or excluded at runtime.  These are added to the OPTMODULES
list in the makefile for a given board.

This change provides a mechanism to allow a build to force
a given module to be built-in (ie. always initialized)
regardless of the configuration in hwsettings.

The main use case for this is to handle a module being optional
on one platform but essential on another.

All modules added to the MODULES list in the Makefile will
automatically result in a matching #define in the form
  MODULE_TheModuleName_BUILTIN
being defined in the CFLAGS for all compiled source.

Note that the capitalization of TheModuleName must match
exactly the capitalization used in the MODULES list.
2012-01-14 16:55:55 -05:00
Stacey Sheldon
53e9ef06b4 altitude: add optional altitude module 2012-01-14 15:38:56 -05:00
Stacey Sheldon
717c1311e6 altitude: allow altitude to be an optional module 2012-01-14 15:38:56 -05:00
Stacey Sheldon
bae08fcad0 bmp085: decouple i2c adapter
Let the bmp085 be attached to different adapters for different
boards.
2012-01-14 15:38:56 -05:00
Stacey Sheldon
4cb0c41338 bmp085: only use eoc and drdy gpios when available
When the bmp085 chip is on an external board, we don't
have access to the eoc and drdy gpio lines.  Only use
them when available.
2012-01-14 15:38:56 -05:00
Stacey Sheldon
a0089f072a i2c: rename main adapter to flexi adapter on CC 2012-01-14 15:38:56 -05:00
Stacey Sheldon
feacec468d i2c: compile-time decoupling of i2c devices from adapters
This allows each device to be moved (at compile time) to a
different adapter.  This is the first step to allowing devices
to be attached to different i2c adapters.
2012-01-14 15:38:56 -05:00
Stacey Sheldon
ec6d550225 i2c: allow i2c adapters to remap pin functions
Allows us to support more complex pin configurations
for i2c.
2012-01-14 15:38:55 -05:00
Stacey Sheldon
a51bf72bc7 usb: allow runtime selection of USB descriptors via hwsettings 2012-01-14 14:28:15 -05:00
Stacey Sheldon
1d14ab00e1 safeboot: add safe boot support to OP and PIPX bootloaders
Application support for OP and PIPX will show up in future
commits.
2012-01-14 14:28:11 -05:00
Stacey Sheldon
2d27c54d48 com_msg: Create new message based COM layer for bootloaders
The main purpose of this new COM implementation is that it is
much simpler, and requires less code space.  This takes a bit
of the pressure off of the CC bootloader which was right at
the limit of available code space in the bootloader partition.

This is not intended to ever be used by the application.

This driver also formalizes the assumptions in the bootloader's
usage of the COM layer.  All messages are assumed to arrive
in atomic chunks from the HID layer.
2012-01-14 14:23:18 -05:00
James Cotton
147cd7eede Fix correct library.mk file 2012-01-08 09:27:32 +01:00
James Cotton
8b42fbeafc Revert "Fix case in library.mk to stop Brian bitching :)"
This reverts commit d39e818ca6.
2012-01-08 09:27:13 +01:00
James Cotton
d39e818ca6 Fix case in library.mk to stop Brian bitching :) 2012-01-08 09:10:56 +01:00
James Cotton
ebbe1bd497 Some beginning work on the l3gd20 driver 2012-01-08 09:07:07 +01:00
Stacey Sheldon
b0d1551cc2 Merge remote-tracking branch 'origin/stac/usb-composite-device-v2' into next 2012-01-07 13:35:42 -05:00
Stacey Sheldon
a86abcd140 usb cdc: fix index of first interface in IAD
This error resulted in the HID interface being non
functional on windows platforms.
2012-01-07 09:46:12 -05:00
James Cotton
cc47520baa Checking ID on ST gyro works 2012-01-04 23:23:42 -06:00
James Cotton
0fbcf7723d Code to disable all gyros. All modules now running. 2012-01-04 22:37:15 -06:00
James Cotton
5ee9c8008e Temporarily swap serial ports while debugging 2012-01-04 22:19:13 -06:00
James Cotton
0cc18e7dcf Add files for new L3DG20 sensor 2012-01-04 20:33:54 -06:00
James Cotton
e1c21462b0 Delete another unused file 2012-01-04 19:47:06 -06:00
James Cotton
d5eb38a065 Remove references to deprecated targets 2012-01-04 19:42:45 -06:00
James Cotton
cce351bb9a Delete references to unused objects 2012-01-04 19:37:38 -06:00
James Cotton
0da6109871 Update the F4 copyright headers to 2012 2012-01-04 19:29:29 -06:00
Stacey Sheldon
3bc45b0036 usb cdc: use proper macro for CDC mgmt endpoint packet size
The hard-coded value (16) in the descriptor differed from the
macro (32) which was used to configure the low-level USB HW
block in the STM32.
2012-01-04 00:38:19 -05:00
James Cotton
d2ce7761c5 Add derivative term 2012-01-03 12:37:18 -06:00
Stacey Sheldon
025ed0f43c Merge remote-tracking branch 'origin/stac/usb-composite-device-v2' into next
Conflicts:
	HISTORY.txt
2012-01-03 00:02:45 -05:00
Stacey Sheldon
e22bc0c51b copyright: remove incorrect attribution in boilerplate text
These files do not contain content from the ID in the header.
This name seems to have been cut/pasted all over throughout
the openpilot source tree and should be removed from any files
that should not rightfully be attributed to this person.
2012-01-02 23:33:07 -05:00
Stacey Sheldon
8d8715c8c1 copyright: add/correct GPL + copyright boilerplate
I missed some of the boilerplate text on some of the
new files I've added recently.  Fixed.
2012-01-02 23:28:53 -05:00
Stacey Sheldon
4d2760f11d cc bl: allow bootloader to force safe-boot into firmware
This can be used by the GCS firmware uploader widget to boot
the firmware with a (temporarily) defaulted hwsettings uavo
so that a user can easily recover from a bad/incompatible
hwsettings configuration without wiping all settings.

This uses the same mechanism that the BootFault auto-recovery
code already uses in the CC firmware.  The auto-recovery is
triggered by setting the failed-boot counter to a maximum
value forcing recovery on the next FW init.
2012-01-02 14:27:06 -05:00
Stacey Sheldon
481a13609e com: remove all references to PIOS_COM_ReceiveBufferUsed()
The PIOS_COM_ReceiveBufferUsed() function call is no longer
necessary since the same semantics can be achieved using calls
to PIOS_COM_ReceiveBuffer().
2012-01-02 14:27:06 -05:00
Stacey Sheldon
b94f4b49a4 usb: major refactoring of USB descriptors, CDC and HID
Summary of changes:
 * USB CDC and HID drivers are completely split apart.
   * This will allow different max buffer sizes for HID and CDC.
 * USB descriptors have been overhauled:
   * Proper structs/macros/enums declared for USB (see pios_usb_defs.h)
   * Two common descriptor definitions.  One for HID+CDC another for HID only.
     See pios_usb_desc_{hid_cdc,hid_only}.c for details.
   * Long standing bugs in OP USB descriptors became much more obvious with the
     new struct definitions.
   * Board specific USB initialization is now in pios_usb_board_data.h in each build target.
   * Definition of USB descriptors is now entirely indpendent of STM32 libs.
     Glue into STM32 libs is provided by pios_usbhook.c.
 * Removed a lot of stale/irrelevant USB #defines throughout the tree.
 * Improved naming consistency throughout USB code:
   * PIOS_USB_HID_* now refers to the HID endpoint code.
   * PIOS_USB_CDC_* now refers to the CDC endpoint code.
   * PIOS_USB_* now refers to the low-level USB code.
   * PIOS_USB_BOARD_* now refers to board-specific USB data
   * PIOS_USBHOOK_* is glue between PIOS and STM32 USB libs.
   * struct usb_* and enum usb_* and USB_* and HID_* are all types from the USB spec.
 * Shrunk the buffer size on the CDC call mgmt endpoint to save some RAM.
 * Made a few more USB related variables static to save some RAM.
2012-01-02 14:27:06 -05:00
Stacey Sheldon
7f03195aba stm32 usb: allow descriptor data to be const through API
This allows a few more data structures to be const to save
some RAM.
2012-01-02 14:27:06 -05:00
Oleg Semyonov
77a459af5c Merge remote branch 'origin/next' into os/TxPID-module 2012-01-02 14:49:54 +02:00
Oleg Semyonov
b01e332e03 CameraStab: rename UAVO field 2012-01-02 14:27:05 +02:00
Oleg Semyonov
65abb8f819 CameraStab: small optimization, freed 8 more heap bytes 2012-01-02 14:27:00 +02:00
Oleg Semyonov
406cff296d CameraStab: bypass LPF calculation if ResponseTime is zero 2012-01-02 14:26:58 +02:00
Oleg Semyonov
e11904c42f CameraStab: change ResponseTime type from float to int16 2012-01-02 14:26:56 +02:00
Oleg Semyonov
2eb5130a7c CameraStab: new camera stabilization mode and low-pass stick input filtering
This patch is based on work of Crubier (LPF) and Cossacs (AxisLock mode).
I've just reworked it a bit by adding a dynamic memory allocation for
static module data.
2012-01-02 14:26:54 +02:00
James Cotton
ef05cafaca Merge branch 'revolution' into altitudehold
Conflicts:
	flight/Libraries/insgps13state.c
	flight/OpenPilot/Makefile
	ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro
2012-01-01 10:50:35 -06:00
Stacey Sheldon
075eb65603 bootfault: fail initialization if no telemetry link is configured
This detects a locked out state and fails the init.  The new
bootfault detection code will automatically drop to default
hwsettings after 3 consecutive boot failures.  That will put
the board back into an unlocked state where the user can now
enable a telemetry link using the GCS and everything will be
OK.

NOTE: Any configured telemetry link will be considered enough
      to boot up.  If you only configure a serial telemetry
      link but don't know how to hook anything up to it, this
      will not save you.

As the ultimate recovery, you can always load firmware on the
board that wipes the settings entirely and start over.
2011-12-31 13:08:30 -05:00
Stacey Sheldon
6c192f67ee gasp: delete clutter 2011-12-31 13:03:49 -05:00
Stacey Sheldon
e7053c77f0 usb config: remove unused macro for number of endpoints
This is no longer referenced and is confusing.
2011-12-31 13:02:43 -05:00
Stacey Sheldon
5c0921e92c fault: add optional fault insertion module
This module and its associated settings uavo can be used
to test various fault conditions during initialization.

To enable the module, add the TEST_FAULTS=YES to your make
command line:
  make fw_coptercontrol TEST_FAULTS=YES

Once this module is part of your firmware load, you can
enable it in the hwsettings uavo and then select the
type of fault to insert by editing the faultsettings uavo.
On the next reset, the configured fault will be inserted
into the init sequence to allow you to test the boot fault
recovery code.

With a fault inserted, you should see 3 failed boot attempts
followed by a successful (recovery) boot.  You will see the
BootFault alarm set to Critical, and the RAM version of your
hwsettings will be reset to defaults.  Since the defaults have
all optional modules disabled, the fault module will be out of
the way during the recovery boot.

You can then "Load" the flash version of the hwsettings uavo
in the object browser, disable the Fault module and then "Save"
the hwsettings module back to the board.  The next reset will
boot normally without the fault inserted.
2011-12-30 23:05:39 -05:00
Stacey Sheldon
f4f0dab764 fixup make combridge an optional module 2011-12-30 23:05:39 -05:00
Stacey Sheldon
f886af186d bootfault: add support for recovery from init failures
After 3 failed warm start attempts, the init sequence
will force the RAM version of the HWSettings object
to its defaults.  This should allow a user to regain
connectivity to a board that is continually faulting
during init.

This is accomplished by:
 - Incrementing a boot counter that is stored in the
   STM32 BKP registers.  These registers survive a
   warm start but are cleared on a cold start (ie. powerup).
 - On multiple failures, force hwsettings to defaults
   and raise the (new) BootFault alarm to prevent arming.
 - Resetting the boot counter whenever the system manages
   to successfully run the System Module task.

NOTE: This does not actually change the hwsettings object in
      flash.  That's up to the user.

This is intended to catch ONLY faults during early initialization.
It should not be used to recover from faults after the application
is up and running.
2011-12-30 23:05:38 -05:00
Stacey Sheldon
b91f40eb94 iap: extend API to support read/write of boot counter
Also clean up unused/obsolete definitions.
2011-12-30 23:05:38 -05:00
Stacey Sheldon
1543a6dbd3 hwsettings: allow disabling of USB telemetry entirely
The GCS hwsettings config widget now disallows any
configuration that disables both HID and VCP telemetry
over the USB port.

The firmware will allow it if the UAVObj is set manually.

This allows a mechanism to reduce RAM usage by another
500 more bytes if USB telemetry can be sacrificed in
certain configurations.
2011-12-30 23:05:38 -05:00
Stacey Sheldon
45615b5812 com: reduce buffer sizes on com interfaces on CC
Now that the COM layer fragments to the underlying
buffer sizes, the COM layer buffers can shrink below
single message sizes.
2011-12-30 23:05:38 -05:00
Stacey Sheldon
2cf1fe93c6 com: don't block forever waiting for a transmitter
Not all transmitters will continue to run when disconnected.
USB is one example of this.  When the USB cable was disconnected,
any transmitter blocked here would wait forever.

This was particularly noticeable when the telemetry Tx task
blocked forever on USB disconnect.  This also resulted in
the telemetry Rx task blocking forever waiting on the UAVTalk
connection lock.

We now block for a max of 5s waiting for space in the transmit
buffer.
2011-12-30 23:05:37 -05:00
Stacey Sheldon
7c03875013 diag-tasks: make taskinfo diagnostics a separate enable
This allows task stack analysis without turning on all
of the other diagnostics.
2011-12-30 23:05:37 -05:00
Stacey Sheldon
56c4ff8f40 com-bridge: add support for bridging to flexiport 2011-12-30 23:05:37 -05:00
Stacey Sheldon
60969b57d8 usb-hid: split apart hwsettings for HID and VCP ports
This allows the HID and VCP functions to be configured
separately so that additional functions can be more easily
bound to the VCP port.

This change also provides a safety net that forces either
the HID or VCP to be configured for USB Telemetry.  This
safety net may vanish in the future once the GCS can check
it.  Disabling USB Telemetry entirely would save more than
400 bytes of RAM.
2011-12-30 23:05:37 -05:00
Stacey Sheldon
ab135aa00b com-bridge: Make com-bridge an optional (and configurable) module 2011-12-30 23:05:36 -05:00
Stacey Sheldon
5b3227d1ff com: reduce buffer sizes for com layer
This saves a few hundred bytes of RAM in a typical
configuration.
2011-12-30 23:05:36 -05:00
Stacey Sheldon
785a7ccd88 uavtalk: convert tx to use blocking send routines
The uavtalk layer was previously implementing a poor
version of packet fragmentation based on a hard-coded
max packet size.  Since this was hard-coded, there was
no guarantee that it would match the underlying devices.

Now that the COM layer sending routines support fragmentation,
remove fragmentation and use the COM layer directly.

This will support future buffer size reductions in the COM
layer.
2011-12-30 23:05:36 -05:00
Stacey Sheldon
16619584e4 usb cdc: return valid data in response to SetLineCoding 2011-12-30 23:05:36 -05:00
Stacey Sheldon
a68f5a4fc9 com-bridge: detect lost characters on transmit 2011-12-30 23:05:36 -05:00
Stacey Sheldon
80e0be3cec com: fragment transmitted buffers to match underlying device
PIOS_COM_SendBufferNonBlocking() will now fragment its buffer
to match the max size of the underlying device.

This allows the buffer size of the underlying device to shrink
below the maximum message size, thus allowing us to use smaller
buffers on memory-constrained platforms.
2011-12-30 23:05:36 -05:00
Stacey Sheldon
407bec0c95 usb cdc: track oversized rx buffers 2011-12-30 23:05:35 -05:00
Stacey Sheldon
b858cf387e com: track dropped bytes on rx for usart and usb com 2011-12-30 23:05:35 -05:00
Stacey Sheldon
2040645171 com: Use all bytes in Tx buffer
Code would previously fail Tx if we happen to send data
that happened to be exactly the size of the available space
in the tx buffer.
2011-12-30 23:05:35 -05:00
Stacey Sheldon
34af9ac92d usb_com: NAK rather than STALL on buffer full
STALL should only be used to indicate an error has occurred.
NAK is the correct mechanism to provide backpressure.
2011-12-30 23:05:35 -05:00
Stacey Sheldon
e2bb7140fe usb cdc: allow use of entire rx buffer
Previously, the code only allowed n-1 bytes of the
available space to be used.
2011-12-30 23:05:35 -05:00
Stacey Sheldon
86aead52ce usb cdc: only pass valid bytes from USB rx up to com layer
Previously, up to 63 random bytes would be passed to the COM
layer and would be delivered to the application as though
the far end had sent them.
2011-12-30 23:05:35 -05:00
Stacey Sheldon
f54c0552ce com: make sure we know when a higher prio task is woken 2011-12-30 23:05:34 -05:00
Stacey Sheldon
202b1bd428 com: Always kick rx_start if we got zero bytes
This will ensure that we kick rx_start at least once every
time that a user tries to receive bytes from the underlying
device.
2011-12-30 23:05:34 -05:00
Stacey Sheldon
64f498e48a com-bridge: add usart to usb vcp bridge 2011-12-30 23:05:34 -05:00
Stacey Sheldon
504cf3417f init: collapse usart definitions for generic usage
Telemetry and GPS usarts are generic users of the uart
devices.  This collapses the duplicated usart configuration
structs into a single generic one.
2011-12-30 23:05:34 -05:00
Stacey Sheldon
eebdda6276 usb cdc: make HID/CDC configurable in hwsettings 2011-12-30 23:05:34 -05:00
Stacey Sheldon
e6ead85857 usb cdc: fix device descriptor to work on Mac
Apple is very particular about requiring the bDeviceClass
to be set to 2 (Commmunication Device) even for composite
devices which seems wrong.

Device is enumerated without error on Mac now.  Not sure if it
works though.
2011-12-30 23:05:34 -05:00
Stacey Sheldon
617a30c07c usb cdc: attach telemetry to CDC rather than HID 2011-12-30 23:05:34 -05:00
Stacey Sheldon
59cb489e01 usb: clean up pios hooks into stm32 usb_core
Reduced scope of many variables since they were being
exposed unnecessarily.

Renamed pios_usb_hid_prop code to pios_usbhook to reflect
the fact that it implements all of the callout functions
that are hooked into the stm32 usb library.
2011-12-30 23:05:33 -05:00
Stacey Sheldon
c0259dc616 usb cdc: USB composite device with HID + VCP 2011-12-30 23:05:33 -05:00
James Cotton
25dfb5463e Add option to switch to using the MPU6000 accel instead of BMA180. Disabled by
default.
2011-12-29 02:08:13 -06:00
James Cotton
c080080810 Add ability to change the SPI bus runs at 2011-12-29 00:09:53 -06:00
James Cotton
bf98630851 Add streaming the sensor data out of the serial port 2011-12-26 17:52:45 -06:00
James Cotton
9bf06bbd3e Force the loading of the sensor gains and biases at the beginning 2011-12-24 16:14:28 -06:00
James Cotton
1092ac3184 Use the scale and bias terms for hte mag and accel 2011-12-24 15:58:12 -06:00
James Cotton
05da41a79b Get FirmwareIAP object working on revo 2011-12-24 13:15:56 -06:00
James Cotton
569b201b58 Move the bl_helper out of the common directory as it isn't 2011-12-24 13:10:23 -06:00
James Cotton
5d4da2213f Accidentally used floating point when parsing NEMA. Lost resolution on
position.
2011-12-24 10:37:30 -06:00
Oleg Semyonov
7fbbb0e6af Merge remote branch 'origin/next' into os/TxPID-module 2011-12-24 15:44:16 +02:00
Oleg Semyonov
495a8f2836 TxPID: initialize the AccessoryDesired object before use its handle
Also save few bytes of static RAM and add PIOS_Assert(0) for unhandled cases.
2011-12-24 15:37:14 +02:00
James Cotton
0b00e748a9 OP-565: Added the ability to do a trim flight to compute the accels for level flight 2011-12-21 15:25:00 -06:00
James Cotton
dd89d232ba Add a magnetometer bias term although currently hardcoded to my board 2011-12-15 00:57:19 -06:00
James Cotton
0432dd450e Enable the mag to be used in the complimentary filter to stabilize the yaw
direction
2011-12-15 00:56:50 -06:00
James Cotton
2240ad924a Fix the orientation of the magnetometer 2011-12-15 00:46:43 -06:00
James Cotton
43ed6cd89c Need to initialize the HomeLocation object 2011-12-14 14:08:03 -06:00
James Cotton
9148bb2c65 Make sure the sensors module grabs the sesor biases initially. 2011-12-14 10:38:43 -06:00
James Cotton
6dbad243db Convert the CoordinateConversion functions to all be float until I determine
how to use doubles safely on F4.
2011-12-14 02:08:14 -06:00
James Cotton
09864a8cf6 Get outdoor EKF running although need to add in the ability to swap modes
(probably).
2011-12-14 02:07:33 -06:00
James Cotton
fd8899018f Get EKF running 2011-12-14 01:54:06 -06:00
James Cotton
ed7cbd5a6c Have to initialize the BaroAltitude object ini the init section for it to show
up on telemetry
2011-12-13 23:27:26 -06:00
James Cotton
9f50391fc5 Merge branch 'next' into revolution_sensors
Conflicts:
	ground/openpilotgcs/src/plugins/coreplugin/OpenPilotGCS.xml
2011-12-13 20:50:10 -06:00
James Cotton
a37a17a4fb Created a separate Sensor module and Attitude module for revolution 2011-12-12 21:40:39 -06:00
James Cotton
53cb5b67d1 Make the revo attitude now use the separate gyro object. CopterControl
attitude still needs an update.
2011-12-12 13:28:35 -06:00
James Cotton
d22e0e66dd Create separate UAVOs for the sensors. 2011-12-12 13:05:40 -06:00
James Cotton
7273f87f9b Fix NMEA parsing for M4 FPU 2011-12-12 09:47:11 -06:00
James Cotton
a9c61845af Create a separate task for sensors and attitude on revo. 2011-12-12 00:47:16 -06:00
James Cotton
33a12d829e Merge branch 'next' into revolution
Conflicts:
	flight/PiOS/Common/pios_flashfs_objlist.c
2011-12-11 22:55:54 -06:00
Oleg Semyonov
10287e3e29 CC: rename ReceiverPort PPM+Servo (Servo) options to PPM+Outputs (Outputs) 2011-12-11 22:52:51 +02:00
James Cotton
162b0d7f75 Because the UAVO field sorting required for revo changes all the object IDs,
trigger a flash wipe on all existing boards with this upgrade.
2011-12-10 14:13:28 -06:00
Corvus Corax
a0cd71abe6 UAVObjects ; Modules/ManualControl: Fixed metadata interface and segfault when retrieving it 2011-11-30 09:20:46 +01:00
James Cotton
44ca9736df Fix floating point calculation in NMEA parser and delete duplicate of NMEA
functions
2011-11-28 09:36:31 -06:00
James Cotton
43fa9e702e Move DSM to Flexiport and enable GPS on GPS port. Currently GPS module locks
up though.
2011-11-28 09:11:13 -06:00
James Cotton
c33816dd79 Force mode switch to be floating point so F4 works 2011-11-28 09:10:26 -06:00
James Cotton
671c7537a0 Reorganize the pios_config.c file for revolution 2011-11-28 08:29:14 -06:00
James Cotton
1af66fc3d2 Get rid of 500 ms delay in startup for the pios_sys so that servos start
properly but a delay is still needs to get MPU6000 up right.  Fucking POS.
2011-11-27 18:05:20 -06:00
James Cotton
9357960268 Get rid of old bootloader code for revolution using the ahrs spi link 2011-11-27 18:04:31 -06:00
James Cotton
f7f94011ee Damnit. For higher bus speeds MPU6000 chip must be initialized twice in a row.
WTF piece of shit.
2011-11-27 02:35:08 -06:00
James Cotton
deea7cde41 Speed up coms to MPU6000 2011-11-27 01:51:43 -06:00
James Cotton
57e7126979 Increase stack size for manualcontrol. This might need to be applied to main
code.
2011-11-27 01:51:23 -06:00
James Cotton
f7d13ebd57 Hack to tweak the gyro gain for now although its too far out at the moment so
something isn't configured properly.  Possibly it is staying in 250 deg/s mode.
Also make sure if the MPU6000 fifo backs up to pull extra data.
2011-11-27 01:22:37 -06:00
James Cotton
8bbc767a4e Get the pressure sensor working and reading into Revolution 2011-11-27 00:52:09 -06:00
James Cotton
cd65df013e Merge branch 'next' into revolution
Conflicts:
	flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj
2011-11-26 22:52:32 -06:00
James Cotton
13729f854e PiOS F4: Fix PWM timer interrupts and enable PWM input 2011-11-26 22:41:41 -06:00
James Cotton
21367d3a22 Spektrum support for Revolution 2011-11-26 22:19:42 -06:00
James Cotton
e24c905ff7 F4 PiOS: Reimplement the RTC logic for F4 2011-11-26 22:13:57 -06:00
James Cotton
b11a4f7405 Clean up the actuator module for floating point usage. Also there was a bug I
don't understand where the channels should be scaled AFTER all of them are
computed.  It feels like a memory overwriting bug and needs followup.
2011-11-26 16:12:32 -06:00
James Cotton
07e3ad10af Force some floating point units to be safe 2011-11-26 15:52:25 -06:00
James Cotton
04f4afce46 Set idle load for revo 2011-11-26 15:52:04 -06:00