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

189 Commits

Author SHA1 Message Date
Alessio Morale
f767d64f0c OP-980 Remove the timeout logic as it causing troubles with windows
platform
2013-06-11 10:27:32 +02:00
Corvus Corax
88071b1078 Merge remote-tracking branch 'next' into corvuscorax/OP-947_stateestimator-module 2013-06-09 22:43:25 +02:00
Corvus Corax
6f59c49506 just uncrustification 2013-06-09 22:09:04 +02:00
Alessio Morale
e9b3ee52f3 OP-997: add fields to SystemStatsUavo to monitor storage status 2013-06-09 19:20:00 +02:00
Corvus Corax
218e15ce61 Merge branch 'next' into corvuscorax/OP-947_stateestimator-module 2013-06-09 17:24:08 +02:00
Alessio Morale
87db5d30b0 OP-980 change how the semaphore is used on PIOS_USB_CheckAvailable to prevent deadlocks 2013-06-09 16:14:44 +02:00
Corvus Corax
022f1a1ac0 Merge branch 'next' into corvuscorax/OP-947_stateestimator-module
Conflicts:
	flight/modules/Attitude/revolution/attitude.c
2013-06-09 13:49:52 +02:00
Alessio Morale
107b930573 Merge remote-tracking branch 'origin/amorale/OP-980_revolution_usb_reconnect' into next 2013-06-09 09:07:24 +02:00
Alessio Morale
ab1c9c157f OP-995: Fixes for correct battery monitor readout 2013-06-08 13:40:01 +02:00
Alessio Morale
51a7f27b99 OP-994 Add an API to PIOS_ADC to get directly the Voltage value 2013-06-08 13:36:54 +02:00
Corvus Corax
6fdf554d4a Merge branch 'next' into corvuscorax/OP-947_stateestimator-module
Conflicts:
	flight/modules/Attitude/revolution/attitude.c
	ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp
	shared/uavobjectdefinition/attitudesettings.xml
