Commit Graph

45 Commits

Author SHA1 Message Date
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
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
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
Andy Piper 401e5c2073 AP_HAL_ChibiOS: add support for bidir DShot support in RCOutput
add support for sampling GPIO pins using timer
don't restart pwm group when not doing bi-dir
fix hwdef generation preproc for TIM DMA
decode telemetry at the start of the dshot cycle
calculate dshot pulse separation correctly and ensure we output rapidly enough
calculate dshot min periods and timeouts correctly
refactor dshot_send() into dshot_send_groups()
use bi-dir dshot channel mask
selectively enable bi-dir RC Channels
process bi-dir mask correctly when allocating DMA channels
allow UP and CH DMA channel sharing
optionally enable bidir vars in hwdef.

enable bi-dir dshot in KakuteF7Mini
enable bi-dir dshot in OmnibusF4Pro
enable bi-dir dshot in OmnibusNanoV6
enable bi-dir dshot in MatekF405
enable bi-dir dshot in fmuv5
enable bi-dir dshot in fmuv3
enable bi-dir dshot in OmnibusF7V2
enable bi-dir dshot in OmnibusNanoV6
enable bi-dir dshot in CubeOrange
enable bi-dir dshot in Pixracer
enable bi-dir dshot in mRoPixracerPro

Co-authored-by: bugobliterator <siddharthbharatpurohit@gmail.com>
2020-12-30 19:14:16 +11:00
Peter Hall fe5779fd88 AP_HAL_ChibiOS: add support for ProfiLEDs 2020-03-10 10:37:26 +11:00
Andrew Tridgell 669b98c6df HAL_ChibiOS: allow more than 32 WS2812 LEDs on a pin 2020-02-27 13:12:26 +11:00
Peter Hall 0ca6b7cf77 AP_HAL_ChibiOS: retry neopixel until successful send 2020-02-25 11:15:55 +11:00
Andrew Tridgell adf17414e0 HAL_ChibiOS: fixed output string for non-DMA capable chan
this fixes a problem where the user requests DShot (which rquired DMA)
on an output channel which cannot allocate a DMA channel. We end up
sending normal PWM, so the string representation of the output modes
should reflect that
2020-02-12 14:08:40 +11:00
Randy Mackay a71ae54d3a AP_HAL: add RCOutput::get_output_mode_banner 2020-02-04 12:23:33 +11:00
Andrew Tridgell 4636a4c458 HAL_ChibiOS: support LEDs with a wider range of frequencies
this fixed LEDs on FMUv5 boards on first 4 aux channels. We need to
round up not round down in the resulting bitrate
2019-11-18 15:54:36 -08:00
Mirko Denecke b84dcd483d AP_HAL_ChibiOS: remove unnecessary tabs and whitespaces 2019-10-21 08:01:56 +11:00
Andrew Tridgell 03c1a8bfd9 HAL_ChibiOS: use safety button logic from AP_BoardConfig 2019-09-10 16:22:33 +10:00
Andrew Tridgell f441223b55 HAL_ChibiOS: implement updated NeoPixel API
allow for N leds per chain, and setting separate colours per led in
each chain
2019-09-10 13:03:28 +10:00
Tom Pittenger e3416b66dc AP_HAL_ChibiOS: add Neopixel output type, similar to dshot 2019-09-10 13:03:28 +10:00
Andrew Tridgell 8dd58b4181 HAL_ChibiOS: support reversible DShot motors 2018-11-16 08:33:35 +11:00
Peter Barker 17f643719a AP_HAL_ChibiOS: add override keyword in many places 2018-11-08 11:30:12 +11:00
Andrew Tridgell 81fe8b7138 HAL_ChibiOS: allow set of safety mask from IOMCU 2018-11-07 07:35:45 +11:00
Siddharth Purohit 87a2dea9d4 HAL_ChibiOS: disable features that require advanced dma 2018-09-19 12:14:15 +10:00
Andrew Tridgell 8c33b4b97d HAL_ChibiOS: implement set_failsafe_pwm() 2018-09-13 08:15:02 +10:00
Andrew Tridgell 3df2a1c228 HAL_ChibiOS: fixed dshot bad frames
adding a pre-bit on the DMAR, and ensuring that all groups are setup
for DMA together fixes the remaining bad frames reports in BLHeli32
2018-08-04 19:29:13 +10:00
Andrew Tridgell 946b4db0e6 HAL_ChibiOS: set min dshot separation to 100usec
this fixes a problem with BLHeli32 not recognising dshot
2018-08-04 19:29:13 +10:00
Andrew Tridgell 22ba9a0aea HAL_ChibiOS: fixed timeout of serial read bytes
this allows for fast timeout of serial read bytes in BLHeli pass-thru
2018-08-04 19:29:13 +10:00
Andrew Tridgell 7e897c16c0 HAL_ChibiOS: maintain rcout state beyond BRD_PWM_COUNT
allow channels beyond BRD_PWM_COUNT to be sent over SBUS or DShot
distribution
2018-05-26 12:08:54 +10:00
Andrew Tridgell 794ebe32e3 HAL_ChibiOS: fixed mixture of oneshot and normal PWM on IOMCU 2018-05-12 07:28:05 +10:00
Andrew Tridgell bb0cbd15a4 HAL_ChibiOS: implement fmuv4 safety state
and added safety_mask and safety_pwm support for both fmuv3 and fmuv4
2018-04-17 10:14:01 +10:00
Andrew Tridgell 4871bbf403 HAL_ChibiOS: make soft serial for RC serial more efficient
using system ticks halves the IRQ time
2018-04-16 07:40:55 +10:00
Andrew Tridgell 71cd58cc7e HAL_ChibiOS: run rc serial thread at top priority
this maximises reliability for serial IO to ESCs, increasing flashing
reliability
2018-04-07 09:10:29 +10:00
Andrew Tridgell 3cd4f2a002 AP_ChibiOS: handle oneshot125 separately
this sets up oneshot125 with the full 1000 steps of throttle
resolution, using a 8MHz clock. This matches the behaviour of modern
ESCs that measure PWM values with high accuracy
2018-04-07 09:10:29 +10:00
Andrew Tridgell 8e59f6aad6 HAL_ChibiOS: implement get_esc_scaling() 2018-04-07 09:10:29 +10:00
Andrew Tridgell 6fd0af11ef HAL_ChibiOS: implement telem request API 2018-04-07 09:10:29 +10:00
Andrew Tridgell 6bdb523630 HAL_ChibiOS: guarantee 1kHz output for DShot 2018-04-07 09:10:29 +10:00
Andrew Tridgell 382772d999 HAL_ChibiOS: initial support for ESC serial output 2018-04-07 09:10:29 +10:00
Andrew Tridgell 26d279e165 HAL_ChibiOS: improve DShot timing accuracy 2018-04-07 09:10:29 +10:00
Andrew Tridgell bc32276966 HAL_ChibiOS: support DShot output
use DMAR burst DMA to minimise number of DMA channels needed

