You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I notice due_can declares a variable in which to hold RTR, but that variable is never populated.
This bug exists in (as far as I can tell) every version of the library.
I have patched the (6 month old) version of the library (as linked from the M2 Git repo), but it is not obvious how to properly fork/pullRq/submit the patch
...I have not yet patched the write function but...
...If you want to know if a CAN device is requesting data, here's the patch:
Open C:\Users\YourUserName\AppData\Local\Arduino15\packages\macchina\hardware\sam\0.2.1\libraries\due_can\due_can.cpp
...If you're not using Windows - you're just going to have to go hunting for that file - sorry.
Search for the string "fid" [Family ID] ...there's only one occurence of this string in this file: rxframe->fid = m_pCan->CAN_MB[uc_index].CAN_MFID;
Just after/before/near ^that^, line add this line: rxframe->rtr = (m_pCan->CAN_MB[uc_index].CAN_MSR & CAN_MSR_MRTR) ? 1 : 0 ;
That's it, you can now identify Remote Transmit Request packets with something like: if (frame.rtr) rtrHandler(frame) ;
https://forum.macchina.cc/t/can-library-does-not-return-rtr-solved/610
I notice due_can declares a variable in which to hold RTR, but that variable is never populated.
This bug exists in (as far as I can tell) every version of the library.
I have patched the (6 month old) version of the library (as linked from the M2 Git repo), but it is not obvious how to properly fork/pullRq/submit the patch
...I have not yet patched the write function but...
...If you want to know if a CAN device is requesting data, here's the patch:
Open
C:\Users\YourUserName\AppData\Local\Arduino15\packages\macchina\hardware\sam\0.2.1\libraries\due_can\due_can.cpp
...If you're not using Windows - you're just going to have to go hunting for that file - sorry.
Search for the string "fid" [Family ID] ...there's only one occurence of this string in this file:
rxframe->fid = m_pCan->CAN_MB[uc_index].CAN_MFID;
Just after/before/near ^that^, line add this line:
rxframe->rtr = (m_pCan->CAN_MB[uc_index].CAN_MSR & CAN_MSR_MRTR) ? 1 : 0 ;
That's it, you can now identify Remote Transmit Request packets with something like:
if (frame.rtr) rtrHandler(frame) ;
If you like diff files, enjoy this:
The text was updated successfully, but these errors were encountered: