Mcp-can fix (for ESP8266)

On my ESP8266 code utilizing the mcp-can library (GitHub - coryjfowler/MCP_CAN_lib: MCP_CAN Library) received CAN packets successfully, but caused a reset whenever I sent a packet.

I discovered that the MCP_CAN::setMsg function was using MAX_CHAR_IN_MESSAGE instead of the passed in data length which I concluded was causing a memory overrun.

Changing:

for(i = 0; i<MAX_CHAR_IN_MESSAGE; i++)

to:

for(i = 0; i<len; i++)

appears to have resolved the issue.

1 Like

Hello, are you still using Esp8266 with this library? Have you encountered any other problems?
Also how did you make the pin connections? Can you share a basic example?
Thank you very much.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.