Commit Graph

1658 Commits

Author SHA1 Message Date
Andrew Tridgell ca948171fe HAL_ChibiOS: fixed ADC error on revXY STM32H7 boards
with the new ChibiOS revision we were configuring for newer revisions
of the H7, which meant that we changed the ADC config. This broke ADC
readings on revX and revY H7 MCUs.

This PR fixes it in two ways:

 1) change ChibiOS config to assume XY config chips

 2) use 16 bit ADC for H7, which means the chip rev doesn't matter,
    and also gives us 16x the resolution for ADC readinga, so we can
    read smaller voltage and current values
2021-04-05 11:01:03 +10:00
willpiper 94bdca7f6f AP_HAL_ChibiOS: tidy up beastF7 DMA channels 2021-04-04 16:51:19 +10:00
Andrew Tridgell f0d6b79e8a HAL_ChibiOS: fixed skyviper builds with BMM150 2021-03-30 13:31:50 +09:00
Peter Barker cfacb5d34d AP_HAL_ChibiOS: split out a calculate_thread_priority method 2021-03-30 10:49:06 +11:00
Iampete1 7c96522e44 AP_HAL_ChibiOS: add semaphore to AnalogIn::channel to make it thread safe 2021-03-30 10:44:43 +11:00
Andrew Tridgell 07313ae71d HAL_ChibiOS: fixed 2nd CAN inferface on F4/F7
CAN1_TX_IRQn is an enum not a defined. This was broken by the recent
change to support different CAN ordering
2021-03-29 20:14:29 +11:00
Andrew Tridgell 88e277420f AP_HAL_ChibiOS: removed assert calls
these waste flash space and do not do us any good
2021-03-25 14:03:40 +11:00
Andrew Tridgell 2d4dfe8a2a HAL_ChibiOS: fixed (unused) FF_FS_TIMEOUT
this change was harmless as we don't define FF_FS_REENTRANT
2021-03-23 12:01:20 +11:00
Andrew Tridgell ffb2876f58 HAL_ChibiOS: disable unused ChibiOS features 2021-03-23 12:01:20 +11:00
Andrew Tridgell 744a2fe535 HAL_ChibiOS: use uint32_t for bit timing in passthru
we should not use systime_t as it may be 16 bit
2021-03-23 12:01:20 +11:00
Andrew Tridgell c3d16cf2e2 HAL_ChibiOS: use defines for G4 messageram
review fix
2021-03-23 12:01:20 +11:00
Andrew Tridgell b4e4d48e52 HAL_ChibiOS: switch OMNIBUSF7V2 timer for RCIN
this avoids a conflict with shared interrupt on TIM1
2021-03-23 12:01:20 +11:00
Andrew Tridgell ff31e10d9e HAL_ChibiOS: ensure that RCIN DMA channel is not shared
RCIN DMA cannot be shared as it runs all the time
2021-03-23 12:01:20 +11:00
Andrew Tridgell 2842730868 HAL_ChibiOS: fixed F3 CAN build 2021-03-23 12:01:20 +11:00
Andrew Tridgell 2fc7ea1a8b HAL_ChibiOS: added G4-ESC hwdef 2021-03-23 12:01:20 +11:00
Andrew Tridgell 353eca79b6 HAL_ChibiOS: fixed 32/64 micros bug in CAN select() 2021-03-23 12:01:20 +11:00
Andrew Tridgell bac9b27a3f HAL_ChibiOS: enable analogin on G4 2021-03-23 12:01:20 +11:00
Andrew Tridgell ac9e6ba86d HAL_ChibiOS: fix label for CCM on G4 2021-03-23 12:01:20 +11:00
Andrew Tridgell 7496b8bff5 HAL_ChibiOS: fixed DMAR register offset
use offsetof() instead of a magic value
2021-03-23 12:01:20 +11:00
Andrew Tridgell 4f10565f82 HAL_ChibiOS: fixed CANFD build on H7 2021-03-23 12:01:20 +11:00
Andrew Tridgell f2ac61f6ba HAL_ChibiOS: enable DShot on G4 2021-03-23 12:01:20 +11:00
Andrew Tridgell f57b1b9c4b HAL_ChibiOS: support logical/physical CAN bus mapping
allow for first CAN interface to be CAN2 or CAN3
2021-03-23 12:01:20 +11:00
Andrew Tridgell 2f7ff778be HAL_ChibiOS: fixed bug in DMA resolver
idsets can be empty for a peripheral
2021-03-23 12:01:20 +11:00
Andrew Tridgell 439a944801 HAL_ChibiOS: added support for STM32G474 MCU 2021-03-23 12:01:20 +11:00
Andy Piper e1d71486e4 AP_HAL_ChibiOS: build fixes for ChibiOS 20.3.x 2021-03-23 12:01:20 +11:00
Andrew Tridgell 5b59445471 AP_HAL_ChibiOS: fixes for build with 20.3.x ChibiOS 2021-03-23 12:01:20 +11:00
QioTek fe30612bb0 AP_HAL_ChibiOS: release ICM20649 reserve sensor
BMI055 & BMI088 out of stock, release ICM20649 reserve sensor
2021-03-22 19:05:03 +11:00
Andrew Tridgell bbd32844d1 HAL_ChibiOS: switch more boards to 32k FRAM
this enables the parameter backup/restore on those boards, as well as
more waypoints

