Commit Graph

150 Commits

Author SHA1 Message Date
Peter Barker e6796c1e96 AP_HAL_ChibiOS: remove superfluous linefeed from panic strings
panic adds this within the HAL layer.
2024-12-14 10:06:13 +11:00
Andrew Tridgell 52169f25da HAL_ChibiOS: replace volatile bools with mutexes
this replaces the two booleans used to mediate TX and RX buffer
protection with mutexes.

The booleans were a hangover from the very early HAL_ChibiOS code, and
can lead to a deadlock. The sequence is as follows:

 - a very high CAN bus bandwidth usage, triggered by MissionPlanner
   requesting CAN_FORWARD on a CAN serial port. That causes a
   "infinite" number of CAN_FRAME messages which saturates the bus,
   and leads to the DroneCAN thread looping with no pause

 - a serial port configured as GPS type AUTO, auto-probing for a GPS
   that isn't there. This calls begin() periodically

 - the UART TX thread assocated with that UART not making progress as
   the TX thread priority is below the DroneCAN thread priority

 - this causes the begin() in main thread waiting for _in_tx_timer to
   loop forever, which triggers a watchdog
2024-10-01 09:54:26 +10:00
Andrew Tridgell 070363e453 HAL_ChibiOS: limit RX timeout to 100ms
this prevents a very long timeout in begin(), replacement with a mutex
will happen in a separate PR
2024-09-27 11:06:20 +10:00
Peter Barker 8b9154d115 AP_HAL_ChibiOS: re-order initialiser lines so -Werror=reorder will work 2024-09-24 22:50:28 +10:00
Andy Piper 189cc9d549 AP_HAL_ChibiOS: correctly uninvert RX/TX on F4 with inverter support 2024-08-07 17:34:34 +10:00
bugobliterator 993d694fbb AP_HAL_ChibiOS: allow setup for low noise clock mismatch tolerant UART line 2024-07-25 09:37:16 +10:00
bugobliterator 025077b6f4 AP_HAL_ChibiOS: add support for recording UART Rx errors 2024-07-25 09:37:16 +10:00
Andrew Tridgell 34815f9fb0 HAL_ChibiOS: scale RTS threshold to make software CTS more effective 2024-06-27 10:11:14 +10:00
Brad Bosch f2f9349419 AP_HAL: Add support for parity to Serial passthrough
Add code to reflect USB ACM parity setting to the passthrough port alongside existing support for ACM baud rate changes.  Some use cases for serial passthrough require specific parity settings.

For example, even parity is used and required by the USART protocol used in the STM32 system bootloader. This enhancement allows the use of standard flash programming tools such as STM32CubeProgrammer to flash connected STM based peripherals such as Receivers and Telemetry radios via serial passthrough.  Some examples of such peripherals include the FrSky R9 receivers as well as various other STM based LoRa modules used by the mLRS project.
2024-06-11 09:24:32 +10:00
Andrew Tridgell 8dbad82c8a AP_HAL_ChibiOS: use NEW_NOTHROW for new(std::nothrow) 2024-06-04 09:20:21 +10:00
Iampete1 e10b4abad8 ChibiOS: UART: Add support for RS-485 Driver Enable RTS flow control 2024-05-28 09:48:19 +10:00
Iampete1 edc12c2857 AP_HAL_ChibiOS: use new UART stats tracking helper moving history up to util 2024-04-03 13:10:06 +01:00
Andrew Tridgell 0a8faa83d9 HAL_ChibiOS: allow for up to 12.5MBps on H7 UARTs
use 8x oversampling instead of 16x oversampling
2024-01-02 08:12:37 +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
Andrew Tridgell 0ed33653fc HAL_ChibiOS: added a method for just changing port owner 2023-08-02 17:44:39 +10:00
Andrew Tridgell 56be632916 HAL_ChibiOS: use set_size_best()
maximise chance of getting a reasonable uart buffer size
2023-07-18 11:38:27 +10:00
Andrew Tridgell 8fd5341b5b HAL_ChibiOS: moved uart locking up to AP_HAL
and removed set_blocking_writes
2023-07-12 17:06:02 +10:00
bugobliterator 9e6c9022a3 AP_HAL_ChibiOS: add support for forwarding USB COM2 to Secondary controller 2023-04-26 18:04:00 +10:00
tsubashmail@gmail.com ae9e15ade5 HAL_ChibiOS: port for STM32L4+ processor
Added support for stm32l4+ processor

