Commit Graph

98 Commits

Author SHA1 Message Date
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 7496b8bff5 HAL_ChibiOS: fixed DMAR register offset
use offsetof() instead of a magic value
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 5b59445471 AP_HAL_ChibiOS: fixes for build with 20.3.x ChibiOS 2021-03-23 12:01:20 +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 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 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
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
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
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 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 fdbf2d369a AP_HAL_ChibiOS: do not take bi-dir path when in serial DMA 2021-01-13 18:03:41 +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 6f4bfed82d HAL_ChibiOS: fixed build with alarm and no PWM channels
this fixes a build error due to conditional always being false when
NUM_GROUPS==0 by using a C++ iterator. It also makes the code neater
2021-01-04 09:04:06 +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 a0fe1a7598 HAL_ChibiOS: produce more accurate clocks for DShot and PWM 2020-02-12 18:12:39 +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 77bf67e15f HAL_ChibiOS: fixed padding of neopixel bits
lack of padding at start caused occasional glitches in colors
displayed
2019-10-10 10:41:19 +11:00
Mark Whitehorn d8a07b6c44 HAL_ChibiOS: fix FMU fast_channel_mask
fix IO fast channel mask
use IOMCU chmask to only set right channels
remove unused variable
2019-10-01 07:13:33 +10:00
Andrew Tridgell 386e7dc3e8 HAL_ChibiOS: fixed delay for OneShot125 channels
we were delaying output for OneShot125 by 8x as much as we need to,
which reduced our max loop rate
2019-09-22 19:43:35 +10: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 d1565a96c5 HAL_ChibiOS: wrap cacheBuffer functions
needed to avoid problem with end() method in UARTDriver shadowing with
F7 implementation of cache macros
2019-08-27 15:40:43 +10:00
Andrew Tridgell dbfe6b8019 HAL_ChibiOS: implement persistent_data for watchdog
this is a much simpler approach to persistent data
2019-05-15 15:33:48 +10:00
Andrew Tridgell 1acb7e977f HAL_ChibiOS: added ability to restore safety state on watchdog reset 2019-04-22 16:53:35 +10:00
Andrew Tridgell 94abc5a54d HAL_ChibiOS: fixed DShot on H7 2019-02-26 16:18:26 +11:00
Andrew Tridgell 231117e9b1 HAL_ChibiOS: invalidate before read on rx, not on DMA setup
more efficient, as we only invalidate what was used
2019-02-26 16:18:26 +11:00
Andrew Tridgell 071d5e01af HAL_ChibiOS: added DMAMUX channel assignment calls 2019-02-26 16:18:26 +11:00
Andrew Tridgell f4e31ce65b HAL_ChibiOS: added more cache flush ops 2019-02-26 16:18:26 +11:00
Andrew Tridgell d96142a37e HAL_ChibiOS: allow double allocate call in RCOutput 2019-02-26 16:18:26 +11:00
Andrew Tridgell bbd25350eb HAL_ChibiOS: support ChibiOS kernel major 6
preparing for STM32H7 support
2019-02-26 16:18:26 +11:00
Tom Pittenger 548a579f18 AP_HAL_ChibiOS: unify singleton naming to _singleton and get_singleton() 2019-02-10 19:09:58 -07:00
Andrew Tridgell 50683633b3 HAL_ChibiOS: setup for brushed feature in IOMCU 2018-11-30 13:14:14 +11:00
Andrew Tridgell 8dd58b4181 HAL_ChibiOS: support reversible DShot motors 2018-11-16 08:33:35 +11:00
Randy Mackay c1ab3afb6c AP_HAL_ChibiOS: fix safety switch option handling 2018-10-04 16:13:24 +10:00
Andrew Tridgell 8c391291a3 HAL_ChibiOS: fixed a race in DShot code
this fixes a problem found by Daniel Met with the copter 3.6 beta
release
2018-10-03 15:28:07 +10: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
Peter Barker 2209e4a697 AP_HAL_ChibiOS: new HAL functor-based methods
AP_HAL_ChibiOS: adjust for irq-type enumeration change

AP_HAL_ChibiOS: implement attach-AP_HAL::Proc to interrupt interface
2018-08-21 20:34:01 +09: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