This is in response to a report that CUAVv5 boards can suffer from the
parameter reset issue
2021-03-21 11:59:12 +11:00
Andy Piper bb270014e7 AP_HAL_ChibiOS: make sure LEDs get a DMA channel on MatekH743-bdshot 2021-03-17 18:28:01 +11:00
Andy Piper 968d05a637 AP_HAL_ChibiOS: allow further LED channels to be allocated at the same length 2021-03-17 18:24:11 +11:00
Andrew Tridgell 8a8db85b9c HAL_ChibiOS: fixed build of f103-trigger fw 2021-03-16 18:28:58 +11:00
Lava Chemist 4a52f945db AP_HAL_ChibiOS: Add FlywooF745 2021-03-16 11:27:23 +11:00
Andy Piper d6575fb6ad AP_HAL_ChibiOS: bdshot configs for CubeYellow and mRoControlZeroH7 2021-03-03 18:02:26 +11:00
Andrew Tridgell 4fbdb59398 HAL_ChibiOS: prevent sharing the same DMA stream on TIMn_UP channels
this avoids an issue with DShot where we run the same DMA stream on
two timers at once
2021-03-02 11:58:38 +11:00
Andy Piper 6cb263056d AP_HAL_ChibiOS: build fix for iomcu 2021-03-02 11:58:38 +11:00
Andy Piper d0e4d510cf AP_HAL_ChibiOS: order PWM timers by DMA UP stream id to prevent deadlocks in dshot 2021-03-02 11:58:38 +11:00
Andrew Tridgell 14791c335b HAL_ChibiOS: fixed build of f3 boards without PWM out 2021-02-24 18:25:02 +11:00
Andrew Tridgell 243cf2199d HAL_ChibiOS: disable shared DMA on IOMCU
this saves about 600 bytes of ram
2021-02-24 18:21:08 +11:00
Andrew Tridgell c23f61b79a HAL_ChibiOS: set internal error on panic 2021-02-24 18:18:37 +11:00
Andrew Tridgell eec05c1f48 HAL_ChibiOS: fixed a race and null ptr deref in dshot
if a dshot is cancelled then the waiter can be nullptr
2021-02-24 15:39:10 +11:00
Andy Piper b102391163 AP_HAL_ChibiOS: don't send rcout events without rcout thread 2021-02-24 08:55:12 +11:00
Mirko Denecke edc2b0c94e AP_HAL_ChibiOS: fix copy and paste typo 2021-02-23 08:15:50 +09:00
Andrew Tridgell 7af20e9ea3 HAL_ChibiOS: increase H7 serial buffer sizes
this takes better advantage of the new UART code. Log download over
USB gets to 730 kbyte/s. For comparison, with the 4.0 code on the same
H7 we get about 300 kbyte/s
2021-02-20 20:49:45 +11:00
Andrew Tridgell 3b88a3273b HAL_ChibiOS: adjust up uart tx stack size
lowest was showing 80 bytes free, which is too close to the 64 byte
level where we trigger an internal error
2021-02-20 14:37:11 +11:00
Andrew Tridgell 5e0f175223 HAL_ChibiOS: adjust UART buffer sizes for new UART code
this gains about 20k of RAM, and has almost no impact on log download
speed at 921600 on a F427. The improved threading means we can afford
to have smaller buffers
2021-02-20 14:37:11 +11:00
Andy Piper 4e61ba2dc8 AP_HAL_ChibiOS: reduce stack sizes for rcout, uart_rx and storage. 2021-02-20 14:37:11 +11:00
Andy Piper 94de238751 AP_HAL_ChibiOS: disable RCOUT thread on iomcu and rebuild iomcu. 2021-02-20 14:37:11 +11:00
Andy Piper f9c5f9be00 AP_HAL_ChibiOS: make dshot DMA unlock event driven in order to allow unlocking from rcout thread
refactor rcout into separate thread and process all dshot requests there
move uart DMA completion to event model
process dshot locks in strick reverse order when unlocking
convert Shared_DMA to use mutexes
move UART transmit to a thread-per-uart
do blocking UART DMA transactions
do blocking dshot DMA transactions
trim stack sizes
cancel dma transactions on dshot when timeout occurs
support contention stats on blocking locking
move thread supression into chibios_hwdef.py
invalidate DMA bounce buffer correctly
separate UART initialisation into two halves
cleanup UART transaction timeouts
add @SYS/uarts.txt
move half-duplex handling to TX thread
correct thread statistics after use of ExpandingString
set unbuffered TX thread priority owner + 1
correctly unlock serial_led_send()
don't share IMU RX on KakuteF7Mini
observe dshot pulse time more accurately.
set TRBUFF bit for UART DMA transfers
deal with UART DMA timeouts correctly
don't deadlock on reverse ordered DMA locks
change PORT_INT_REQUIRED_STACK to 128
2021-02-20 14:37:11 +11:00
mateksys 7eb4e9b370 AP_Periph: set PORT defaults for F405-MatekGPS 2021-02-18 11:51:50 +11:00
mateksys 97c2b7228e AP_Periph: Matek F303 and F405 AP_Periph use DSP310 baro 2021-02-18 11:51:50 +11:00
Andy Piper 4c2cbdab8d AP_HAL_ChibiOS: only setup half-duplex for receive when transmit is fully over 2021-02-17 20:09:48 +11:00
Andy Piper 5c32007cdf AP_HAL_ChibiOS: ensure stop bits can be set before UART begin 2021-02-17 20:09:48 +11:00
Andy Piper 3a9107245c AP_HAL_ChibiOS: allocate DMA and LED buffers correctly when the length changes
calculate DMAR pulse times correctly
ensure 50us pulse separation for LED
make sure the LEDs are signalled for output
only allow LED length to be set once
2021-02-17 18:36:36 +11:00
Michael du Breuil c0da87c066 AP_HAL_ChibiOS: Update HitecMosaic to reflect changes to GPS config 2021-02-15 16:31:45 -07:00
Andrew Tridgell 9de1519928 HAL_ChibiOS: prevent hw flow control from hogging a DMA channel
When hw flow control is enabled check the CTS pin before we grab the
DMA channel to prevent a long timeout trying to send to a blocked port
from holding a DMA channel against another device

