Seeed-Studio/Seeed_Arduino_CAN

Send Timeout in send function at low rates modes

jmoyola opened this issue · 2 comments

Low frames modes make timeout in send frames. P.E.: 10 or 20 KBPS in trame standard and 4 bytes of data return timeout (but the frame is send).

send timeout value 50 in declaration (mcp_can_dfs.h) is low value for low framerates
#define TIMEOUTVALUE 50

I haved test with 20KBPS and 300 and all its ok for long extended transmit frame... i think must do:

  • increase to 1200 (for slow rates 5KBPS).
    or
  • convert this constant to variable and recalculate in function mcp2515_configRate:

mcp_can_dfs.h:
//#define TIMEOUTVALUE 50

mcp_can.h:
private:
uint16_t TIMEOUTVALUE=50; // Default timeout

mcp_can.cpp:
byte MCP_CAN::mcp2515_configRate(const byte canSpeed, const byte clock) {
...
case (CAN_5KBPS):
TIMEOUTVALUE=X;// Timeout for 5KBPS
...
case (CAN_10KBPS):
TIMEOUTVALUE=X;// Timeout for 10KBPS
...
....

If you feel you need to continue the discussion, you can reopen the issues.