2013-06-06 19:25:54 +02:00
Alessio Morale
ee7887c406 OP-980 Extended the memory barrier macros and fixed barrier kind in pios_usb_hid
+review OPReview-501
2013-06-06 10:26:41 +02:00
Mathieu Rondonneau
45391abd55 OP-976: RE-run uncrustify 2013-06-05 19:48:56 -07:00
Mathieu Rondonneau
a8c946dcb2 OP-976: Fix uncrustify changes that put a space before the ";" in the macro 2013-06-05 19:46:55 -07:00
Mathieu Rondonneau
d2fae1abed OP-976: fixing function name in the macro although don't have any effect since the linker directives are local. 2013-06-05 19:15:47 -07:00
Alessio Morale
c340bfc294 OP-980 Insert locking while checking status in PIOS_USB_CheckAvailable
+review OPReview-501
2013-06-06 01:42:26 +02:00
Alessio Morale
5fa73624da OP-980 Added memory barrier to preserve sequence to ensure callback validation
+review OPReview-501
2013-06-06 01:39:45 +02:00
Corvus Corax
6f6ca2481e Changed CoordinateConversion to use doubles for LLA2NED conversion, so coordinates can be represented in ECEF with sufficient resolution 2013-06-05 20:40:49 +02:00
Alessio Morale
b4f8b02a42 Revert "some optimizations, use real rx and tx buffer size instead of max buffer leghts"
It does not work in Windows so need further investigation prior to undo this revert
This reverts commit 901db6f828.
+review OPReview-501
2013-06-05 19:01:01 +02:00
Alessio Morale
8fb81ae17b OP-980 uncrustify
+review OPReview-501
2013-06-05 01:02:37 +02:00
Alessio Morale
f1f48b0ec6 OP-980 Fix usb reconnection issue for Revolution target.
step 3: add a timeout on rx_active to prevent rx locks
2013-06-05 00:54:08 +02:00
Alessio Morale
901db6f828 some optimizations, use real rx and tx buffer size instead of max buffer leghts 2013-06-05 00:53:50 +02:00
Alessio Morale
ce2bce353f OP-980 Fix usb reconnection issue for Revolution target.
step 2: check for cable disconnection (vbus) and issue a SW reconnection
2013-06-05 00:04:26 +02:00
Mathieu Rondonneau
23b2907d08 OP-976: Add the ';' back
This compile successfuly with make all_flight
2013-06-03 20:37:40 -07:00
Alessio Morale
14b87383b9 OP-980 Fix usb reconnection issue for Revolution target.
step 1: reset tx/rx_active flags on disconnection/reconnection
2013-06-04 01:52:44 +02:00
Brian Webb
e9f83bcc80 Fixes a bug in the rfm22b driver that was reading past the end of the bindings list when receiving a status message. Also adds some formatting changes that came about after doing a make uncrustify_all. 2013-05-26 08:36:38 -07:00
Corvus Corax
40864b2d3b some cleanups 2013-05-23 21:21:14 +02:00
Corvus Corax
843db63cf6 some last issues from review 2013-05-22 23:08:48 +02:00
Brian Webb
ac4847c8ac OP-932 Moves the configuration of the com ports on the coordinator OPLink to startup. 2013-05-21 19:48:21 -07:00
Brian Webb
dbce08a151 OP-932 Changes the radio task loop to loop every 1ms, and reduces the tx transmit period back down to 8ms. Also reduces the Tx windows to 1ms for each modem, and reserves the latter half of the Tx window for channel changing. 2013-05-21 17:40:05 -07:00
Brian Webb
d4a4588011 OP-932 Changes the RFM22 frequency hopping to change channels every Tx period. Also increases the Tx clock period from 8ms to 16ms, and adds a check on calculation the the time delta that it doesn't change the previous estimated time delta by too much. If the delta between the current time delta and the previously estimated time delta is too large it could indicate that there was a delay somewhere that makes the calculated time delta inaccurate.
Rearanges the packet send priority in the rfm22b driver so that PPM packets are top priority.
2013-05-20 20:49:24 -07:00
Sexy Pony
900f643bbd Reformat source code with 'make uncrustify_all' run twice. NO CODE CHANGES 2013-05-19 17:37:30 +03:00
Alessio Morale
ab7af16be3 Merge branch 'amorale/OP-901_lib_udates-usb_fixes' into HEAD
Conflicts:
	flight/pios/stm32f10x/library.mk
	flight/targets/boards/revoproto/firmware/pios_board.c
2013-05-19 15:01:08 +02:00
Alessio Morale
37eabb0931 Pointed type is explicitly used with sizeof when dealing with struct pointers.
+review OPReview-474
2013-05-19 12:00:16 +02:00
Alessio Morale
2e458b5652 OP-901 USB OTG/Device Drivers are not targeted for f103 (they are targeted at f105) so move again to F4 library folder instead of common 2013-05-18 20:53:28 +02:00
Alessio Morale
3ec9447fdc OP-901 Update CMSIS to r3p2-00rel1 2013-05-18 20:29:06 +02:00
Alessio Morale
c1f767b12d Merge remote-tracking branch 'origin/amorale/OP-954_logfs_settings_in_internal_flash' into next
Conflicts:
	flight/pios/common/pios_flashfs_logfs.c