this fixes issue #16587
2021-02-15 07:23:56 +11:00
Andrew Tridgell 0cc4409845 HAL_ChibiOS: fixed handling of invalid channel for LED write
this prevents a null ptr dereference when an invalid channel (such as
one on IOMCU) is used for LEDs
2021-02-13 15:11:10 +11:00
Andrew Tridgell 098a17fe2e HAL_ChibiOS: fixed CubeOrange ADSB param name 2021-02-13 13:06:20 +11:00
Andy Piper 20d8696a0a AP_HAL_ChibiOS: BeastH7 has DPS310 baro 2021-02-10 18:33:59 +11:00
Andrew Tridgell 814393c9c2 HAL_ChibiOS: switch from DPS280 to DPS310 in boards that use the DPS310 2021-02-09 11:37:07 +11:00
Andrew Tridgell 86fda93781 HAL_ChibiOS: added heater correction of AK09916
this fixes a problem with the internal compass being impacted by the
magnetic field from the heater
2021-02-09 11:32:19 +11:00
Andrew Tridgell 2ab8ad0ef0 HAL_ChibiOS: added Durandal pinout details 2021-02-09 07:14:02 +11:00
Michael du Breuil 623951a262 AP_HAL_ChibiOS: Add some extra GPS SBF config 2021-02-05 11:52:29 -07:00
Tom Pittenger d1e6b0befb AP_HAL_ChibiOS: Add ADC1 support to STM32F3
This is useful for AP_Periph battery monitoring
2021-02-04 16:30:38 -08:00
Andrew Tridgell b8e82a56f3 HAL_ChibiOS: don't start rout ticks till after full system init
this prevents an occasional boot hang on systems with DShot
enabled. We shouldn't be starting DShot output till after setup() is
complete as the outputs are still being configured
2021-02-05 07:17:57 +11:00
Andy Piper 2cdc202d19 AP_HAL_ChibiOS: use non-cachable SRAM3 for DMA on H743
Adjust SRAM1+SRAM2 to 256k as describe in the H743 reference manual
Provide access to mem_info() information

