Open bondus opened 4 years ago
The problem is that ATSAM21C has no unique identifier. In other words, I did not find anything useful in the documentation.. My plan for CAN FD is to declare a new command:
DECL_COMMAND(command_config_can_address, "config_can_address address=%c");
and store it in the EEPROM/FLASH in the processor.
But in the CAN 2.0B implementation, do it according to your needs. Feel free to use the original CanSerial project and use only the new methods from generic / can_fd_support.c, saving 5 bytes for each message.
One more note on threads and the original CanSerial. Reading from the CAN socket is set to block with timeout set. What in one thread with TX can cause problems ..
/* set timeout */
struct timeval tv;
tv.tv_sec = 1;
tv.tv_usec = 0;
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof tv);
Assuming there is automatic discovery of the boards and they have an unique UUID it would be a good idea to name the virtual serial ports according to the UUIDs, much like klipper serial/linux USB system does.
Something like /tmp/ttyCAN0_ for a board connected to can bus0
This is a suggestion/discussion point, not really an issue.