2013-05-18 15:53:25 +02:00
Alessio Morale
66da2796e0 Merge remote-tracking branch 'origin/amorale/OP-905_revolution_watchdog_next' into next 2013-05-18 15:00:50 +02:00
Alessio Morale
aba64689a6 OP-901 removed stale core_cm3.c file 2013-05-18 14:25:37 +02:00
Alessio Morale
976ad90211 OP-901 Updated F4 CMSIS startup files, Moved USB OTG and USB Device library to common 2013-05-18 14:03:03 +02:00
Alessio Morale
f0c01d0eff OP-901 Updated F4 StdPeriph Driver Library to V1.1.0 2013-05-18 13:57:45 +02:00
Alessio Morale
448e98b336 OP-901 Updated F1 StdPeriph Driver Library to v3.5.0 2013-05-18 13:55:43 +02:00
Brian Webb
bc4f615c25 Adds setting HSE_VALUE on all F1 targets (should only be necessary if the HSE clock is not 8MHz).
Moves the CMSIS system_stm3210x.c from library.mk to the individual Makefiles for the F1 targets.  This allows for custom SystemInit functions where necessary.
2013-05-17 22:01:48 -07:00
Alessio Morale
67e41c34fc Merge remote-tracking branch 'origin/next' into amorale/usb_fixes 2013-05-17 22:46:42 +02:00
Alessio Morale
2735f8a620 OP-901 Updated common CMSIS files 2013-05-17 22:41:34 +02:00
Alessio Morale
13ee42a42a OP-901 Fixed errors due to unused parameter 2013-05-17 22:39:16 +02:00
Richard Flay (Hyper)
a6aedee9fa Merge branch 'next' into brian/support_inverted_USB_vsense 2013-05-17 05:54:42 +09:30
Richard Flay (Hyper)
031ea3e069 Merge branch 'next' into brian/code_cleanup_130514 2013-05-17 05:49:38 +09:30
Alessio Morale
c80f01dff9 OP-954 Rename the legacy PIOS_INCLUDE_FLASH_SECTOR_SETTINGS to PIOS_INCLUDE_FLASH_LOGFS_SETTINGS
+review OPReview-470
2013-05-15 23:16:34 +02:00
Richard Flay (Hyper)
ae14c13195 Merge branch 'next' into hyper/OP-951_add--Wshadow-to-flight-CFLAGS
Conflicts:
	flight/modules/ManualControl/manualcontrol.c
2013-05-16 06:28:56 +09:30
Richard Flay (Hyper)
ef5bb6f6fe Merge branch 'next' into OP-950_spi_fixes_FreeRTOS 2013-05-16 05:41:09 +09:30
Brian Webb
156109bb88 Added support for an active low USB vsense line. 2013-05-14 20:37:13 -07:00
Brian Webb
1608d11416 Cleans up some compiler warnings/erros and adds missing ifdefs around some e.g. WDG calls. 2013-05-14 20:22:54 -07:00
Stacey Sheldon
280f537644 f4 usb: ensure that we NAK on unused OUT endpoints
The ST USB code will automatically receive on any
endpoint that is opened but not in the NAK state.
Make sure we set OUT endpoints to NAK initially.

It also happily writes via a NULL pointer in ep->xfer_buff
which writes to address 0x0000_0000.  Since address
0x0 is aliased onto the internal flash by the BOOT0/1 pins
and the internal flash is (normally) in the LOCKED state,
this write puts the internal flash into an errored state.

This errored state means that writes to internal flash
are no longer allowed and all further writes fail.
2013-05-14 23:50:17 +02:00
Alessio Morale
8d57d8ff76 Internal flash settings for F1
Conflicts:
	flight/pios/stm32f10x/pios_flash_internal.c
2013-05-14 22:58:05 +02:00
sambas
da23fd6784 Added F1 internal flash driver
Conflicts:
	flight/pios/stm32f10x/pios_flash_internal.c

Conflicts:
	flight/pios/stm32f10x/pios_flash_internal.c
