Commit Graph

413 Commits

Author SHA1 Message Date
Andy Piper 8c03c9e4bf AP_HAL_ChibiOS: cache values of io_dshot() and io_enabled()
enabled shared_up_dma to be fully compiled out
address some minor review comments
2023-12-18 19:02:52 +11:00
Andy Piper 9f30d01561 AP_HAL_ChibiOS: bdshot for f103 iofirmware
add support to tell if shared DMA channel is actually shared
avoid starting and stopping the timer peripheral with bdshot
ensure that rcout DMA allocation and deallocation happens entirely within the lock
increase rcout thread working area for bdshot
fix mode mask that is sent to the iomcu
ensure iomcu rcout thread gets timeouts for callbacks
control bdshot input and output line levels on f103
use input capture channel pairs to read rising and falling edges of telemetry on f103
reset channel pairs together on iomcu
generalize the bdshot input path to support suitable buffer sizes for iomcu
generalize DMAR reading of CCR registers to read two at a time on iomcu
enable bi-directional dshot channels on PWM1-4 on iomcu
add methods to directly access erpm values from rcout
update erpm mask and esc telemetry correctly for firmware supporting dshot
add support for propagating bdmask to iomcu
dshot commands to all channels need to be aware of iomcu
ensure esc type is propagated to iomcu
cope with iomcu channel numbering when using EDT
ensure pwm driver is reset properly for dshot commands on iomcu
correctly reset pwm for dshot commands
correctly mask off bdshot bits going to iomcu
don't reset GPIO modes on disabled lines
don't reset pwm_started when sharing DMA channels
set thread name on iomcu rcout and reduce stack size on iomcu
ensure that bdshot pulses with no response are handled correctly
correctly setup DMA for input capture on f103
deal with out of order captured bytes when decoding bdshot telemetry
ensure DMA sharing on f103 does not pull lines low
only disable the timer peripheral when switching DMA channels on iomcu
add support for waiting for _UP to finish before proceeding with dshot
re-order iomcu dshot channels to let TIM4_UP go first
ensure that a cascading event will always come when expected on rcout
allow timeouts when using cascading dshot
always rotate telemetry channel after trying to capture input
cater for both in order and out-of-order bdshot telemetry packets
cope with reversed packets when decoding bdshot telemetry
ensure UP DMA channel is fully free on iomcu before starting next dshot cycle
refactor rcout for iofirmware into separate file
2023-12-18 19:02:52 +11:00
Peter Barker e9fc99b1bf AP_HAL_ChibiOS: base HAL_USE_SPI on devices not buses
fixes compilation problem with gcc 10.3

../../libraries/AP_HAL_ChibiOS/SPIDevice.cpp: In static member function 'static void ChibiOS::SPIDeviceManager::__static_initialization_and_destruction_0(int, int)':
../../libraries/AP_HAL_ChibiOS/SPIDevice.cpp:76:18: error: statement has no effect [-Werror=unused-value]
   76 | ChibiOS::SPIDesc SPIDeviceManager::device_table[] = { HAL_SPI_DEVICE_LIST };
      |                  ^~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: some warnings being treated as errors
2023-11-22 18:14:00 +11:00
Andrew Tridgell 2ba4bf1478 HAL_ChibiOS: allow for --disable-networking 2023-11-17 10:54:24 -08:00
Andrew Tridgell 2f9bfb648f HAL_ChibiOS: default RTS pins to PULLDOWN
this avoids issues with SiK and RFD900x radios getting stuck in
bootloader mode due to a high RTS pin on power on.

We did this for Pixhawk6C in this PR:
https://github.com/ArduPilot/ardupilot/pull/24169

