Update: I’ve implement the software based CAN_RAW_FILTER socket option where specific can frames can be filtered on socket basis. I’m also thinking about implementing an ioctl to do hw based CAN filtering to save CPU cycles.
Also the SocketCAN implementation now supports the SO_TIMESTAMP socket option. When this option is enabled, you can use the recvmsg() function and a cmsg structure to receive associated timestamp in a timeval structure. The timestamp is retrieved using the clock_systimespec() function and the accuracy of this timestamp depends systimer tick period (NuttX default is 10000us) or you can enable the high-res RTC timer which is based on a 32.768kHz which gives us an accuracy of 31us.
I couldn’t really find hard requirements on the accuracy of this clock in the UAVCAN spec. So the question is, does a 32.768kHz RTC provide enough accuracy? Or do we have use other timing functions to get higher accuracy?
If anyone is interested in the code it’s located on my Github under:
And required apps
I’ve divided now my todo list into a functionality todo list to get a working product and a todo list that focuses on improving quality-of-life:
Functionality todo list:
- Transmitted frame removal from TX mailbox
- Comply to 4.2.4.3 Inner priority inversion
Quality-of-life todo list:
- CAN & CAN FD bitrate configuration (autobaud)
- Self-receive loopback support
- Filter/error mask support
- Multi-CAN device
- Ioctl for HW based CAN filtering