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

824 Commits

Author SHA1 Message Date
James Cotton
1086df5b21 Correctly configure MPU6050 interrupt. However currently not pushing data to
the buffer as that seems to fail.
2011-11-14 11:11:40 -06:00
James Cotton
da679441ec Duplicate the spektrum (dsm) driver to F4 branch 2011-11-14 10:12:51 -06:00
James Cotton
684715930a Merge branch 'next' into revolution
Conflicts:
	flight/OpenPilot/Makefile
	flight/Revolution/System/inc/openpilot.h
2011-11-14 10:11:53 -06:00
James Cotton
180d84e373 Update the MPU6050 code a bit more to use the right registers. 2011-11-14 10:09:49 -06:00
James Cotton
2eb89e9b81 No reason for the data read flag in pios_bmp085.c to be a semaphore 2011-11-14 10:07:19 -06:00
James Cotton
96a098bf74 Add code for MPU6050 driver 2011-11-13 19:44:56 -06:00
James Cotton
1e2fe77e3f Start migrating the attitude solution to FreeRTOS 2011-11-13 18:51:35 -06:00
James Cotton
0c103f7b2c Delete F2 PiOS port since unused 2011-11-13 17:33:43 -06:00
James Cotton
fffb6449ac Delete the old INS target 2011-11-13 17:31:34 -06:00
James Cotton
c44235494c Update the Revolution board file a bit 2011-11-13 17:23:56 -06:00
James Cotton
938a577d11 Small change to pios_adc so it works when not enabled 2011-11-13 17:14:08 -06:00
James Cotton
ec84fc4058 Get the Revolution bootloader working 2011-11-13 17:13:42 -06:00
Corvus Corax
aa69027cb2 Merge branch 'next' into CC_GPS 2011-11-11 11:44:11 +01:00
Corvus Corax
e03e3c2ed8 removed "special code" to start optional modules 2011-11-11 11:22:54 +01:00
Oleg Semyonov
f5e82b8242 spektrum: rename Spektrum to DSM (DSM2/DSMJ/DSMX used by Spektrum and JR radios)
No code changes, just file, variable and define names are changed.

First, it better describes the serial protocol used by DSMx satellite
receivers. Second, many people using Spektrum radio, assume Spektrum
protocol. This is the attempt to address those inaccuracies.
2011-11-04 21:40:34 +02:00
James Cotton
c0f16d2f44 Revolution: Configure clocks correctly 2011-11-03 20:12:34 -05:00
James Cotton
a2015a4f8d Compiled and flashing 2011-11-02 13:20:39 -05:00
James Cotton
0ce80e02f5 Compiles now 2011-11-02 02:51:20 -05:00
James Cotton
0931a518d4 Bring F4 PiOS up to date with some of our timer conventions 2011-11-01 04:39:51 -05:00
James Cotton
48d2e038bb More work to the revolution build 2011-11-01 04:39:20 -05:00
James Cotton
4d6f810984 Make ADC driver play properly when not included 2011-11-01 03:22:48 -05:00
James Cotton
7eee6bf85b Create revolution board file 2011-11-01 03:22:19 -05:00
James Cotton
9607da9c62 Add some drivers to the device specific library for now until the exti problems
are fixed
2011-11-01 03:19:58 -05:00
James Cotton
2cc0b301ce Make some of the StdPeriph function calls const where appropriate 2011-11-01 03:18:59 -05:00
James Cotton
3388843fb5 Merge in PixHawk F4 work 2011-11-01 01:09:55 -05:00
Oleg Semyonov
0116e6a007 spektrum: rework DSM2/DSMJ/DSMX driver for explicit DSMX resolution support
- both CC serial ports are now disabled by default (no telemetry);
- serial ports now have DSM2, DSMX (10bit) and DSMX (11bit) options;
- ReceiverGroups now have DSM (MainPort) and DSM (FlexiPort) options.

For DSM2 protocol there is an explicit resolution bit in the stream, so
the DSM2 should be selected. For DSMX there is no such bit, and user
should choose the resolution from the list configuring the spektrum port.
ReceiverGroups have single DSM option which is handled by the same driver.

Downside: this implementation saves received frame first, unrolls by the
end of frame. This should be ok, but may be improved by unrolling channels
on the fly in the rx callback.

Another minor difference is that a ChannelGroup is now bound to port:
DSM (MainPort) or DSM (FlexiPort). This was considered as acceptable
solution in order to not have 6 DSM options for each ChannelGroup and
even more in case of new DSM protocol variations.

Known problem: it is not possible to choose same protocols like
DSM2/DSM2 for two ports. It can be enabled by adding an exception to
common rule, though.

The DSMX throttle channel misbehavior (zero value) is not treated
specially yet. It should trigger the failsafe being out of bounds.
More info and data dumps are required to handle this properly.
2011-10-30 19:29:03 +02:00
James Cotton
f019412209 Various tweaks to get the F4 working 2011-10-26 21:56:00 -05:00
James Cotton
d786c152e3 Merge F4 files from PixHawk branch 2011-10-26 18:23:35 -05:00
James Cotton
0f8ae1e076 Merge branch 'next' into ins
Conflicts:
	flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj
2011-10-26 13:18:44 -05:00
Oleg Semyonov
a19bbba858 Merge branch 'next' into os/alternative_spektrum_driver 2011-10-25 11:55:05 +03:00
Oleg Semyonov
f71361ca83 Merge branch 'next' into os/GPS-on-CopterControl_next_v2
Conflicts:
	flight/Modules/System/systemmod.c
2011-10-22 23:00:47 +03:00
Oleg Semyonov
58d0812309 sbus: better frame syncronization, some cosmetic changes
In the previous version the decoder could in rare cases get synced from
the middle of data stream in case of data byte equal to the S.Bus start
of frame (SOF) byte (wrong data will be rejected but it was not perfect).
Now it waits for the real start of frame and then checks the SOF byte.
2011-10-22 00:44:09 +03:00
Oleg Semyonov
62bca651d5 spektrum: alternative DSMx (DSM2/DSMJ/DSMX) driver
- does not glitch when used in 2-frame mode (DM9, 9503, etc)
- does NOT provides yet DSMX stream decoding - do NOT merge
- uses a bit more time in the interrupt, but frees 16 bytes of RAM.
  This is done to help decoding the weird DSMX stream which does not
  contain explicit resolution/frame/lost frames info and needs special
  processing (to be done yet).
