Hi Nuttxaddicts, After configuring the CAN socket with SO_TIMESTAMP, the application reading the socket is sometimes getting an empty timestamp in some situations. I've been debugging this issue and I this is what I found:
There are two paths when receiving a CAN frame from the interrupt, if there is someone waiting for a frame, the can_recvfrom_eventhandler callback is called to deliver the frame to the application, otherwise the frame is stored in the read-ahead list. When there is no listener available the timestamp is generated in the can_callback function just before calling can_data_event to store the CAN frame in the read-ahead list. But, if there is a listener waiting, the can_recvfrom_eventhandler is called and the timestamp is not generated at all, so the recvmsg call in the application side returns an empty timestamp. I think this is a bug. Why is the timestant not added in the explained case? Adding it in the can_recvfrom_newdata function solves the issue. Javier Casas MarĂn Geotab Senior Embedded Systems Developer Direct Toll-free Visit +34 900 535 371 www.geotab.com/es Twitter <https://twitter.com/geotab> | Facebook <https://www.facebook.com/Geotab> | YouTube <https://www.youtube.com/user/MyGeotab> | LinkedIn <https://www.linkedin.com/company/geotab/>