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
1) Use the RX STATUS command instead of READ(CANINTF) to check availability of
data to read. This reduces SPI usage by 1 byte out of 3, even to just check
if data is available.
2) Use the READ command to read RXB(n) registers sequentially instead of
requesting them one by one. This requires 7 bytes over SPI to read SIDH,
SIDL, EID8, EID0, DLC. The previous implementation used 15 bytes to read the
register for standard frames, and 24 bytes for extended frames.
3) Use the READ RX BUFFER command to read the packet data, instead of requesting
bytes one by one. This requires sending (1 + N) bytes over SPI instead of
(3 * N) for the payload, and doesn't require sending 3 bytes to modify RXnIF.
Total savings: (2 * N + 11) bytes over SPI for standard frame.
For N = 8, we now send 18 bytes over SPI vs 45. That's 60% reduction!
As a bonus, I was able to put all SPI operations in one SPI transaction.
I don't know if it makes much of a difference, but perhaps makes things safer?
0 commit comments