Co-authored-by: Andrew Tridgell <andrew@tridgell.net>
2021-02-03 23:35:44 +11:00
Andy Piper 06a1500f98 AP_HAL_ChibiOS: ensure GPIO pins get undef'ed properly
minimise bi-directional dshot configs for:

CubeOrange
Durandal
MatekF405
MatekH743
OmnibusNanoV6
Pixracer
mRoPixracerPro
omnibusf4pro
CUAV-X7
2021-02-03 18:49:06 +11:00
Michel Pastor 41f7587637 ChibiOS: Add SWD pins to SuccexF4 bootloader 2021-02-03 18:37:46 +11:00
auturgy 24268cc6de AP_HAL_ChibiOS: add MatekH743-periph hwdef 2021-02-03 18:17:44 +11:00
mateksys b91c65b4a4 AP_HAL_ChibiOS: add f405-MatekGPS & MatekF405-CAN hwdef 2021-02-03 18:09:35 +11:00
huhen 9ba35580db HAL_ChibiOS: Init kakutef7 motor pins for correct initialization of some ESCs 2021-02-03 13:13:32 +11:00
Andy Piper 6f5d5c2bf9 AAP_HAL_ChibiOS: allow asserts to be printed on a GPIO pin 2021-01-27 19:36:58 +11:00
Andy Piper d41c92d317 AP_HAL_ChibiOS: don't overwrite fault handler data, register forced faults 2021-01-27 19:13:18 +11:00
Andy Piper 20d928a86a AP_HAL_ChibiOS: don't share DMA on OmnibusNanoV6 for Flash SPI 2021-01-27 19:04:49 +11:00
Andy Piper 873d35acd9 AP_HAL_ChibiOS: bi-directional dshot for MatekH743 2021-01-27 18:58:38 +11:00
Andy Piper 877dde4736 AP_HAL_ChibiOS: on BeastF7 share TIM3 UP/CH and give flash SPI dedicated channel 2021-01-27 18:54:43 +11:00
Andy Piper 9249b73e8b AP_HAL_ChibiOS: correctly allow mixing of bidir and non-bidir channels 2021-01-27 18:49:15 +11:00
Andy Piper 2823fa7245 AP_HAL_ChibiOS: never write bytes that have not been erased on H7
Be more careful about flash failure conditions on H7
2021-01-27 18:30:36 +11:00
Andy Piper 78735a946e AP_HAL_ChibiOS: allow STM32_FLASH_DISABLE_ISR for H7 2021-01-27 18:30:36 +11:00
Andrew Tridgell 155de6d2bc HAL_ChibiOS: fixed build of AP_Periph on H7 2021-01-27 18:24:03 +11:00
Andrew Tridgell 9861a02c60 HAL_ChibiOS: save INS_ACC*ID persistent parameters
this enables full factory accelerometer calibration, so the user is
not required to run an accelcal, even if they change vehicle type
2021-01-27 09:49:35 +11:00
Andrew Tridgell 5ed19c764e HAL_ChibiOS: expose load_persistent_params for @SYS 2021-01-21 13:09:21 +11:00
Andrew Tridgell 5c823debc0 HAL_ChibiOS: support saving persistent parameters to bootloader sector
when we flash the bootloader we can save key peristent parameters to
the end of the bootloader sector, allowing them to persistent across
changes of firmware type

