Commit Graph

179 Commits

Author SHA1 Message Date
Andy Piper 990318193b AP_IOMCU: allow building without BLHeli support 2024-03-18 14:12:25 +11:00
Andrew Tridgell 5fb71e945c AP_IOMCU: fixed check for BLHeli support 2024-03-18 14:12:25 +11:00
Peter Barker 14beb2f191 AP_IOMCU: allow compilation with HAL_LOGGING_ENABLED false 2024-01-17 18:25:55 +11:00
Thomas Watson d554ade7ce AP_IOMCU: match thread stack pointer types to ChibiOS
`__main_thread_stack_base__` and `__main_thread_stack_end__` are
variables whose address is defined to be the corresponding part of the
stack. These are declared as `extern stkalign_t` in ChibiOS code, and
being declared as `extern uint32_t` in ArduPilot code creates a warning
at link time when using LTO. Correct the declaration to eliminate this
warning.

Also update `__main_stack_base__` and `__main_stack_end__` which don't
currently trigger this warning but serve similar purposes and so might
in the future.

The hardware expects an alignment of `stkalign_t` (which is 8 bytes) and
the linker script defines the variable values with this alignment as
well, so this is safe.

No code size or functional change.
2024-01-16 09:24:34 +11:00
Andy Piper 57ac86edd9 AP_IOMCU: fix occasional startup internal errors with mixing
allow DIRECT_PWM pages to be smaller than max channels
correct some over-eager register clearing in the global interrupt handler (NFC)
only sent TX events when using shared DMA (NFC)
zero out rx packet code and size to prevent errors with spurious callbacks
add a comment and check for offsets that are codes
2023-12-24 14:39:05 +11:00
Andy Piper 1fb6205439 AP_IOMCU: always run iofirmware loop at 1Khz to avoid uart races
don't look for multiple pages on single-page packets
2023-12-18 19:02:52 +11:00
Andy Piper 5d9f9db2fe AP_IOMCU: treat register_write() as a successful interaction 2023-12-18 19:02:52 +11:00
Andy Piper 92ef809e3b AP_IOMCU: allow bdshot iomcu on non-bdshot fmu 2023-12-18 19:02:52 +11:00
Andy Piper 43b6fc0dba AP_IOMCU: constrain PWM channels to 8, telem channels to 4 and RC channels to 16
make ADC readings interrupt driven
turn off iomcu updates when debugging
allow for correct number of telemetry channels
cycle between vservo and vrssi when reading adc
build adc with O2
2023-12-18 19:02:52 +11:00
Andy Piper 153c5181cb AP_IOMCU: reset erpm to zero on timeout
remove unneeded packed attribute
reset the PWM status after channels have been enabled or disabled
2023-12-18 19:02:52 +11:00
Andy Piper 98aeade904 AP_IOMCU: bdshot for iomcu
prevent repeated rcout mode sets
add ESC telemetry if compiled in
add infrastructure to support propagating erpm and telemetry from iomcu
add support to propagate bdmask to iomcu
add support for EDT
scale voltage and current correctly when reading EDT data
ensure that telemetry data is reset
reset ESC telemetry data to zero if stale
ESC type and bdmask must be setup before the output mode
2023-12-18 19:02:52 +11:00
Andy Piper 375a940b51 AP_IOMCU: make adc interrupt driven 2023-12-11 20:46:28 +11:00
Andy Piper c4cfc5dbe4 AP_IOMCU: fix eventing mask and some minor cleanups 2023-08-15 06:53:48 +10:00
Andy Piper 2af3d53eac AP_IOMCU: use a command queue for dshot commands and telemetry requests to avoid losing data 2023-08-15 06:53:48 +10:00
Andy Piper d9f42236ad AP_IOMCU: support dshot600 on f103 2023-08-15 06:53:48 +10:00
Andy Piper af256f4b1b AP_IOMCU: output mcuid on f103 if able to 2023-08-15 06:53:48 +10:00
Andy Piper 9db5d0bf9b AP_IOMCU: reduce latency for oneshot
correctly update outmode modes when requested
get ARM CPUID and display in startup banner
ensure correct rc input timing on 1Khz iofirmware
2023-08-15 06:53:48 +10:00
Andy Piper 7b96f66413 AP_IOMCU: add support for getting output mode and mcuid
give an appropriate MCUID on F103
2023-08-15 06:53:48 +10:00
Andy Piper bb730e8e24 AP_IOMCU: inverted locking model 2 2023-08-15 06:53:48 +10:00
Andy Piper ec1edea1da AP_IOMCU: add support for shared DMA to iomcu-dshot
new event-based update() loop for iomcu to allow for DMA channel sharing
spin event loop at 2Khz to give dshot thread ample access to DMA channels
correct transmission complete callbacks
ensure peripheral is re-enabled on DMA resumption
ensure DMA transactions do not get clobbered by locking
restructure callbacks for shared and non-shared DMA cases
ensure RC updates happen at 1Khz
increase expected delay at startup
2023-08-15 06:53:48 +10:00
Andy Piper e6e0543b8a AP_IOMCU: propagate dshot rates through to IOMCU
implement dshot ESC telemetry
add support for channel enablement/disablement
add stack checks and reporting for MSP stack
wait correct timeout in tickless mode
ensure that dshot sees all pwm updates as the occur in order to maintain periodicity
ensure dshot options are propagated on reset
implement dshot commands
ensure oneshot/125 and mode are setup correctly
add instrumentation for process stack
prevent illegal recursive locks
ignore requests for dshot 600
add support for soft reboot of iomcu
2023-08-15 06:53:48 +10:00
bugobliterator ad428ac060 AP_IOMCU: add support for sending DShot function command
add support for dshot on iomcu
add support for updating to dshot iofirmware
2023-08-15 06:53:48 +10:00
Andrew Tridgell 22c31ac729 AP_IOMCU: removed set_blocking_writes 2023-07-12 17:06:02 +10:00
Peter Barker 1e81ef93a4 AP_IOMCU: remove intermediate option_is_enabled methods for RC_Channel 2023-06-14 17:39:43 +10:00
Hayden 11dd9e8095 AP_IOMCU: Add #pragma once
Added #pragma once to AP_IOMCU as this caused compile issues when adding bindings to the LUA scripting
2023-05-24 12:39:47 +10:00
Andrew Tridgell a25ffa266f AP_IOMCU: fixed issue with not regaining RC input
this fixes an issue where when you lose R/C input on IOMCU that you
may not regain it when R/C comes back.

The issue stems from us still processing the DSM uart when we are
using the SD3 "SBUS" uart for RC input, and still doing the switch of
the SD3 config every 2 seconds.

When we are not searching for a new protocol we should not be changing
UART config
2023-05-23 12:11:04 +10:00
Peter Barker f1be6df93e AP_IOMCU: honour AP_RCPROTOCOL_X_ENABLED 2023-05-02 10:19:50 +10:00
Andrew Tridgell 2f1c38e13a AP_IOMCU: support forcing heater to enabled with a feature bit 2023-03-07 10:33:24 +11:00
Peter Barker a6831805f1 AP_IOMCU: read many bytes using read(buffer, len) method 2023-02-24 09:37:20 -08:00
Andrew Tridgell ab0768871b AP_IOMCU: add internal errors for unresponsive IOMCU
if IOMCU stops responding completely or stops giving status update
then give an internal error to help with diagnostics
2023-02-14 09:12:34 +11:00
Andrew Tridgell d921c427b1 AP_IOCMU: improved the safety button reset test code
this allows testing of either watchdog or hard-fault reset
2023-02-14 09:12:34 +11:00
Andrew Tridgell 65fadfa2fe AP_IOMCU: fixed an issue with double reset of IOMCU
if the IOMCU resets twice in quick succession then the code that
restores the safety state while flying can fail, leading to the
aircraft trying to continue flying with safety on

This results from two issues:

- a race in handling the last_safety_off variable
- the fact that plane sets the soft_armed state based on safety state
2023-02-14 09:12:34 +11:00
Peter Barker b580c873a8 AP_IOMCU: log number of errors reading status page 2022-09-02 11:16:52 +10:00
Peter Barker 605f42947e AP_IOMCU: log regardless of success reading status page 2022-09-02 11:16:52 +10:00
Peter Barker 0be9c83692 AP_IOMCU: break logging out as a method 2022-09-02 11:16:52 +10:00
murata 70f0636c90 AP_IOMCU: Console output can be disabled 2022-05-17 09:53:06 +10:00
Randy Mackay b6e86eee49 AP_IOMCU: valid_GPIO_pin checks if pin configured for GPIO 2022-04-26 15:19:28 +09:00
Randy Mackay caa2ed3294 AP_IOMCU: convert_pin_number leaves input untouched on failure 2022-04-26 15:19:28 +09:00
Andrew Tridgell ce0b7a8957 AP_IOMCU: fixed handling of RC_OPTIONS bit to ignore RC failsafe bit
this worked on FMU but not on IOMCU
2022-03-22 10:30:35 +11:00
Peter Barker 4e122a3d50 AP_IOMCU: rename and make enum RC_Channel::ControlType
Type:: is too generic; get_type should probably be get_control_type
2022-02-27 09:55:01 +11:00
Andrew Tridgell 4c5fc1f5ef AP_IOMCU: removed include of ch.h from headers 2022-02-22 12:13:19 +11:00
TunaLobster db6383eee7 AP_IOMCU: fix ADC scaling on IOMCU 2021-11-16 14:12:43 +11:00
bugobliterator 1a6179148b AP_IOMCU: ensure page_GPIO is aligned to 16bit 2021-09-29 19:08:10 +10:00
Iampete1 ba58cb86db AP_IOMCU: support digital write 2021-09-28 09:40:25 +10:00
Iampete1 12d5fbbc86 AP_IOMCU: iofirmware: support digital write 2021-09-28 09:40:25 +10:00
Iampete1 cc03b2975c AP_IOMCU: iofirmware: remove saftey PWM 2021-09-14 09:23:02 +10:00
Iampete1 c1a2379504 AP_IOMCU: remove safe PWM 2021-09-14 09:23:02 +10:00
Andrew Tridgell c0c32a63cc AP_IOMCU: mark logger Write() calls as streaming where appropriate 2021-08-18 10:20:03 +10:00
Andrew Tridgell 45d82887b3 AP_IOMCU: fixed a safety reset case for IOMCU reset
if IOMCU resets in flight when user had disabled the safety switch
using the button then the IOCMU force safety code was not called
2021-05-25 12:14:01 +10:00
Andy Piper c26f49fb0a AP_IOMCU: ChibiOS 20.3.x build fix 2021-03-23 12:01:20 +11:00