Add UART Protocol Support for PC10/PC11 (USART3) #101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As previously discussed. Some are in need of UART support. Since it was not natively supported, we thought it nice to add. Feel free to adopt for the main repo if interesting.
Summary
This PR adds support for using the moteus firmware over UART with the fdcanusb ASCII protocol, enabling communication via serial adapters (e.g., USB-UART, RS485) as an alternative to CAN-FD. Its guarded behind compile macro.
Motivation
Changes
Firmware (
fw/)fw/uart_fdcanusb_micro_server.h(new): Complete implementation of fdcanusb ASCII protocol over UARTcan sendcommands andrcv/OKresponsesfw/moteus.cc: Conditional UART initialization and multiplex routingfw/moteus_hw.cc: Pin configuration for USART3 (PC10/PC11)fw/moteus_controller.cc: Disable debug UART when protocol enabled to prevent pin contentionfw/BUILD: Fixed macro name fromMOTEUS_ENABLE_UART_FDCANUSBtoMOTEUS_ENABLE_UART_PROTOCOLPython Library (
lib/python/moteus/)fdcanusb_device.py: Addbaudrateparameter supportexclusive=Trueto prevent multi-access issuestransport_factory.py: Add--fdcanusb-baudcommand-line argument--fdcanusb /dev/ttyUSB0 --fdcanusb-baud 460800Other
.gitignore: Added.history/for VS Code local history filesTesting
Tested with:
Technical Details
can send XXXX PAYLOAD FLAGS\n→OK\n/rcv ...)--fdcanusb-baud)Breaking Changes
None. UART support is opt-in and does not affect existing CAN-FD functionality.
Code Size Impact
uart_fdcanusb_micro_server.h)