2013-05-14 22:56:12 +02:00
Alessio Morale
707e648457 OP-905: Fixes. Prevent LogFS from triggering watchdog 2013-05-14 18:43:39 +02:00
Richard Flay (Hyper)
ed68fbe68d OP-951: Adds -Wshadow to flight CFLAGS and fixes resulting compilation breakage.
+review OPReview
2013-05-14 07:01:45 +09:30
Oleg Semyonov
e5970ed25d logfs: fix unit tests (requires MIN declaration from pios_math.h) 2013-05-12 03:51:00 +03:00
Alessio Morale
30b755b7aa OP-901 fixed errors due to unused parameter and applied fix against fifo empty bug on usb_dcd_int.c 2013-05-11 23:49:52 +02:00
Alessio Morale
95a3e99b7c OP-901 updated STM32 USB OTG Driver (updated configuration) 2013-05-11 23:12:14 +02:00
Alessio Morale
24fcea168c OP-901 Updated STM32F4 USB Device Library 2013-05-11 23:12:13 +02:00
Alessio Morale
ccc24d844a OP-901 updated STM32 USB OTG Driver 2013-05-11 23:10:47 +02:00
lilvinz
1016b08b70 f4 usb: removed DCD_EP_Flush on endpoint TX
This has probably caused the problem that prevented tx after
a bus reconnection.
2013-05-11 22:41:05 +02:00
Stacey Sheldon
0d8fe83dca usb cdc: advertise support for line coding and serial state
The CDC descriptor was not advertising support the the line
coding and serial state messages.  This was preventing Mac
from sending the SetControlLineState message to indicate
that a DTE (ie terminal program) was present and reading
from the serial port.

We support (and depend on) the DTE indication now so this
was making CDC not work on Mac.

Linux seems to provide the indication regardless of whether
it is advertised in the descriptor or not.
2013-05-11 22:41:03 +02:00
Stacey Sheldon
0e0571149b f4 usb: ensure that we NAK on unused OUT endpoints
The ST USB code will automatically receive on any
endpoint that is opened but not in the NAK state.
Make sure we set OUT endpoints to NAK initially.

It also happily writes via a NULL pointer in ep->xfer_buff
which writes to address 0x0000_0000.  Since address
0x0 is aliased onto the internal flash by the BOOT0/1 pins
and the internal flash is (normally) in the LOCKED state,
this write puts the internal flash into an errored state.

This errored state means that writes to internal flash
are no longer allowed and all further writes fail.
2013-05-11 22:41:03 +02:00
Stacey Sheldon
2165a5afe1 f4 usb hid: handle SET_IDLE request
The code doesn't do anything useful with the SET_IDLE
but this helps to keep the wireshark USB traces clean
so that the real errors stand out better.
2013-05-11 22:41:02 +02:00
Stacey Sheldon
c22daec1b0 usb cdc: avoid need for ZLP by using tx buffers smaller than max
USB CDC uses BULK endpoints to send/receive data.  Typically,
a USB host will enqueue large buffers on its IN (device-to-host)
URBs.  These buffers are larger than the max packet size for the
bulk endpoint.

The USB standard requires that an IN transfer ends when one of
these is true:
 * a short packet (ie. less than max packet size) is sent by the
   device
 * a zero length packet (ZLP)
 * enough packets that the entire host buffer is filled

Our device implementation never sends ZLPs.  We sometimes send
packets that are exactly max-packet-size bytes long.  This would
result in partially filling a host buffer without signalling (via
ZLP) that the transmission had finished.  The host would then wait
until the next transfer had taken place before processing the first
data, thus delaying the first data.

This change simply forces all of our transfers to be short packets
and avoids the need to worry about zero length packets.  This is
at the cost of some efficiency on the host side since its large
buffers will only ever be partially filled.

Conflicts:
	flight/PiOS/STM32F30x/pios_usb_cdc.c
2013-05-11 22:41:01 +02:00
Stacey Sheldon
366c573bab f4 usb hid: send correct report ID in dummy report
The desired report ID is in the LSB of the wValue field,
not the MSB.  This will now send the correct report ID
back to the host.
2013-05-11 22:41:01 +02:00
Stacey Sheldon
232f9b2f8f f4 usb hid: use static data for dummy report Tx
This code was previously passing a pointer to stack
data into PIOS_USBHOOK_CtrlTx() which may be sending
this data asynchronously.  Now pass a pointer to
static data so that the asynchronous send doesn't
tx random stack contents.
2013-05-11 22:41:00 +02:00
Stacey Sheldon
859734af98 f4 usb: fix tracking of OUT requests with data stages
This code was mistakenly tracking the IN (device-to-host)
requests with data stages.  It should have been tracking
the OUT (host-to-device) requests with data stages.

This tracking data is important now that CDC is supported.
CDC actually uses OUT requests with data stages whereas HID
does not.  This bug only triggered once CDC was enabled.
2013-05-11 22:41:00 +02:00
Stacey Sheldon
b56f5206bd com/usart/cdc: ensure that device structs are memset before use
CDC and USART device drivers were not all clearing their
device structs before using them.

This specifically caused crashes in the case where the upper
COM layer was binding only a Tx path.  The Rx path callback
in the lower driver was uninitialized random data and would
result in the lower driver faulting when it tried to call the
callback.

Conflicts:
	flight/PiOS/STM32F30x/pios_usart.c
	flight/PiOS/STM32F30x/pios_usb_cdc.c
	flight/PiOS/STM32F30x/pios_usb_hid.c
2013-05-11 22:40:59 +02:00
Stacey Sheldon
e16be98224 usb cdc: ensure com buffer is drained when no DTE is attached
The CDC layer on F1, F3 and F4 now always acts like an
infinte data sink whenever *either* there is no DTE present
(ie. no terminal program listening) *or* the USB cable is
disconnected.

F1 and F4 were previously checking the cable but not the DTE.
F3 didn't check anything.  The COM layer didn't even ask the
lower layers.

All of this used to mean that any time a caller did a blocking
send to a CDC device without a DTE, it would eventually block
for up to a 5s timeout waiting for space in the Tx buffer.

Conflicts:
	flight/PiOS/STM32F30x/pios_usb_cdc.c
2013-05-11 22:40:58 +02:00
Stacey Sheldon
c702ca0f1b usbhook: fix up indentation
No functional changes.
2013-05-11 22:40:57 +02:00
Stacey Sheldon
cb6f4a474e f4 usb: ensure data buffers are 4-byte aligned
4-byte alignment is required for DMA.
2013-05-11 22:40:56 +02:00
Stacey Sheldon
f4bed187f4 f4 usb cdc: implement CDC class driver for STM32 F4 SoCs 2013-05-11 22:38:26 +02:00
Stacey Sheldon
19714d2316 f4 usb: allocate TX FIFO RAM for endpoints 2 and 3
This is required to support USB CDC mgmt and data
endpoints.
2013-05-11 22:38:25 +02:00
Stacey Sheldon
02addaf4a0 usbhook: make ctrl endpoint OUT treat request as const
The req parameter is passed to the OUT stage as a convenience.
Since the OUT callback is called *after* the transfer has occurred,
modifying the req would have absolutely no effect.  Marking this
as const makes this expectation clear.
2013-05-11 22:38:25 +02:00
Stacey Sheldon
590feefd9b f1 usb cdc: ensure uart state is transmitted on control endpoint
Previously, the IN stage on the CTRL interface would write (and
send) its data via the buffer owned by the DATA endpoint.  This
would probably have overwritten any data being sent at that
moment.  This may have caused data corruption from FC -> GCS.
2013-05-11 22:35:19 +02:00
Alessio Morale
511283c608 Flash internal: writes optimization using 4 bytes parallelism 2013-05-11 22:04:47 +02:00
Richard Flay (Hyper)
04f59d5910 OP-950: Adds "higher priority task woken" logic to SPI and SPI bus resident
sensor device drivers. Based partly on code contributed by lilvinz.

+review OPReview
2013-05-11 16:18:34 +09:30
Corvus Corax
b76df471ee bugfix on revo proto. STM32F4 A revision has a hardware bug and cannot do flash prefetching properly 2013-05-10 19:53:51 +02:00
Werner Backes
7c9d2ce9a5 Merge branch 'D-Lite/OP-934_rfm22b_rcvr_timeout_handling_next' into next 2013-05-10 09:59:30 +02:00
Richard Flay (Hyper)
cf14608ebe Merge branch 'next' into hyper/OP-936_task-monitor-rework 2013-05-09 19:25:02 +09:30
Stacey Sheldon
8ab50bca13 flashfs: use uintptr_t instead of uint32_t in flashfs API 2013-05-08 19:42:01 +02:00
Stacey Sheldon
99e61dd617 logfs: support multiple instances of logfs
Conflicts:
	flight/pios/common/pios_flashfs_logfs.c
	flight/pios/inc/pios_flashfs_logfs_priv.h
	flight/tests/logfs/pios.h
	flight/tests/logfs/pios_config.h
	flight/tests/logfs/unittest.cpp
