James Cotton
0a71a48c57
Sending all FF finally again
2012-02-02 10:36:09 -06:00
James Cotton
29237f97ae
For SPI slave devices we need to handle the interrupt differently since
...
transactions should already be completed. Also reset the callback so in the
case of noise on the IRQ line it will not keep firing interrupts.
I suspect we should probably disable interrupts in this handler to prevent
refiring.
2012-02-02 10:13:09 -06:00
Alessio Morale
5449408763
Merge branch 'amorale/timerprescaler' into inoutch8
2012-02-01 00:23:53 +01:00
Alessio Morale
820e8ac062
Handle different prescaler values for timers on APB1 and APB2.
...
The PIOS_MASTER_CLOCK has been removed in favor of
PIOS_SYSCLK (the master clock value,168000000 for revolution)
PIOS_PERIPHERAL_APB1_CLOCK and
PIOS_PERIPHERAL_APB2_CLOCK
Look at STM32F4xx_Revolution.h for the list of timer/peripheral and APB them belongs.
2012-01-28 20:04:55 +01:00
James Cotton
13447ac907
Fix the MPU6000 implementation
2012-01-28 00:21:58 -06:00
James Cotton
f311700804
Flashfs: Whenever failing out of a transaction unlock the semaphore
2012-01-26 14:14:50 -06:00
James Cotton
85bfa7dcf9
Flashfs: Missed calculation of the header crc for monolitihic write
2012-01-26 13:32:53 -06:00
James Cotton
ad3d470f40
Flashfs and Flash: Add new function to write a series of blocks in one flash
...
write transaction to improve efficieny.
2012-01-26 12:39:35 -06:00
James Cotton
80705cdba1
Flash: Because on CC/CC3D the flash is initialized before FreeRTOS is started
...
we cannot use the transaction lock or the delay while saving.
2012-01-26 11:50:05 -06:00
James Cotton
4fc907ad0d
Add a transaction semaphore to flash and flashfs to make sure multiple saves
...
or loads can't be attempted between threads
2012-01-26 11:36:07 -06:00
James Cotton
8b15fdd88b
Flash: Add a vTaskDelay when waiting for flash operations to complete to
...
prevent blocking the bus from accels
2012-01-26 11:26:19 -06:00
James Cotton
e69a0937bc
Flash: Wrote status instead of read it
2012-01-26 11:17:00 -06:00
James Cotton
69dc5abf0c
Flash: Get rid of some defines and directly reference the cfg structure
2012-01-26 10:56:26 -06:00
James Cotton
6d572986e5
Flashfs: Clean up some of the JEDEC commands and also format whole chip when FS
...
is wrong.
2012-01-26 10:04:49 -06:00
James Cotton
fe7b9a909a
LED: Update the LEDs on revo
2012-01-26 09:11:27 -06:00
James Cotton
20670d049b
Update pios_led for F4 targets to match the new F1 implementation. Also fix
...
type for F1 in GPIO labels.
2012-01-25 22:50:19 -06:00
James Cotton
205aabe895
L3GD20: Make this sensor push data onto a FreeRTOS queue so that the sensor
...
reading task can block according. Also now the gyro data is sent to
stabilization multiple times per update of the attitude loop.
2012-01-25 01:20:07 -06:00
James Cotton
0da20bb846
Flash: Because most of the commands are a JEDEC standard rename this file
...
pios_flash_jedec and abstract out the methods that can vary between chips.
2012-01-25 00:23:24 -06:00
James Cotton
a02cad6f52
Flashfs: Separate out the sector sizes and magic values into a runtime
...
configurable structure. This makes it easier to deal with different chip
layouts.
2012-01-24 23:56:59 -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
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
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
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
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
4d3af7afbf
Add ID test to ADXL345
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
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
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
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
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
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
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
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
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
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
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
53e9ef06b4
altitude: add optional altitude 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
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
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
0cc18e7dcf
Add files for new L3DG20 sensor
2012-01-04 20:33:54 -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
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
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
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
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
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
16619584e4
usb cdc: return valid data in response to SetLineCoding
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