- Added scripts for hwdef generation
- Tested in custom hardware prototype (stm32l4r5vit6)
- Tested all peripherals and auto pilot modes.
2023-04-14 07:48:56 +10:00
Peter Barker 130f2c3bc8 AP_HAL_ChibiOS: add and use a "bool read(c)" method to AP_HAL
this is much less likely to not work vs the int16_t equivalent
2023-03-22 17:59:11 +11:00
James O'Shannessy b5e17bfc5d AP_HAL_ChibiOS: Fix half-duplex serial on L431 periph nodes 2023-02-23 08:53:40 +11:00
Andy Piper 81aa5b9dc6 AP_HAL_ChibiOS: make available/available_locked consistent with read/read_locked 2022-07-13 18:17:07 +10:00
Andy Piper 4068337971 AP_HAL_ChibiOS: correct UART RX stats 2022-06-14 10:25:17 +10:00
murata e007b21f9e AP_HAL_ChibiOS: Console output can be disabled 2022-05-17 09:53:06 +10:00
Andy Piper eaa414bb0c AP_HAL_ChibiOS: implement pseudo-flushing for buffered UARTS 2022-04-20 17:38:08 +10:00
Andrew Tridgell 1c5a954b24 HAL_ChibiOS: incorrect class of class in uart TX timeout
need to call chEvtGetAndClearEventsI() as we are in a system lock
state
2022-04-04 16:59:38 +10:00
Andrew Tridgell 638e20a0b9 HAL_ChibiOS: bring in hal.h where it is needed 2022-02-22 12:13:19 +11:00
Andy Piper 48c21299f8 AP_HAL_ChibiOS: hwdef for SPRacingH7
hwdef for DevEBoxH7v2
pin definitions for STM32H750
add QSPI to DevEBox bootloader
add external flash to DevEBox
rename EXTERNAL_PROG_FLASH_MB to EXT_FLASH_SIZE_MB
Add support for EXT_FLASH_RESERVE_START_KB and EXT_FLASH_RESERVE_END_KB
Disable HAL_ENABLE_SAVE_PERSISTENT_PARAMS when there is no bootloader flash available
relax storage health status with SD card backend
don't check SD card health unless USE_POSIX
binary sections rearranged on external ram
manage RAMFUNC through ldscript and optimize function placement in external flash
inline timer functions
optimize placement of ChibiOS and functions in ITCM and AXI RAM
fix chibios features on bootloader build with external flash
change H750 memory layout
increase line storage for SD card based parameters
comment external flash linker script
move vtables into DTCM
update ram map for H757
enable crashdump support with external flash
correct bootloader pins and generator on SPRacingH7/DevEBoxH7v2
setup external flash reserve regions
allow different RAM_MAP for external flash on H750 and H757
2022-02-09 12:47:55 +00:00
Peter Barker 875f9a9497 AP_HAL_ChibiOS: add HAL_UART_STATS_ENABLED to disable stats gathering 2022-01-12 18:30:49 +11:00
Stephen Dade fb5ac63a63 AP_HAL_ChibiOS: Fix get_options() to use uint16_t 2021-12-15 14:14:07 +11:00
Andrew Tridgell 61ffe188d4 HAL_ChibiOS: implement disable_rxtx() 2021-11-07 07:00:35 +11:00
bugobliterator 5fa50c419d AP_HAL_ChibiOS: account for TXFIFO when doing flow control detection 2021-10-15 19:57:55 +11:00
Iampete1 5848510876 AP_HAL_ChibiOS: set flow control disabled if no RTS line 2021-10-05 12:11:47 +11:00
Iampete1 dc45a113f9 AP_HAL_ChibiOS:UARTDriver: allow re-defintion of RTS and CTS pins 2021-09-29 19:55:21 +10:00
Andrew Tridgell 0212e23cd3 HAL_ChibiOS: added support for STM32L496 MCUs
good MCU for AP_Periph
2021-09-24 18:08:00 +10:00
Andrew Tridgell adbaccaa08 HAL_ChibiOS: fixed RTSCTS flow control issue
this fixes an issue reported on MatekH743, but also applies to other
boards. When not using DMA if there have been bytes written before the
auto flow control detection was enabled then these must be cleared
from _total_written so the flow control detection can work correctly
2021-09-13 21:28:08 +10:00
Andrew Tridgell 39f44147b8 HAL_ChibiOS: reduce the impact of UART DMA contention
this changes the heuristics for UART TX DMA allocation to greatly
reduce the chances of DMA contention causing long delays on other
devices

