autowp / arduino-mcp2515

Arduino MCP2515 CAN interface library
MIT License
795 stars 279 forks source link

sends 2 messages at once when I add multiple values to a frame #66

Open Loverboy7000 opened 3 years ago

Loverboy7000 commented 3 years ago

Hey,

I run in an issue with a custom board I made (uses an Atmega328PB), but it feels like this is a general issue. If I send a message adding only 1 value everything works fine. For example this is ok:

    canMsg1.can_id  = CANID;
    canMsg1.can_dlc = 8;
    canMsg1.data[1] = A0_Value;
    canMsg1.data[2] = 0x00;
    canMsg1.data[3] = 0x00;
    canMsg1.data[4] = 0x00;
    canMsg1.data[5] = 0x00;
    canMsg1.data[6] = 0x00;
    canMsg1.data[7] = 0x00;

    mcp2515.sendMessage(&canMsg1);

but once I populate the full message it always bursts the message out twice when calling sendMessage. Does someone have an idea whats wrong here?:

    canMsg1.can_id  = CANID;
    canMsg1.can_dlc = 8;
    canMsg1.data[0] = highByte(A0_Value);
    canMsg1.data[1] = lowByte(A0_Value);
    canMsg1.data[2] = highByte(A1_Value);
    canMsg1.data[3] = lowByte(A1_Value);
    canMsg1.data[4] = highByte(A2_Value);
    canMsg1.data[5] = lowByte(A2_Value);
    canMsg1.data[6] = highByte(A3_Value);
    canMsg1.data[7] = lowByte(A3_Value);

    mcp2515.sendMessage(&canMsg1);

Thanks for the help! Andre