2011-10-21 23:35:17 +03:00
Oleg Semyonov
92b81e3f88 sbus: refactor the code using unified PIOS RCVR driver structure
- allow more than one S.Bus receiver (needs hardware support)
- use dynamic memory allocation (frees around 72 bytes of RAM when unused)
2011-10-20 18:23:23 +03:00
James Cotton
5dc0f397a6 OP-499 Erase settings bug: Make hte flash chip read a wrong value for 1 second
before wiping settings.
2011-10-07 14:08:56 -05:00
Oleg Semyonov
ed8cf89888 Initcall: fix compilation errors for firmware which does not use Initcalls 2011-09-28 22:57:18 +03:00
Oleg Semyonov
53c098dd08 Merge branch 'next' into os/GPS-on-CopterControl_next_v2
Conflicts:
	flight/OpenPilot/System/pios_board.c
	flight/OpenPilot/UAVObjects.inc
	shared/uavobjectdefinition/hwsettings.xml
2011-09-28 22:02:02 +03:00
James Cotton
400ba3bd47 Merge branch 'next' into ins 2011-09-12 18:57:11 -05:00
James Cotton
6457276438 Merge branch 'input_configuration' into next 2011-09-11 18:52:35 -05:00
Oleg Semyonov
f5369f9338 Input Configuration: support all 18 S.Bus input channels 2011-09-12 02:06:50 +03:00
James Cotton
4847a04db8 Mainboard: Get PWM working again. Had to add extra timer IRQ handlers for
TIM5-8.  Also TIM1 was not handled probably (for CC either) as the name of the
IRQ is TIM1_CC and TIM1_UP for the capture compare versus update.  I haven't
checked the downstream code that the registers it uses to map from a context to
event is invariant under timer channel.
2011-09-10 14:20:40 -05:00
James Cotton
eb191d869a Mainboard: Get spektrum working again. 2011-09-10 14:19:54 -05:00
James Cotton
2871c75a79 Mainboard: Get PWM working again. Had to add extra timer IRQ handlers for
TIM5-8.  Also TIM1 was not handled probably (for CC either) as the name of the
IRQ is TIM1_CC and TIM1_UP for the capture compare versus update.  I haven't
checked the downstream code that the registers it uses to map from a context to
event is invariant under timer channel.
2011-09-10 13:53:38 -05:00
James Cotton
1d2a424296 Mainboard: Get spektrum working again. 2011-09-09 09:42:13 -05:00
James Cotton
3239fdf21b Merge branch 'next' into ins
Conflicts:
	flight/CopterControl/Makefile
	flight/OpenPilot/System/pios_board.c
	flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj
2011-09-09 08:33:34 -05:00
James Cotton
552022250b INS: Disable power up checks until these are made more reliable and remove some
debugging outputs.
2011-09-08 21:44:27 -05:00
James Cotton
0eb4fd113b PiOS BMA180: Increase the comms speed for BMA180 and perfom SPI without
callback.  This takes less time.
2011-09-08 03:28:32 -05:00
James Cotton
d7ea1fc306 PiOS I2C: Swap the expected return value of the F2 pios i2c calls 2011-09-08 01:32:27 -05:00
James Cotton
72625d9971 PiOS RCVR: Make the public API use a 1 based indexing for channel numbers.
This may or may not get into next, but if so anyone following it MUST
reconfigure their inputs.
2011-09-06 16:39:08 -05:00
James Cotton
8f7712435f Merge branch 'safer_failsafe' into next 2011-09-06 16:23:11 -05:00
James Cotton
627c931c79 PiOS I2C: Swap the convention of returned values for I2C 2011-09-06 03:27:20 -05:00
Sambas
a8ef57c6d6 Redo DX8 changes 2011-09-06 08:40:10 +03:00
James Cotton
82c5f9f0f4 PIOS_RCVR: Document return values better and use enum for them 2011-09-04 12:37:39 -05:00
James Cotton
533ae9bb41 SBUS: Missed handling the S.Bus failsafe. Now returns PIOS_RVCR_TIMEOUT for
either SBus failsafe mode or when no data for 100 ms.
2011-09-04 12:15:34 -05:00
James Cotton
89e640ae7f Make sure all receiver drivers return correct constants for invalid channels. 2011-09-04 01:24:16 -05:00
James Cotton
51967ae63f OP-571 PIOS_PWM: Add back the PWM supervisor 2011-09-04 01:17:40 -05:00
James Cotton
697dbf4f5f OP-568 PIOS_RCVR: Standardize the values that are returned from the PIOS_RCVR and make
them symbolic constants.
- A timeout is 0
- A missing driver is 65534
- An invalid channel is 65535

ManualControl: Make it deal with the values explicitly.  A timed out value
should not be treated like a minimum duration signal.  Instead it does not
updated the scaled value but marks the data window as invalid to trigger the
failsafe.
2011-09-03 23:50:56 -05:00
James Cotton
dae11cf877 INS Logging: Enable temperature reading from gyro and accel (may be removed in
future), push it into UAVO and introduced a logging mode for INS that outputs
all sensor data from aux port.
2011-09-03 15:10:47 -05:00
James Cotton
5eaebac8d8 INS: Get the aux uart working. All F2 GPIO pins need to be remapped to work. Good thing to remember. 2011-09-02 17:04:39 -05:00
James Cotton
c40e5800ab BMA180: Enable the EEPROM writing on startup so settings take the first time. 2011-09-02 13:28:36 -05:00
James Cotton
612d3336b4 This patch breaks backward compatibility with AHRS solidly.
Move the configuration files for INS from AHRS* to INS*.  Strip out unused
fields in settings and merge calibration and settings since settings has
basically no information.
2011-09-01 12:21:33 -05:00
Stacey Sheldon
43b31efb76 pios: allocate driver instance data from heap
Allocate per-instance data for drivers from the heap
rather than as static variables from the .data segment.

