mirror of
https://github.com/apache/nuttx.git
synced 2026-08-27 04:10:40 +00:00
imxrt_txtimeout_work() had four defects that together let one expired frame take the interface down permanently. It aborted mailbox RXMBCOUNT + mbi while the deadline it consulted belongs to RXMBCOUNT + 1 + mbi, so every abort landed one mailbox low and mbi == 0 wrote CAN_TXMB_ABORT into the buffer reserved for the ERR005829 workaround, while the highest TX mailbox was never aborted at all. Its expiry test read `now.tv_sec > d.tv_sec || now.tv_usec > d.tv_usec`, which declares any deadline that crosses a second boundary expired: in that case the deadline's microsecond field is always the smaller of the two. The `now` it compared against was a struct timespec cast to a struct timeval, so writing tv_usec wrote over tv_nsec and tv_sec was whatever the cast happened to line up with. imxrt_txdone() cancelled the watchdog but left txmb[].deadline set, so a retired mailbox looked expired forever and the next watchdog expiry on any other mailbox aborted whatever frame had since been loaded there. The walk ran to TXMBCOUNT, which counts the reserved mailbox as well, so its last iteration addressed mailbox TOTALMBCOUNT - one past the ring, and mb_address[] one past its end. Only txmb[] never being written that far kept it in bounds. TXMBRINGSIZE now names the ring size that the rest of the driver already assumes. Aborting a frame that is already on the wire raises a bit error, so the transmit error counter climbs and the node goes error passive. Since imxrt_txmb_next() only hands out a mailbox above every pending one, a mailbox left in DATAORREMOTE also pins the allocator at TOTALMBCOUNT and transmit never recovers. Measured on an ARK FMU-v6XRT with a DroneCAN GNSS node on the bus, offering 736 frames/s (9% of a 1 Mbit/s bus) from the PX4 uavcan driver: before, the interface transmitted 0 frames/s with ECR[TXERRCNT] pinned at 128 and ESR1[FLTCONF] error passive, and stayed dead across a reboot. After, 734 frames/s, 0.1% loss, TXERRCNT 0, error active. Assisted-by: Claude:claude-opus-5 Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com> |
||
|---|---|---|
| .. | ||
| arm | ||
| arm64 | ||
| avr | ||
| ceva | ||
| dummy | ||
| hc | ||
| mips | ||
| misoc | ||
| or1k | ||
| renesas | ||
| risc-v | ||
| sim | ||
| sparc | ||
| tricore | ||
| x86 | ||
| x86_64 | ||
| xtensa | ||
| z16 | ||
| z80 | ||
| CMakeLists.txt | ||
| Kconfig | ||