This fixes issues with FETTec driver output and gimbal status messages
as reported by Amilcar and OlliW. The problem is particularly bad when
no GPS is connected to GPS1 on fmuv3 and derived boards (such as
CubeBlack)

key changes:

 - remember the contention_counter across begin() calls, as the GPS
   calls begin with new baudrates regularly

 - added a is_shared() API to Shared_DMA, allowing the UART driver to
   avoid TX DMA on shared streams when at low baudrates.
2021-08-31 07:55:27 +10:00
Andy Piper f71b951cb2 AP_HAL_ChibiOS: return correct value for tx_pending(). 2021-08-04 17:26:18 +10:00
bugobliterator d1b0438412 AP_HAL_ChibiOS: add support for usb passthrough with baud changes 2021-07-21 17:06:41 +10:00
Andrew Tridgell db1df9d3a8 HAL_ChibiOS: raise DMA contention threshold for H7 2021-07-15 11:31:55 +10:00
Andrew Tridgell 926d4ad71c HAL_ChibiOS: implement NOFIFO option for uarts 2021-07-15 11:31:55 +10:00
Andrew Tridgell 4ed0b03f35 HAL_ChibiOS: implement set_RTS/CTS_pin methods 2021-07-09 13:27:57 +10:00
Andrew Tridgell 67fea9f2f8 HAL_ChibiOS: fixed DMA disable on contention
this fixes a problem with the automatic DMA disable on DMA contention
in UARTs. This fixes issue #14581

the problem was that while tx_dma_enabled was correctly set to false,
it would keep looping inside write_pending_bytes_DMA() if the data
arrived in the write buffer at a faster rate than it could be sent
out, which did happen with a mavlink stream rate of 4Hz. This means it
kept using DMA even with tx_dma_enabled set to false. The result was
that the automatic flow control code never got a chance to run and we
didn't switch back to non-DMA for these low baudrate contended UARTs
2021-06-05 19:03:03 +10:00
Andrew Tridgell 3128d71aac HAL_ChibiOS: display uart even when not initialised
don't rely on thread allocation for uart info display
2021-06-05 18:52:33 +10:00
Andrew Tridgell 6fab8feeae HAL_ChibiOS: implement uart_info per-uart
this allows for some UARTs to be of EMPTY type
2021-06-05 18:52:33 +10:00
Andrew Tridgell 135a4d2c83 HAL_ChibiOS: fixed order and labelling of @SYS/uarts.txt 2021-06-05 18:52:33 +10:00
Andrew Tridgell 47a5d78397 HAL_ChibiOS: disable DMA on high contention UARTs
switch to interrupt driven when in high contention
2021-04-08 06:53:48 +10:00
Andrew Tridgell 4cddb12508 HAL_ChibiOS: fixed DMA sent calculation on UART DMA timeout 2021-04-07 07:34:45 +10:00
Andrew Tridgell 439a944801 HAL_ChibiOS: added support for STM32G474 MCU 2021-03-23 12:01:20 +11:00
Andy Piper e1d71486e4 AP_HAL_ChibiOS: build fixes for ChibiOS 20.3.x 2021-03-23 12:01:20 +11:00