This converts > 800 bytes of RAM from being always consumed
as static data into being allocated from the heap only when
a particular feature is enabled in the hwsettings object.

A minimal config (no receivers, flexi port disabled, main port
disabled) leaves 2448 bytes of free heap.  That's our new baseline.

Approximate RAM (heap) costs of enabling various features:
 + 632 Serial Telemetry (includes 400 bytes of Rx/Tx buffers)
 + 108 PWM Rcvr
 + 152 PPM Rcvr
 + 112 Spektrum Rcvr
 + 24  S.Bus (Should be closer to 68 since driver is still using
              static memory)

There are still some drivers that pre-allocate all of their memory
as static data.  It'll take some work to convert those over to
dynamically allocating their instance data.
2011-08-31 22:35:03 -04:00
Stacey Sheldon
2f86e4dd4f Make PWM/PPM and Servo drivers play nicely together
PWM and PPM can now coexist in the same load and be
selected at boot time via the hwsettings UAVObject.

This is basically a complete restructuring of the
way the drivers interact with the TIM peripheral in
the STM32.

As a side effect, the PWM and PPM drivers are now
ready to support multiple instances of each.

This also provides the first step toward being able
to reassign some of the PWM input pins to be servo
output pins.  Still more work required, but this is
a good start.
2011-08-27 21:39:56 -04:00
Stacey Sheldon
b3c43da90a stdperiph: Make TIM related APIs use const pointers
This allows the configuration parameters to be stored in
flash instead of copied to RAM.
2011-08-27 21:39:17 -04:00
James Cotton
dc340596f5 Merge branch 'next' into GCS_ChangesToUI-RuntimeCFG
Conflicts:
	flight/CopterControl/Makefile
	flight/OpenPilot/System/pios_board.c
	flight/OpenPilot/UAVObjects.inc
	flight/PiOS/STM32F10x/pios_spektrum.c
	ground/openpilotgcs/src/plugins/config/config.pro
	ground/openpilotgcs/src/plugins/config/configgadget.qrc
	ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro
	shared/uavobjectdefinition/hwsettings.xml
2011-08-27 15:26:05 -05:00
Corvus Corax
4bd72923e5 Merge branch 'CorvusCorax_unidirectional-GPS-com' into CC_GPS
Conflicts:
	flight/Modules/GPS/GPS.c
	flight/Modules/GPS/GTOP_BIN.c
	flight/Modules/GPS/NMEA.c
	shared/uavobjectdefinition/hwsettings.xml
2011-08-25 15:33:23 +02:00
James Cotton
5f7a9b513a Merge branch 'sambas/dsmx_stuff' of ssh://git.openpilot.org/OpenPilot into next
Conflicts:
	shared/uavobjectdefinition/hwsettings.xml
2011-08-24 11:37:30 -05:00
James Cotton
4e59e697af IMU3000: Sometimes the irq is called before previous I2C transaction. This
isn't good but for now just deal with it.  Need DMA I2C driver.
2011-08-22 02:34:40 -05:00
James Cotton
8c16f614f2 INS: Use the data from the BMP085 and feed into EKF 2011-08-22 02:32:40 -05:00
James Cotton
b1c522def3 Merge remote-tracking branch 'origin/next' into ins 2011-08-21 01:34:40 -05:00
James Cotton
38d9df8fcb HMC5883: Clean up the mag driver 2011-08-21 01:29:55 -05:00
James Cotton
e1afc9a19a Merge branch 'next' into ins
Conflicts:
	flight/Libraries/inc/fifo_buffer.h
	flight/PiOS/STM32F10x/link_STM3210E_INS_sections.ld
	flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj
2011-08-21 00:47:43 -05:00
James Cotton
c82aa64c53 INS: General clean up to deal with new driver formats. Also automatically
monitors the EKF rate.
2011-08-21 00:42:06 -05:00
James Cotton
af69e0a1a8 BMA180 driver; Don't externalize the fifo buffer but handle it in the driver
layer.  General driver cleanup.
2011-08-21 00:40:10 -05:00
James Cotton
8ae53a4f97 PiOS: Cleanup IMU3000 driver a fair bit. 2011-08-21 00:39:20 -05:00
James Cotton
368323fd59 Merge remote-tracking branch 'origin/james/erase_settings' into next 2011-08-20 13:07:01 -05:00
Corvus Corax
dfd301571a HWSettings: Allow late Initialization and Start of Modules as defined in Makefile(available modules) and UAVObject(actually started modules) 2011-08-20 01:24:06 +02:00
James Cotton
d103541970 IMU3000: Make the IRQ trigger the callback based I2C read. Drop the
temperatured data from the FIFO stream.  Add some flags to stop the callbacks
trampling over the configuration.
2011-08-19 14:28:33 -05:00
James Cotton
3465eb2f30 PiOS F2 I2C: Add a callback based transfer. This needs merging into the main
transfer function like SPI but I will leave that for now to avoid creating a
lot of changes in the main code.
2011-08-19 13:38:11 -05:00
James Cotton
7444337418 F2 PiOS I2C: Add a poor man semaphore here in case we start calling I2C
transfers from IRQ.  Also catch the double 0x70084 event which was locking up
the FSM with -Os enabled.  I did this in a cheating way (filtering the event
based on state) but it's the cleanest I can see.  Hopefully a DMA version of
I2C will fix this.
2011-08-19 11:39:50 -05:00
James Cotton
b0e04e5f79 PIOS SPI: Make sure the non-freertos busy flag inits to zero 2011-08-19 10:52:50 -05:00
James Cotton
c7034ef8a6 IMU3000: Fix a constant that made the sampling rate 1kh instead of 8 internaly.
No downsample that (in IMU3000) by 8 to get gyros at 1khz.  Well about 256 Hz
nyquist and shouldn't cause substantial issues for EKF.
2011-08-18 13:01:51 -05:00
James Cotton
bdb9dc0a54 BMA180: Use DMA for getting the accels and use callback to push it onto the
stack.
2011-08-18 12:51:22 -05:00
James Cotton
3b6ffc8afa PiSO SPI: Implement a poor mans semaphore for non-freertos systems. 2011-08-18 12:51:00 -05:00
James Cotton
294e0cbdff IMU3000: Change IMU3000 api right now so it only reads one element from the
fifo but swaps the endian appropriately.
2011-08-18 11:03:56 -05:00
James Cotton
11ac0707da BMA180: Reset BMA180 chip at reconfiguration. 2011-08-17 06:49:56 -05:00
James Cotton
71a1cdff62 PiOS SPI: For F2 need to have the same receive and transmit length when using
CRC.  This wasn't the case on F1.  With CRC the last byte of the buffer passed
to PIOS_SPI_TransferBlock is NOT USED.  This is the case on both F1 and F2.

