arduino-mcp2515 icon indicating copy to clipboard operation
arduino-mcp2515 copied to clipboard

Use of RTR and others

Open fkaraokur opened this issue 4 years ago • 4 comments

When I examine the details, the following statement goes!

/ * 32 bit CAN_ID + EFF / RTR / ERR flags * /

So how do we express this in code?

fkaraokur avatar Feb 09 '21 14:02 fkaraokur

Please check this line https://github.com/jxltom/micropython-mcp2515/blob/8d2415f368de271d3b2ba7dea2e7cf9fb2c076cf/demo.py#L57

I am using mcp2515 with arduino. this is probably the python code.

Actually I don't use RTR. But how should I express this? How to write a statement like this "CAN_no_RTR"?

tx_frame.FIR.B.FF = CAN_frame_ext; second I need to convert this expression. This is taken from another library.

fkaraokur avatar Feb 10 '21 10:02 fkaraokur

CAN_frame_t tx_frame;
    tx_frame.FIR.B.FF = CAN_frame_ext;
    tx_frame.MsgID = 0x01100033;
    tx_frame.FIR.B.DLC = 8;
    tx_frame.FIR.B.RTR = CAN_no_RTR;
    tx_frame.data.u8[0] = 0x01;
    tx_frame.data.u8[1] = 0x00;
    tx_frame.data.u8[2] = 0x00;
    tx_frame.data.u8[3] = 0x00;
    tx_frame.data.u8[4] = 0x00;
    tx_frame.data.u8[5] = 0x00;
    tx_frame.data.u8[6] = 0x00;
    tx_frame.data.u8[7] = 0x00;
    ESP32Can.CANWriteFrame(&tx_frame);

In summary, I need to convert the above codes. These codes belong to another library. But RTR and EXT are also specified. In this library it is written together. I could not convert these codes.

fkaraokur avatar Feb 10 '21 10:02 fkaraokur

prepareIdKutu kimliğinde RTR'yi ayarlamak için yöntemi kullanabilirsiniz.

example code pls thanks

fkaraokur avatar Feb 10 '21 11:02 fkaraokur

prepareIdKutu kimliğinde RTR'yi ayarlamak için yöntemi kullanabilirsiniz.

example code pls thanks

https://github.com/autowp/arduino-mcp2515/blob/cdc0141ee734f47f54628b1ac8acaafa9120511b/mcp2515.cpp#L509

very complicated. And won't the ext and RTR be prepaired at the same time?

fkaraokur avatar Feb 10 '21 12:02 fkaraokur