this now applies it to all boards
2023-11-12 07:26:50 +11:00
Andrew Tridgell 6173726846 HAL_ChibiOS: fail on badly formed SPIDEV line 2023-10-31 10:42:25 +11:00
bugobliterator fd319c6b2c AP_HAL_ChibiOS: fix setting APP_RAM size
also allows passing APP_RAM_START index through hwdef
2023-10-23 10:43:42 +11:00
bugobliterator 57f6f8e34d AP_HAL_ChibiOS: add support for saving and restoring SCK pin state
when SPI goes into undefined state during reset
2023-10-18 19:25:19 +11:00
Andy Piper 82452758b4 AP_HAL_ChibiOS: write out serial ports that are available when configuring 2023-09-26 11:31:08 +10:00
Andrew Tridgell fbd44dddd0 HAL_ChibiOS: enable ISRs during flash ops in bootloader
this makes a huge difference in AP_Periph bootloader speeed, where
disabling interrupts prevents CAN packets from being received
2023-09-06 11:21:51 +10:00
Peter Barker c7080825d3 AP_HAL_ChibiOS: chibios_hwdef.py: canonicalise AP_PERIPH env define
before this change this environment variable is a string, which means anything checking it for truth will get back true even if it is empty ("") or the string zero ("0").  The existing is_periph_fw check only works because "1" != 0 - if it was "0" then it would still be considered a periph firmware
2023-09-06 09:28:37 +10:00
Andrew Tridgell 202e71482f HAL_ChibiOS: support CKS32F407 MCU
based on STM32F407
2023-08-26 21:12:42 +10:00
Andrew Tridgell 999919424b hwdef: allow for MCO pin to be configured
this allows for hwdef.dat lines like this:

  PA8 MCO1 RCC
  PC9 MCO2 RCC

you can control the scaling by defining the following:

- STM32_MCO1SEL
- STM32_MCO1PRE_VALUE
- STM32_MCO2SEL
- STM32_MCO2PRE_VALUE
2023-08-25 07:37:12 +10:00
Peter Barker 19bd97a893 chibios_hwdef.py: permit board ID to be specified as a string 2023-08-17 09:13:54 +10:00
Peter Barker a11df25490 chibios_hwdef.py: enforce presence of bootloader if embedding desired 2023-08-17 08:37:31 +10:00
Andy Piper c057cc5485 AP_HAL_ChibiOS: add get_output_mode() and use it to print correct banner for iomcu
add support for undef of STM32 lines and DMA_NOMAP
add support for F103 running at 24Mhz
add f103 variants of iofirmware
reduce memory usage in iomcu for new model
correct pwm output reporting
split iofirmware into config + mcu to allow f103 definition
don't enable non-existant timers on F103
2023-08-15 06:53:48 +10:00
Peter Barker e638925ee0 AP_HAL_ChibiOS: chibios_hwdef.py: fix minor bugs
also mark as flake8-clean
2023-08-11 10:41:02 +10:00
Peter Barker 536f3ac922 chibios_hwdef.py: minor flake8 fixes
whitespace, long lines, ambiguous variables etc
2023-08-11 10:41:02 +10:00
Peter Barker 53d5d1b9a9 AP_HAL_ChibiOS: break out include files for firmware defaults 2023-08-08 11:45:50 +10:00
bugobliterator e6b51df7cd AP_HAL_ChibiOS: dynamically allocate memory for MAC Peripheral 2023-08-06 09:20:08 +10:00
Tom Pittenger 3b79ff0ad3 AP_HAL_ChibiOS: add hooks to compile Networking 2023-08-06 09:20:08 +10:00
Andrew Tridgell 9d5560fc42 hwdef: default 2nd USB endpoint to MAVLink2 2023-07-31 19:03:13 +10:00
Peter Barker dd325a7aaf AP_HAL_ChibiOS: disable terrain unless SD card available 2023-07-19 17:25:18 +09:00
Peter Barker 092afa54a9 AP_HAL_ChibiOS: defaults for board log directory and terrain directory in chibios_hwdef.py 2023-07-19 17:25:18 +09:00
Andrew Tridgell a3eba8bbd3 HAL_ChibiOS: enable UART monitor
enabled if GPS moving baseline available or the board flash size is
256k or over
2023-07-12 17:06:02 +10:00
Andrew Tridgell 7a1b7e85be HAL_ChibiOS: default AP_BOOTLOADER_ALWAYS_ERASE to 1 on AP_Periph 2023-07-10 06:52:44 +10:00
Peter Barker d0b967097e AP_HAL_ChibiOS: process @include lines within hwdef files 2023-07-04 17:36:32 +10:00
Peter Barker 53e6f289e5 AP_HAL_ChibiOS: factor out a write_processed_defaults_file method 2023-07-04 17:36:32 +10:00
Peter Barker 26359204bd AP_HAL_ChibiOS: tidy defaults.parm handling 2023-07-04 17:36:32 +10:00
Peter Barker 3869c4c0e9 AP_HAL_ChibiOS: add and use AP_SBUSOUTPUT_ENABLED
.... which will allow periphs to instantiate this if they really feel like it, and for it to be removed on smaller boards on the custom build server (and potentially on lower-specced boards.
2023-06-27 10:10:41 +10:00
Peter Barker 55227bc487 Tools: add and use AP_GPS_ENABLED 2023-06-21 22:28:48 +10:00
Peter Barker 3657852e30 AP_HAL_ChibiOS: add and use AP_BARO_ENABLED 2023-06-21 22:28:48 +10:00
Peter Barker b3c5889d7d AP_HAL_ChibiOS: add and use AP_COMPASS_ENABLED 2023-06-21 22:28:48 +10:00
Peter Barker e11384454f AP_HAL_ChibiOS: add and use AP_AHRS_ENABLED 2023-06-21 22:28:48 +10:00
Peter Barker 209cba7f89 AP_HAL_ChibiOS: create and use AP_BATTERY_ENABLED
simply as a way to get HAL_PERIPH_ENABLE_BATTERY out of the main code
2023-06-21 22:28:48 +10:00
Peter Barker 2932dea4ff AP_HAL_ChibiOS: add option to disable relay and servorelay libraries 2023-06-20 09:36:39 +10:00
Peter Barker 9a24a3f61d AP_HAL_ChibiOS: allow CrashCatcher to be disabled via hwdef 2023-06-14 18:39:11 +10:00
Peter Barker 3aaeb0f29c AP_HAL_ChibiOS: allow AP_SCRIPTING_ENABLED to come from hwdef files 2023-06-09 16:10:52 +10:00
Peter Barker 0ec35718d7 AP_HAL_ChibiOS: use HAL_PROXIMITY_ENABLED in place of HAL_PERIPH_ENABLE_PRX
boolean truth rather than defines, and simplifies code
2023-06-08 11:53:01 +10:00
Martin Luessi 0c93800ec1 AP_HAL_ChibiOS: Copy vector table to RAM if external flash is primary 2023-06-06 19:19:10 +10:00
Andrew Tridgell 4946ce5431 HAL_ChibiOS: revert recent USB changes
these are causing some boards to crash on startup. Tested with a
QiotekZealotH743 which doesn't get out of setup_usb_strings()

once we have debugged this we can re-add the functionality
2023-06-03 16:50:30 +10:00
bugobliterator f7d3969116 AP_HAL_ChibiOS: enable write protection on USB msd
also fixes support for MSD on FS
2023-05-31 18:40:17 +10:00
bugobliterator 6d6c791fdf AP_HAL_ChibiOS: add support for mass storage device 2023-05-31 18:40:17 +10:00
bugobliterator cc302d8b8c AP_HAL_ChibiOS: add support for OTG HS 2023-05-31 18:40:17 +10:00
Andrew Tridgell 7234ec2e52 HAL_ChibiOS: fixed USB pass-thru for 2nd USB endpoint
we need to align the endpoint ID in the structure
2023-05-29 08:55:38 +10:00
Peter Barker 4bcd4decb1 AP_HAL_ChibiOS: add and use AP_RCPROTOCOL_ENABLE_SET_RC_PROTOCOLS 2023-05-26 14:26:27 +10:00
bugobliterator b5617a9ff8 Revert "AP_HAL_ChibiOS: disable watchdog in hwdef.h not in-line in code"
This reverts commit ccfad8ceea.
2023-05-23 09:00:11 +10:00
Peter Barker 0c7a16b03d AP_HAL_ChibiOS: use chibios_hwdef to define NOTIFY_LED_OVERRIDE_DEFAULT 2023-05-18 07:53:22 +10:00
Peter Barker 586851e40f hwdef: create and use convenient is_periph_firmware method 2023-05-17 18:39:51 +10:00
Peter Barker 30131a2f36 AP_HAL_ChibiOS: replace HAVE_FILESYSTEM_SUPPORT with backend defines 2023-05-17 09:40:39 +10:00