Commit Graph

585 Commits

Author SHA1 Message Date
Andrew Tridgell 46171a7c79 hwdef: give a more useful error message on no bootloader 2023-12-27 21:45:13 +11:00
Thomas Watson dc4438d0e3 AP_HAL_ChibiOS: eliminate legacy UART ordering/references
SERIAL_ORDER has been around for a few years now and UART_ORDER is
rejected by the hwdef script, so support for UART_ORDER and associated
processing in the hwdef script is removed, along with the order
conversion script.
2023-12-19 06:53:15 +11:00
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 a5b6c3b5ef AP_HAL_ChibiOS: utility to print out bdshot encoded data 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
Andy Piper 0cc5cf7d2d AP_HAL_ChibiOS: allow betaflight converter to run on output from "dump hardware" 2023-12-05 11:38:53 +11:00
Tom Pittenger cd6a656acf AP_HAL_ChibiOS: set AP_BATTERY_WATT_MAX_ENABLED 0 for periph 2023-11-26 11:57:14 +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
Peter Barker 15e0f689c2 AP_HAL_ChibiOS: correct AP_Filter defines
- checking the build type is very rarely used and definitely not required here
 - fix boilerplate to conform to normal pattern of including the config header and #if'ing based on the _ENABLED directly after that
2023-11-21 21:13:42 +11:00
Andrew Tridgell 2ba4bf1478 HAL_ChibiOS: allow for --disable-networking 2023-11-17 10:54:24 -08:00
Andrew Tridgell 6bf3debe73 HAL_ChibiOS: default disable ICE in periph 2023-11-17 13:09:02 +11: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
Iampete1 e736d5ecb7 AP_HAL_ChibiOS: hwdef: scripts: defaults_periph: disable unused libaries by defualt 2023-10-17 10:23:20 +11:00
jfbblue0922 0f1e766269 AP_HAL_ChibiOS: JFB110 board definition
Co-authored-by: Randy Mackay <rmackay9@yahoo.com>
2023-10-12 17:03:04 +11:00
Peter Barker cf96791fe2 AP_HAL_ChibiOS: add and use HAP_PERIPH_ENABLE_RTC 2023-10-11 19:17:27 +11:00
Peter Barker 53f4709a78 AP_HAL_ChibiOS: disable RTC on periphs
the singleton isn't instantiated
2023-10-11 19:17:27 +11:00
muramura 007c3460ea AP_ChibiOS: Delete the same definition 2023-10-11 14:42:32 +11:00
Andrew Tridgell da0870f616 HAL_ChibiOS: enable mavlink bindings for ADSB periph 2023-10-02 21:45:28 +11:00
Peter Barker e2975a67e7 AP_HAL_ChibiOS: use AP_GPS_ENABLED to exclude more code when GPS not compiled in 2023-09-27 16:38:15 +10:00
Andy Piper 82452758b4 AP_HAL_ChibiOS: write out serial ports that are available when configuring 2023-09-26 11:31:08 +10:00
Andy Piper 9387236e6c AP_HAL_ChibiOS: prefer bi-directional dshot channels that can be shared on F4 and F7 2023-09-13 17:03:51 +10:00
Andy Piper 194f555c7b AP_HAL_ChibiOS: provide mcu defaults in betaflight conversion 2023-09-06 17:13:07 +10:00
Andy Piper 2160a1afb4 AP_HAL_ChibiOS: correct hwdef generator battery scale 2023-09-06 17:13:07 +10:00
Andy Piper ee8631e9fd AP_HAL_ChibiOS: cope with different IMU drivers in hwdef conversion 2023-09-06 17:13:07 +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
Iampete1 2fbc27584b AP_HAL_ChibiOS: default to 0 battery capacity on periph 2023-08-30 12:25:46 +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
Tom Pittenger ed43f095ce AP_HAL_ChibiOS: add AP_BATTERY_ESC_TELEM_OUTBOUND_ENABLED to defaults_periph 2023-08-22 16:14:36 -07:00
Peter Barker 103caac92c AP_HAL_ChibiOS: add support for DroneCAN RCInput packets 2023-08-19 20:27:24 +10:00
Peter Barker bb6f0ae527 AP_HAL_ChibiOS: improve gating of use of AP_InternalError library
- gate calls into library directly on the define
 - INTERNAL_ERROR becomes empty if library not compiled in