Also need to DeInit DMA before enabling or it doesn't enable successfully.

Finally added a timeout which sets a fail on the pios spi transfer in the case
that either of the dma channels fails to enable.
2011-08-16 11:29:15 -05:00
James Cotton
bcca705750 Disable beta hardware bmp085 driver until it's updated. Not necessary anyway
since on the INS.
2011-08-16 08:55:02 -05:00
James Cotton
35eef66bfe OP-557: Add a UAVO access method to erase the entire flash chip. Normally not
needed by users because if too much changes I change the FS magic and trigger a
wipe.

Possibly the erase should require a particular "magic" object id value to
execute?  This would make it harder to do manually through UAVOs though.
2011-08-15 10:33:27 -05:00
James Cotton
db9c73db45 Get SPI closer to working. The flags in the pios_config should match the
stream number, not channel number.  Also DeInit DMA section in the init process
which makes debugging and init behavior more reliable.
2011-08-15 04:47:53 -05:00
James Cotton
86b652bbab Merge branch 'next' into camera_stabilization 2011-08-14 18:07:57 -05:00
zedamota
e736b17cc4 Merge remote-tracking branch 'remotes/origin/next' into GCS_ChangesToUI-RuntimeCFG
Conflicts:
	ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp
	ground/openpilotgcs/src/plugins/config/configgadgetwidget.h
	ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp
2011-08-14 15:48:16 +01:00
James Cotton
c5ed82086d Configure the interrupt information before enabling. Still looping in IRQ so
configuration needs work.
2011-08-14 02:00:52 -05:00
James Cotton
80c2d45d93 Fix the BMP085 interrupt handler and get it producing data. Driver needs some
work to abstract away the actual calculation of altitude from pressure and
temperature.
2011-08-13 20:49:07 -05:00
James Cotton
a2b76adc33 Attitude: Do not start attitude estimation until accel data appears. This
fixes the NaN when AttitudeSettings not available.
2011-08-13 18:53:42 -05:00
James Cotton
62f51fc92d Some improvements to the HMC5883 driver. Still getting funny values but I
suspect the chip at this point.
2011-08-13 11:20:32 -05:00
James Cotton
13e5f4123a Reading gyro registers directly working. 2011-08-13 08:33:46 -05:00
James Cotton
f82e5dde33 Fix the EXTI IRQ handlers 2011-08-13 07:13:21 -05:00
James Cotton
e1f7a5003d Fix up SPI DMA streams 2011-08-13 04:54:19 -05:00
James Cotton
77cca9ba30 Move EXTI handlers into other drivers 2011-08-13 01:29:17 -05:00
James Cotton
6d018c046e Get BMA180 working. Need to move exti stuff into it until pios_exti
implemented properly
2011-08-13 01:10:33 -05:00
James Cotton
5619e33292 Bootloader now jumps to functioning code for INS. Consistent with AHRS code. 2011-08-12 22:52:47 -05:00
James Cotton
6529b8360f Trying to get linker system working for INS 2011-08-12 21:28:02 -05:00
James Cotton
1d1f351233 Pios Delay: Add function for measuring time difference between two cycle counts 2011-08-12 04:29:53 -05:00
James Cotton
b3b4fcd007 Fix linker script and get rid of dead code 2011-08-12 03:44:55 -05:00
James Cotton
f247112090 PiOS F2: Move IMU3000 to device dependent :(. Now they all are. Need to
abstract as much as possible out since init is almost identicalc and protocol
COULD be device independent.
2011-08-12 03:38:45 -05:00
James Cotton
8c1dd7b929 Make BMP085 driver device dependent and update to new driver style. 2011-08-12 03:38:45 -05:00
James Cotton
9d76efa2aa Move BMA180 driver to common architecture style. 2011-08-12 03:38:45 -05:00
James Cotton
1dc08e5cf7 F2 PiOS: Small fix to hmc5883 driver 2011-08-12 03:38:44 -05:00
James Cotton
ba413d5dad F2 StdPeriph: Make the StdPeriph take in config parameters as const.
Unfortunately they don't do this upstream :(
2011-08-12 03:38:40 -05:00
James Cotton
ef0cdae622 PiOS F2: Remove clock initialization from usart since it is in pios_sys.c 2011-08-12 02:28:02 -05:00
James Cotton
6310f46705 HMC5883: Update driver for F2. Move to STM32F2xx directory since it is device
dependent.  Abstract configuration out of board.h file into a standard board.c
structure.
2011-08-12 02:26:51 -05:00
James Cotton
9c7799dfe6 UAVObject Init: Get rid of deprecated linker init code 2011-08-10 22:48:42 -05:00
James Cotton
0c2c48bee6 F2 PiOS: More changes for spi to work (not completed) 2011-08-09 12:59:10 -05:00
James Cotton
a097ff784b F2 PiOS: Getting the I2C driver working again (copying changes from Zippe,
thanks again man!)
2011-08-09 12:58:46 -05:00
James Cotton
8be9ac9cc9 PiOS: Move driver out of common directory since it makes calls to configure the
EXTI system.
2011-08-09 12:51:26 -05:00
James Cotton
d78450eae8 Move some of the F2 defines into the makefile to make them global. Fixes some
issues with grabbing the wrong stm32 configuration file.
2011-08-09 01:19:05 -05:00
James Cotton
27213c7fd9 F2 PiOS USART: Update to the new driver format for coms 2011-08-09 01:18:25 -05:00
James Cotton
479ba7c21f OP-378 INS: Continue getting F2 INS to compile 2011-08-08 08:36:40 -05:00
sambas
9f35b6939c Bind IO fix 2011-08-07 10:10:52 +03:00
James Cotton
558bdddeaf INS: Almost got Bootloader compiling *sigh* 2011-08-06 21:27:29 -05:00
James Cotton
a0d77faf4b PiOS: Move pios_iap out of common. It is STM32F1x specific. Created an
STM32F2xx stub version.  This needs cleaning up - there is some common code,
most of which can probably move to the bl_helper function.
2011-08-06 20:24:07 -05:00
James Cotton
f23ec059fe dos2unix 2011-08-06 19:53:46 -05:00
James Cotton
1ccb9a1947 Some changes to BL to get running on F2. Also disables it for now (flash
interface is different).
2011-08-06 19:46:41 -05:00
James Cotton
d1c9ac0705 PiOS F2: Commit the F2 port of PiOS from Zippe. Thanks for doing all the hard
work man :-D
2011-08-06 19:36:56 -05:00
James Cotton
0bba13a0e9 Merge branch 'next' into ins
Conflicts:
	flight/INS/Makefile
	flight/INS/pios_board.c
	flight/Modules/Altitude/altitude.c
	flight/PiOS/Boards/STM3210E_INS.h
	flight/PiOS/STM32F10x/link_STM3210E_INS_BL_sections.ld
	flight/PiOS/STM32F10x/link_STM3210E_INS_HD_BL.ld
	flight/PiOS/STM32F10x/link_STM3210E_INS_HD_NB.ld
	flight/PiOS/STM32F10x/link_STM3210E_INS_memory.ld
	flight/PiOS/STM32F10x/link_STM3210E_INS_sections.ld
	flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj
2011-08-06 17:25:56 -05:00
sambas
1e67b5e3b5 DSMx_binder, hw setting 0 disabled, 1-10 bind pulses. Manual disable after successful bind. Only for flexiport. 2011-08-06 22:16:47 +03:00
sambas
a454cf844b DX8 support, BIND3 only 2011-08-04 19:20:05 +03:00
Stacey Sheldon
06cdeb7b61 rcvr: support multiple simultaneous receivers
Now also supports multiple instances of the Spektrum driver.
These are configured as Spektrum1 and Spektrum2.
2011-08-02 01:22:04 -04:00
Stacey Sheldon
829b8b83f6 rcvr: Add GCS receiver driver for rcvr via telemetry
This allows the GCS to emulate a receiver device via the
telemetry link.

Select "GCS" as your input type in the manualcontrol config
screen and calibrate it as normal.

Note: The expected values for the channels are in microseconds
      just like a PWM or PPM input device.  The channel values
      are validated against minimum/maximum pulse lengths just
      like normal receivers.
2011-08-02 01:22:04 -04:00
Stacey Sheldon
2f79e4fa76 Merge remote branch 'origin/stac/refactor-usart-com' into next 2011-07-31 09:41:06 -04:00
James Cotton
568ea13471 Merge branch 'next' into stac/refactor-usart-com 2011-07-31 09:13:27 +09:00
Stacey Sheldon
c2fb0d8b43 com: allow run-time allocation of buffers 2011-07-29 15:33:14 -04:00
Stacey Sheldon
8b0415d905 bl: alternate stopwatch for small bootloaders
The small bootloaders (CC and PipX) are out of flash space
so their stopwatch implementation has been swapped out for
one based on the DELAY clock that takes about 500 bytes less
of code space.

Identical functionality is preserved.
2011-07-29 15:33:01 -04:00
Stacey Sheldon
13f9b0e09d Merge remote branch 'origin/OP-498_jwhitlock_add-ppm-to-cc' into next 2011-07-28 22:15:01 -04:00
Stacey Sheldon
a3888ecd48 usart: ensure callbacks are bound in the correct order 2011-07-27 23:21:39 -04:00
Stacey Sheldon
5f8760a55c com: Move buffering out of USART/HID layer and into COM layer
This allows the spektrum and sbus receiver drivers to bind
directly to the usart layer using a properly exported API
rather than overriding the interrupt handler.

Bytes are now pushed directly from the usart layer into the
com layer without any buffering.  The com layer performs all
of the buffering.

A further benefit from this approach is that we can put all
blocking/non-blocking behaviour into the COM layer and not
in the underlying drivers.

Misc related changes:
 - Remove obsolete .handler field from irq configs
 - Adapt all users of PIOS_COM_* functions to new API
 - Fixup callers of PIOS_USB_HID_Init()
2011-07-27 19:45:38 -04:00
James
60136f0464 Add support for PPM transmitters up to 12 channels. Small array indexing issue in PIOS_PPM_Get. 2011-07-27 00:33:32 +01:00
Mike Smith
df5569c758 Fix a stupid off-by-one that prevented this code from working.
Update to use 32-bit microsecond values.

Remove PIOS_DELAY_DiffuS per consensus (caller can do it easily themselves).

Update the core delay logic per Stac's suggestion to a version that is
resistant to various overflows.
2011-07-25 20:55:48 -07:00
James Whitlock
6a6ec41809 Build fixes 2011-07-23 22:10:17 +01:00
Mike Smith
480f07a264 Typo fix. 2011-07-23 13:58:56 -07:00
Mike Smith
0df3bb2c37 Restore functions lost due to inept merging, and refactor to take advantage of them.
Address the following review feedback items:
 - use stdint types
 - avoid the use of magic numbers (define CYCCNTENA)
 - remove expository comment about sneakiness and corresponding code, replace with something simpler based on the API
 - remove commented/#if 0 code
2011-07-23 13:53:16 -07:00
Mike Smith
c3267a3b53 Remove PIOS_DELAY_TIMER definitions from configuration files, as there is no longer a delay timer to configure. 2011-07-23 13:48:40 -07:00
James Whitlock
11c568ec50 Add in a PPM input frame size tracker.
Move update of capture values to start of new frame.
Fix an issue with setting channels to invalid.
2011-07-23 01:38:51 +01:00
James Whitlock
7a58b4cceb A quick clean of ppm code to remove white space and duplicated comments 2011-07-23 01:32:57 +01:00
Mike Smith
6bc5339015 Change the pios_delay implementation to use the CPU cycle counter rather than burning a timer. 2011-07-21 23:21:26 -07:00
Stacey Sheldon
a7cce25252 usart: fix lower usarts clobbering higher ones
The break statements are clearly missing from this
switch statement.

This would lead to problems when using more than one
USART on CC.
2011-07-22 00:30:49 -04:00
James Whitlock
7ce5daef8f Clean up of PPM code in master. 2011-07-19 20:46:24 -04:00
Stacey Sheldon
8dbace5ee2 Merge branch 'rcvr_mem_reduction'
Conflicts:
	flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld
2011-07-17 17:14:40 -04:00
James Cotton
2da65014c7 Fix typo in servo doxygen header 2011-07-16 03:25:33 -05:00
James Cotton
b83f731c03 Remove all references to vTaskDelay in the flash code as it can run before the
FreeRTOS scheduler

Also increaes init stack size from 0x80 to 0x100
2011-07-15 18:16:16 -05:00
James Cotton
01b62cf98f Fix a typo 2011-07-15 15:30:10 -05:00
James Cotton
72e80d407c Change the magic value in the object file table. Forces all objects to be
erased since all ids are changing - this frees up memory.
2011-07-15 11:11:29 -05:00
James Cotton
d41260d54c Make the stabilization settings query correctly now by increasing the TX buffer
on the CC side to 256 bytes instead of 128 to support large objects (max object
size is 256 bytes)
2011-07-15 10:40:21 -05:00
James Cotton
3d35e249c8 Merge branch 'master' into bugfix-flight 2011-07-15 10:33:54 -05:00
Stacey Sheldon
6580462916 rcvr: specify drivers for groups of channels
Each channel was previously tracking a separate driver.
Now, channels are grouped within a channel group to save
RAM used for tracking and to better reflect how channels
are actually mapped.
2011-07-14 23:22:42 -04:00
Stacey Sheldon
442d56c1c5 linker: Add section to record unused RAM
Note that this section will be absorbed by the heap at runtime.
2011-07-14 23:22:42 -04:00
sambas
18a5465246 Bugfix: CC flexiport spektrum config
Working spektrum bind routine, depending your TX try BIND_PULSES 3,5,7,9 (5 works with DX7)
Boot process takes too long on MB so bind command misses the window (20-140ms).
2011-07-14 14:43:26 +03:00
Mathieu Rondonneau
612a439199 OP-423: simplify the MODULE_INITCALL macro and remove the ordering loops 2011-07-12 20:44:32 -07:00
James Cotton
9e94f9fee9 Fix typo from SISE to SIZE 2011-07-12 12:48:06 -05:00
James Cotton
2fe7ee40b1 Merge branch 'OP-423_Mathieu_Change_Init_To_Reduce_Memory_Footprint' 2011-07-12 12:44:59 -05:00
James Cotton
59798701a2 Merge branch 'master' into bugfix-flight
Conflicts:
	flight/CopterControl/System/inc/pios_config.h
2011-07-12 11:40:47 -05:00
Mathieu Rondonneau
d38f6167e3 OP-423:
Also reduce heap has it does not fit in SRAM anymore (not with current compiler).
(that's ok since if there is more space available, it will be reclaimed).

Merge branch 'master' into OP-423_Mathieu_Change_Init_To_Reduce_Memory_Footprint

Conflicts:
	flight/CopterControl/System/inc/pios_config.h
	flight/Modules/ManualControl/manualcontrol.c
2011-07-08 06:29:34 -07:00
Stacey Sheldon
2e8d3a9be3 clean up cut/paste cruft 2011-07-07 23:02:09 -04:00
Stacey Sheldon
1f004ee896 ppm: port PPM driver onto new CC driver layers
This is a port of a work-in-progress by Sambas onto
the new driver infrastructure needed for boot-time
configuration.

PPM and PWM still don't coexist in a build but this
is closer.
2011-07-07 22:27:57 -04:00
Stacey Sheldon
226f095a2e bootcfg: remove baudrate #defines for USARTs
The initial baud rates of each interface are now forced in the
board init code.

Any modules using USARTs should have fields added to
their settings object to allow the user to change the
baud rate from the default by using the COM layer APIs.

Developers requiring custom baud rates before the settings
objects are in place should locally edit the cfg structs
to specify the desired baud rates.
2011-07-06 23:03:54 -04:00
Mathieu Rondonneau
36f28f8037 OP-423: Fixing heap2 (puting back bytes from the post heap stack (used during init) back into the free list).
Tested this heap2 at runtime with CC and new compiler since old one (current) triggers strict alliasing error.
That's ok since strict aliasing is disabled on OP, and CC only use heap1.
2011-07-05 21:45:39 -07:00
Mathieu Rondonneau
9b9b5a1367 OP-423: remove ';' at the end of macro 2011-07-05 19:44:54 -07:00
Stacey Sheldon
dbf7574946 bootcfg: use UAVobj to control boot-time HW config
This should mark an end to the compile-time selection of HW
configurations.

Minor changes in board initialization for all platforms:
 - Most config structs are marked static to prevent badly written
   drivers from directly referring to config data.
 - Adapt to changes in .irq fields in config data.
 - Adapt to changes in USART IRQ handling.

Major changes in board initialization for CC:
 - Use HwSettings UAVObj to decide which drivers to attach to
   the "main" port and the flexi port, and select the appropriate
   device configuration data.
 - HwSettings allows choosing between Disabled, Telemetry, SBUS,
   Spektrum,GPS, and I2C for each of the two ports.
 - Use ManualControlSettings.InputMode to init/configure the
   appropriate receiver module, and register its available rx channels
   with the PIOS_RCVR layer.  Can choose between PWM, Spektrum and PPM
   at board init time.  PPM driver is broken, and SBUS will work once
   it is added to this UAVObj as an option.
 - CC build now includes code for SBUS, Spektrum and PWM receivers in
   every firmware image.

PIOS_USART driver:
 - Now handles its own low-level IRQs internally
 - If NULL upper-level IRQ handler is bound in at board init time
   then rx/tx is satisfied by internal PIOS_USART buffered IO routines
   which are (typically) attached to the COM layer.
 - If an alternate upper-level IRQ handler is bound in at board init
   then that handler is called and expected to clear down the USART
   IRQ sources.  This is used by Spektrum and SBUS drivers.

PIOS_SBUS and PIOS_SPEKTRUM drivers:
 - Improved data/API hiding
 - No longer assume they know where their config data is stored which
   allows for boot-time alternate configurations for the driver.
 - Now registers an upper-level IRQ handlerwith the USART layer to
   decouple the driver from which USART it is actually attached to.
2011-07-05 22:03:25 -04:00
Stacey Sheldon
6415fc84a5 rtc: allow registration of callbacks on RTC tick
This separates the RTC device and interrupt handling
from the devices that rely on the tick notifications.

Drivers can now register tick notification functions
that will be called on each RTC tick event.
2011-07-05 22:03:25 -04:00
Stacey Sheldon
740b5f1584 rcvr: convert PWM, PPM, SBUS and Spektrum to use PIOS_RCVR
All receivers now fall under the same driver API provided
by pios_rcvr.c.

This is part of a larger sequence of commits that will
switch the receiver selection over to boot time dynamic
configuration via UAVObjects.
2011-07-05 22:03:25 -04:00
Stacey Sheldon
e77795dc28 rcvr: add generic driver API for receivers
Will be used to collapse PWM, PPM, Spektrum and SBUS so we
can choose between them at boot time instead of at compile time.
2011-07-05 22:02:47 -04:00
James Cotton
010f0255a4 OP-543: When the magic header on file system is bad at init, read multiple
times.  It's not written as cleanly as I'd like but works for wiping when magic
value changes.  Testing will reveal if this stops the lost settings.
2011-07-04 21:44:41 -05:00
Mathieu Rondonneau
f864d723dd OP-423: Cleanup and remove recently added *_BL.S startup file. 2011-07-03 18:45:02 -07:00
Mathieu Rondonneau
2daa36aad9 OP-423: Remove *_BL.S 2011-07-03 13:14:42 -07:00
Mathieu Rondonneau
b3740ec025 OP-423: Clean startup and add weak function call for stack swap. 2011-07-03 12:43:38 -07:00
Mathieu Rondonneau
fbf0b021c7 OP-423: Replace hardcoded value and get value from memory section (change from code review) 2011-06-25 20:06:33 -07:00
Mathieu Rondonneau
6683ce8570 OP-423: Make it more obvious that MODULE_TASKCREATE_ALL and MODULE_INITIALIZE_ALL are macro (for now):
- remove the ;
  - also encapsulate the macro by {} in his own scope.
2011-06-25 11:40:01 -07:00
Mathieu Rondonneau
de55c56427 OP-423: Change capital on macro to be uppercase for consistency. 2011-06-24 22:03:03 -07:00
Mathieu Rondonneau
0ff5e9a46f Merge branch 'master' into OP-423_Mathieu_Change_Init_To_Reduce_Memory_Footprint 2011-06-21 22:02:13 -07:00
James Cotton
8976d22fad Merge remote-tracking branch 'origin/OP-159_os_sbus' 2011-06-21 17:51:22 -05:00
Mathieu Rondonneau
fc1e3f574c OP-423: Split task create and module init in order to postpone task creation once the full heap is available.
Also implement some ordering (quite ugly still) in the module init and task creation order so we can decide which module to start/init first
and which module to start/init last.
This will be replaced/adapter with the uavobject list later (once it's implemented).
reserving some space for module init and task create parameters to customize module/task creation (this will be usefull once we get the list and customization from customer).

Changes have been made for OP and CC. Tested comped with CC,OP, sim_posix.
Only ran on bench with CC for couple of minutes (code increase expected but no dropping of stack which is good).

This gives task creation at the time wherethe all heap is available.
2011-06-19 22:35:40 -07:00
Oleg Semyonov
6272210df7 sbus: some code cleanup (no functional changes) 2011-06-19 14:30:13 +03:00
Oleg Semyonov
311902f1f2 sbus: implemented S.Bus stream decoding 2011-06-18 23:19:57 +03:00
Mathieu Rondonneau
b67a38661e OP-423: merge master into that branch, resolve conflicts and test with CC and bl_CC
heap reamining is low (about 500) but stacks can be ajusted (specially the 200 bytes from system) to give the level close to 1Ko if needed.

Merge branch 'master' into OP-423_Mathieu_Change_Init_To_Reduce_Memory_Footprint

Conflicts:
	flight/CopterControl/System/inc/FreeRTOSConfig.h
	flight/CopterControl/System/inc/pios_config.h
2011-06-17 19:04:09 -07:00
Mathieu Rondonneau
693c6bc5b0 OP-423: fix bl and bu, also fix compiler problems encountered with make all 2011-06-17 18:54:25 -07:00
Mathieu Rondonneau
65cf467ca4 OP-423: move the module initialize funtion into a specific section for OP and CC.
- create linker section for those <module>Initialize()
- later this list will incorporate parameters as well. (this probably will be more a OP feature to swap/remove/delete module on the fly.
- this is not done at compile time anymore by Makefile.
- this will allow us to have control on the module start at run-time (not implemented but build the ground for it).
- this simplify the startup (Part of code re-org).
- this change does not affect sim_posix and win32 (since they don't need that)
- ensure it's compiling for PiOS.posix
- port to PiOS.win32 but not tested (not compiled)
- tested on CC
- compile on OP.
- this free ~200 bytes.
- current avalable bytes (is we keep the same remaining bytes on the stack than before) is easily passed the 1.2Ko mark on CC with new gcc (4.5.2)
- this does not include init-reorg for each module (I still think more can be freed)
2011-06-16 22:13:19 -07:00
Oleg Semyonov
aeda61d252 usart: serial telemetry can be disabled to free USART
It was tested being merged with OP-472_CorvusCorax_CopterControl-Guidance_v3
branch, Spektrum on USART3 and GPS on USART1 and seems to work.

Currently defaults mimic original behavior, that is, if USE_SPEKTRUM
is not defined - define USE_PWM and USE_GPS. Thsi should be refactored
later to make it configurable from the Makefile.

Also it was not ported to the OP MB: it currently does not support the
S.Bus hardware and still has original behavior with the patch. But this
is one more step to dynamic configuration of ports.
2011-06-16 15:06:01 +03:00
Mathieu Rondonneau
e8cdf22427 OP-423 Port to OP: Claim (at run-time) the remaining un-used bytes (between heap and end of RAM) that are for data growth (needed at compile time).
CAREFULL: the heap section need to be the last section in RAM to avoid overwritting data...

also move address into linker (CC and OP)
2011-06-15 18:54:35 -07:00
Oleg Semyonov
d8201ec45b sbus: provide a stub based on Spektrum driver (for CC only) 2011-06-15 22:35:21 +03:00
Mathieu Rondonneau
ab4e15e9aa OP-423 also claim (at run-time) the remaining un-used bytes (between heap and end of RAM) that are for data growth (needed at compile time).
CAREFULL: the heap section need to be the last section in RAM to avoid overwritting data...

Tested with GCC 4.5.2 this gives 1K of free bytes usable in heap right away (including the 200 bytes saved just by using the new gcc).
This does not include any code re-org yet!
2011-06-14 22:13:30 -07:00
Mathieu Rondonneau
3780de8d3e OP-423 port to OP (heap2) the previous changes done in CC (heap1) (see c95b199166)
I managed to test CC with heap2 changes and the init stack claimed back to heap once scheduler starts.

the changes of this commit are OP related (just cleanup on CC side):
Arch specific stuff (in reset vector) to hide this from portable code:
     - switch back to MSP stack before starting the scheduler so that the sheduler can use the IRQ stack (when/if needed).
     - call the C portable function in heap2 to claim some stack back (the number to claim is taken from linker file).
     - start the scheduler from reset vector (I move this here from main because it make sense to not go back to C (so that I don't need to copy the rolled stack in case the sheduler returns). This make it more clean.
     - Also I have added the call to the mem manager if sheduler return. that way, we don't reset indefinitely if memory runs out. We will go to this handler and figure things out (right now, it's just looping but at least not rebooting. Probably trap NMI would be better (later improvement).
2011-06-14 20:10:53 -07:00
Mathieu Rondonneau
c95b199166 OP-423 do the arch specific stuff (in reset vector) to hide this from portable code:
- switch back to MSP stack before starting the scheduler so that the sheduler can use the IRQ stack (when/if needed).
 - call the C portable function in heap1 to claim some stack back (the number to claim is taken from linker file).
 - start the scheduler from reset vector (I move this here from main because it make sense to not go back to C (so that I don't need to copy the rolled stack in case the sheduler returns). This make it more clean.
 - Also I have added the call to the mem manager if sheduler return. that way, we don't reset indefinitely if memory runs out. We will go to this handler and figure things out (right now, it's just looping but at least not rebooting. Probably trap NMI would be better (later improvement).

The part missing for this part is the weak attribute for the function in heap1.c so that we don't have to update everything with empty stub.
I think the weak atrribute for C function called in assembly is arch dependent so I am not sure if this is possible (will look into it, maybe somebody outthere nows).
Right now, it's heap1 dependent and won't work with heap2. I will clean that up the next couple of days.

I did some test and it looks good.
this is without init code re-organization so we don't free as much as we will be it's good starts.

This compile with sim_posix (since it does not affect portable code) so this is really clean.
I only tested this with CC. I will port it for OP when I will work on heap2.
2011-06-13 21:49:17 -07:00
Mathieu Rondonneau
1f54e32ea9 OP-423 also add changes to OP. (I can not test it because I don't have a board so only compile test) 2011-06-13 17:10:14 -07:00
James Cotton
404c026188 Patch from Zippe to use cycle timer for CPU monitoring. 2011-06-13 00:24:30 -05:00
Mathieu Rondonneau
7598e898fa OP-423 Step-1: split system stack and implement water mark for IRQstack:
- use IRQStack for ISRs (at begening of SRAM) (let's call it the irq stack)
- use end of heap for stack needed during initialization (let's call it the init stack).
- the systemStats in GCS indicate the remaining bytes in the IRQ stack (this is realy usefull to monitor our (nested) IRQs.

This is the base ground to provide as much memory as possible available at task creation time.

Next step is to re-organize the initialization in order to move all the init out of the thread's stacks onto the init stack.
This will provide as much memory as possible available at task creation time.
Basically the stack during initialization will be destroyed once the scheduler starts and dynamic alloc are made (since the init stack is at the end of the heap). We will need to make sure we don't clobber the heap during initialization otherwise this will lead to stack corruption.
2011-06-12 20:23:00 -07:00
James Cotton
0f5fe54329 FlashFS: Should clear the 0 sector when wiping flash chip, not 10 bytes in. 2011-06-11 22:31:51 -05:00
James Cotton
4f47c06547 Merge branch 'saving_crc' into bugfix-flight 2011-06-05 15:37:44 -05:00
James Cotton
0a56129b35 OP-452: Made the CRC calculation run in chunks to balance efficiency and ram
usage, because Stac caught me being lazy :)
2011-06-05 09:05:59 -05:00
James Cotton
599483d5ac OP-152: Save CRC for object and header into flash and only load object if CRC
matches.  Read the flash first bytewise to compute CRC instead of buffering
which is more RAM efficient but very inefficient as it sets up many one byte
SPI transfers.

Also incremented the filesystem magic flag to trigger an automatic flash wipe
on this upgrade.
2011-06-04 18:36:38 -05:00