thanks to betaflight for the great reference implementation!
2018-04-07 09:10:29 +10:00
Andrew Tridgell 306d35655e HAL_ChibiOS: allow for bare board builds
this allows for a build with no UARTs, no SPI, no I2C, no PWM. Great
for initial board bringup with just USB
2018-03-02 12:52:50 +11:00
Andrew Tridgell 0cf104f2f3 HAL_ChibiOS: added scale_esc_to_unity()
needed for per-motor compass cal
2018-03-02 12:52:50 +11:00
Andrew Tridgell 7c23e33775 HAL_Chibios: set min output rate for oneshot to 100Hz
this will keep ESCs happy during gyro cal
2018-01-20 17:40:07 +11:00
Andrew Tridgell 880a84294e HAL_ChibiOS: support oneshot mode
supports oneshot 125 and oneshot
2018-01-20 17:40:07 +11:00
Andrew Tridgell f14a847b97 HAL_ChibiOS: rename classes to remove 'Chibi'
it is redundent as all classes are in ChibiOS namespace, and makes the
code harder to read
2018-01-15 11:46:02 +11:00
Andrew Tridgell 25b68dc150 HAL_ChibiOS: switch base freq when needed
timers can't do below 123 Hz with a clock of 8MHz, so we need to
change clock frequency based on the target period
2018-01-15 11:46:02 +11:00
Andrew Tridgell d17e9f321a HAL_ChibOS: fixed mixture of brushed and normal PWM
allow non-brushed PWM servos with brushed main motors
2018-01-15 11:46:02 +11:00
Andrew Tridgell c639708e22 HAL_ChibOS: auto-generate full PWM config
use PWM markers in hwdef.dat to mark each PWM channel
2018-01-15 11:46:02 +11:00
Andrew Tridgell 3a004adbd4 HAL_Chibios: use macro for NUM_GROUPS 2018-01-15 11:46:02 +11:00
Andrew Tridgell 26d6947bf6 HAL_ChibiOS: fixed PWM output 2018-01-15 11:46:02 +11:00
Andrew Tridgell 8b6bab7b17 HAL_Chibios: added ChibiOS HAL
this is based on initial work by Sid, reset here for easier merging
2018-01-15 11:46:02 +11:00