2023-08-17 09:16:46 +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
Peter Barker 7273c8416a AP_HAL_ChibiOS: prevent Periph bricking problem when paniccing early
if Periph panics before we mark the scheduler as initialised then we don't watchdog, which we really need to do on periph nodes so they can be re-flashed conveniently.
2023-08-16 17:21:30 +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
Tom Pittenger 2b30fbcfb2 AP_HAL_ChibiOS: disable RPM by default on Periph 2023-08-11 13:31:45 -07: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 ceab0180ec AP_HAL_ChibiOS: remove use of HAL_BUILD_AP_PERIPH
turn torqeedo off in chibios_hwdef.py instead for Periph
2023-08-09 17:39:49 +10:00
Peter Barker 68e3b1e79b AP_HAL_ChibiOS: move rangefinder rotation default down into AP_Periph 2023-08-09 17:39:49 +10:00
Peter Barker 53d5d1b9a9 AP_HAL_ChibiOS: break out include files for firmware defaults 2023-08-08 11:45:50 +10:00
Tom Pittenger 772465fef3 AP_HAL_ChibiOS: fix whitespace 2023-08-06 09:20:08 +10:00
bugobliterator e6b51df7cd AP_HAL_ChibiOS: dynamically allocate memory for MAC Peripheral 2023-08-06 09:20:08 +10:00
Tom Pittenger f66327d97d AP_HAL_ChibiOS: Ethernet related memory allocations 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 00c8c24b1e AP_HAL_ChibiOS: increase FLASH_RAM and rename FDCAN to CAN for H750 2023-06-06 19:19:10 +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
Peter Barker 6aeeb3d51d AP_HAL_ChibiOS: consolidate AP_Periph serialmanager defaults 2023-05-16 10:16:10 +10:00
Peter Barker 2d7123fcff AP_HAL_ChibiOS: add and use AP_RCPROTOCOL_ENABLED 2023-05-16 09:16:37 +10:00
Henry Wurzburg d0ac8f3016 AP_HAL_ChibiOS: normalize SerialManagers ports defaults to allow inclusion in hwdefs 2023-05-11 18:45:53 +10:00
Peter Barker db6deee9e1 hwdef: chibios_hwdef.py becomes a library 2023-05-10 17:14:43 +10:00
Andy Piper d69b8c2693 AP_HAL_ChibiOS: fix usage of ADC2 and ADC3 in STM32H730 2023-04-28 08:31:15 +10:00
Andy Piper e6c1897dd3 AP_HAL_ChibiOS: provide complete ADC2/ADC3 maps for STM32H750 and STM32H743
Fix dummy pin generation
2023-04-28 08:31:15 +10:00
Andy Piper 26c59349d5 AP_HAL_ChibiOS: use HAL_XIP_ENABLED to denote running in external flash 2023-04-28 08:31:15 +10:00
Andy Piper 5b43926d0a AP_HAL_ChibiOS: for H730/H750 running in XIP mode do not reset clocks
create mcuconf file for STM32H730 (type2)
allow OTG2 to be used as OTG1 on MCUs that need it
remove redundant OTG enablement
2023-04-28 08:31:15 +10:00
Andy Piper 798fc05ba8 AP_HAL_ChibiOS: clean up linker map on H730 and H750
use regular ChibiOS RAM areas for RAM functions
exclude board.o from RAM functions and add some comments
use separate linker script for H750
use correct RAM area for process stack on H750/H743
update EXCLUDE items to put __early_init in flash on H730 and H750
optimize H730 ramfunc usage
2023-04-28 08:31:15 +10:00
Andy Piper 8b8f5eadd6 AP_HAL_ChibiOS: detect QSPI and OSPI separately for setting NO_RESET 2023-04-28 08:31:15 +10:00
Andy Piper 8ef92805e1 AP_HAL_ChibiOS: support for OCTOSPI 2023-04-28 08:31:15 +10:00
Andy Piper 61e70a5fb1 AP_HAL_ChibiOS: add support in hwdef for OCTOSPI 2023-04-28 08:31:15 +10:00
Andy Piper f8dd6a1b2a AP_HAL_ChibiOS: rename QSPIDevice to WSPIDevice 2023-04-28 08:31:15 +10:00
Andy Piper cc086ab8d4 AP_HAL_ChibiOS: support for STM32H730xx MCUs
correct calculation of advanced timers
add support for linker script configuration in mcu config script
use linker script configuration for H750 and H730
add single OTG_HS support on H730 via OTG2
make sure complimentary channels get advanced timers
complemntary timers do not require advanced mode
allow custom clockspeeds of 550Mhz
correct debug pins on H730
support custom clockrate of 520Mhz on H730
correct H730 USB end point pins
restructure linker script for STM32H730
allow chibios_hwdef.py to set advanced timer on L431
don't define RAMFUNC on STM32H730
clock tree for STM32H730
create non-cacheable memory area for SDMMC DMA
don't look for RAM_MAP in bootloader with external flash
2023-04-28 08:31:15 +10:00
Peter Barker 1f3aecf41b AP_HAL_ChibiOS: use defaults to turn off CRSF telem on IO firmware 2023-04-27 18:31:30 +10:00
Peter Barker 926c7d64b1 AP_HAL_ChibiOS: add and use AP_BOOTLOADER_FLASHING_ENABLED 2023-04-26 22:55:36 +10:00
bugobliterator 0343b789e6 AP_HAL_ChibiOS: add support for mixed internal and external flash 2023-04-26 18:04:00 +10:00
bugobliterator 626fd9e77f AP_HAL_ChibiOS: add support for marking ADC pins with identifier 2023-04-26 18:04:00 +10:00
bugobliterator 726dcda24f AP_HAL_ChibiOS: add support for using ADC2 and ADC3 on H7 2023-04-26 18:04:00 +10:00
Andrew Tridgell 64cd58c21a ChibiOS: disable DMA on I2C on F7 and H7 by default
this was already done on many (most?) boards, and greatly reduces DMA
sharing which improves performance of UARTs. This changes the default
to no DMA on I2C
2023-04-25 14:19:09 +10:00
Andrew Tridgell 5024261e2e HAL_ChibiOS: fixed hwdef DMA resolver dependency on python2/python3
we need to use sorted keys in dictionaries to ensure we end up with
the same DMA mapping when using py2 and py3

fixes #15534
2023-04-25 11:30:56 +10:00