This allows for factory temperature calibration
2021-01-21 13:09:21 +11:00
Andrew Tridgell d81c2ee407 HAL_ChibiOS: allow for some embedded parameters on AP_Periph builds 2021-01-21 06:19:46 +11:00
bugobliterator 8b90eb23e0 AP_HAL_ChibiOS: distcc doesn't like lst generation commands 2021-01-20 19:21:14 +11:00
Andy Piper 2fadcf6ba0 AP_HAL_ChibiOS: handle UP/CH channel sharing on H7 correctly 2021-01-20 18:15:17 +11:00
Andy Piper 9e641a32ad AP_HAL_ChibiOS: don't share flash SPI on BeastH7 and compile with -Os 2021-01-20 18:12:57 +11:00
Andy Piper 2b885cd79f AP_HAL_ChibiOS: ensure that serial LED setup goes via an intermediate buffer
protect serial LED buffer transfers with mutex
protect serial LED buffer size with mutex
prevent serial LED interactions before rcout is ready
allocate a serial led buffer per channel that needs it
setup clock mask when needed
2021-01-20 18:10:18 +11:00
bugobliterator c02c546077 AP_HAL_ChibiOS: add support for inline comments in hwdef.dat 2021-01-18 09:37:11 +11:00
bugobliterator 41693403e2 AP_HAL_ChibiOS: retain memory of past conflicts in dma_resolver 2021-01-18 09:37:11 +11:00
Andrew Tridgell f93e2f6717 HAL_ChibiOS: enable 32k FRAM on H7 boards 2021-01-16 06:47:10 +11:00
pkocmoud 7b61a4d8c2 HAL_ChibiOS: support F7 with no crystal 2021-01-15 15:48:01 +11:00
Andy Piper cb5be4fcc1 AP_HAL_ChibiOS: don't share IMU DMA on MatekH743 to avoid SPI DMA contention 2021-01-15 14:32:39 +11:00
Andy Piper e781572d53 AP_HAL_ChibiOS: support iFlight BeastF7
reduce DMA contention on BeastH7 and correct sharing
add README's for BeastF7 and BeastH7
2021-01-13 18:09:33 +11:00
Andy Piper fdbf2d369a AP_HAL_ChibiOS: do not take bi-dir path when in serial DMA 2021-01-13 18:03:41 +11:00
bugobliterator 4346264113 AP_HAL_ChibiOS: ensure UP and CH timer channels share DMA for H7 2021-01-12 10:45:03 +11:00
Andy Piper e9ea360a99 AP_HAL_ChibiOS: don't timeout after 11 bits on serial irqs 2021-01-12 09:58:58 +11:00
Andrew Tridgell 14433c3ae3 HAL_ChibiOS: enable ICM-40609 on mRoNexus 2021-01-11 14:43:35 +11:00
Andrew Tridgell afbdd69165 AP_HAL_ChibiOS: adjust stack sizes 2021-01-10 08:28:55 +11:00
Andy Piper 8fb403c569 AP_HAL_ChibiOS: make sure BDMA channels are not adjacent 2021-01-10 08:11:37 +11:00
Andrew Tridgell 42bc9adfb7 HAL_ChibiOS: use ExpandingString for @SYS buffers 2021-01-05 10:52:00 +11:00