2013-05-08 19:28:11 +02:00
Alessio Morale
93bad2e8c2 Merge branch 'amorale/OP-917_f4_bootloader_updater' into next
***** PLEASE NOTE  ***** From this revision all F4 based boards (Revolution/OSD) needs bootloader version  5 to boot properly

Conflicts:
	flight/pios/stm32f4xx/libraries/CMSIS2/Device/ST/STM32F4xx/Source/osd/system_stm32f4xx.c
	flight/targets/boards/osd/board-info.mk
	make/boot-defs.mk
	make/common-defs.mk
2013-05-07 21:02:41 +02:00
Werner Backes
938ed58918 Corrected timout calculation formula. 2013-05-06 14:20:53 +02:00
Werner Backes
bb87e6390e Update ppm_fresh if we receive a new PPM packet in order to keep the
rfm22b receiver supervisor happy.
2013-05-06 12:00:58 +02:00
Richard Flay (Hyper)
fbc8bc698f OP-936: Merges branch 'next' into hyper/OP-936_task-monitor-rework, fixes damage/conflicts,
and brings the callback scheduler into the fold.

+review OPReview-461
2013-05-06 19:11:14 +09:30
Werner Backes
0005d643ca Merge branch 'D-Lite/OP-934_rfm22b_rcvr_timeout_handling' into D-Lite/OP-934_rfm22b_rcvr_timeout_handling_next 2013-05-06 08:23:22 +02:00
Brian Webb
ae8286e99a OP-932: Fixes a bug that was preventing setting of Tx power on remote modem. 2013-05-06 01:03:15 +01:00
Richard Flay (Hyper)
a2d8544931 OP-931: adds -Wextra compiler option for the flight code, and makes the bazillion code changes required
to make the flight code compile again. Needs careful review, particularly all the fixes for the
signed vs unsigned comparisons.

+review OPReview-459
2013-05-05 16:32:24 +09:30
Brian Webb
dc4455ff68 OP-932: Fixes a bug that was preventing setting of Tx power on remote modem. 2013-05-04 17:24:40 +01:00
Brian Webb
57552f4cc9 OP-932: Changed the clock syncronization to happen only on packts transmitted from the coordinator to the remote modem. The Tx finished time of the previous packet is now sent in the packet header. This is compared to the Rx complete time of that packet on the remote modem to calcualte the difference between two modems. This eliminates the need for ACKing, so ACKs were removed for PPM and status packet. 2013-05-04 16:50:08 +01:00
Richard Flay (Hyper)
87fcf9fa8b Merge branch 'next' into hyper/OP-931_extra_compiler_warnings and update as necessary.
Hopefully properly fixes conflicts:
	flight/modules/Attitude/attitude.c
	flight/modules/ManualControl/manualcontrol.c
	flight/modules/Osd/WavPlayer/wavplayer.c
	flight/modules/Osd/osdgen/osdgen.c
	flight/modules/System/systemmod.c
	ground/uavobjgenerator/generators/flight/uavobjectgeneratorflight.cpp
2013-05-04 11:12:44 +09:30
Brian Webb
33cb06b1b0 Merge branch 'next' of ssh://git.openpilot.org/OpenPilot into OP-932-Modularize_Radio_Driver 2013-05-04 01:30:01 +01:00
Oleg Semyonov
137ddbf73a Fix broken unit tests 2013-05-03 20:27:03 +02:00
Oleg Semyonov
7aa59f4573 pios.h: only include STM32xxx.h if particular STM32 MCU is defined 2013-05-03 20:25:48 +02:00
Brian Webb
12e8adbdc4 OP-932: Fixes vitual com port and (not tested) raw comms over a UART on the OPLink. 2013-05-03 14:46:01 +01:00