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> |
||
|---|---|---|
| .github | ||
| arch | ||
| audio | ||
| binfmt | ||
| boards | ||
| cmake | ||
| crypto | ||
| Documentation | ||
| drivers | ||
| dummy | ||
| fs | ||
| graphics | ||
| include | ||
| libs | ||
| mm | ||
| net | ||
| openamp | ||
| pass1 | ||
| sched | ||
| syscall | ||
| tools | ||
| video | ||
| wireless | ||
| .asf.yaml | ||
| .codespell-ignore-lines | ||
| .codespellrc | ||
| .editorconfig | ||
| .gitignore | ||
| .gitmessage | ||
| .pre-commit-config.yaml | ||
| .yamllint | ||
| AUTHORS | ||
| CMakeLists.txt | ||
| CONTRIBUTING.md | ||
| INVIOLABLES.md | ||
| Kconfig | ||
| LICENSE | ||
| Makefile | ||
| NOTICE | ||
| README.md | ||
| ReleaseNotes | ||
Apache NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOSs (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).
For brevity, many parts of the documentation will refer to Apache NuttX as simply NuttX.
Getting Started
First time on NuttX? Read the Getting Started guide! If you don't have a board available, NuttX has its own simulator that you can run on terminal.
Documentation
You can find the current NuttX documentation on the Documentation Page.
Alternatively, you can build the documentation yourself by following the Documentation Build Instructions.
The old NuttX documentation is still available in the Apache wiki.
Supported Boards
NuttX supports a wide variety of platforms. See the full list on the Supported Platforms page.
Contributing
If you wish to contribute to the NuttX project, read the Contributing guidelines for information on Git usage, coding standard, workflow and the NuttX principles.
License
The code in this repository is under either the Apache 2 license, or a license compatible with the Apache 2 license. See the License Page for more information.