owennewo / SimpleCAN

A CAN Bus library for Arduino and other platforms
9 stars 2 forks source link

MAX_DATA_LENGTH should be 8? #7

Open TanvirTaaha opened 3 months ago

TanvirTaaha commented 3 months ago

https://github.com/owennewo/SimpleCAN/blob/1abb7f97978592e77db0f42ea0816a0b589cc002/examples/normal_standard_id/main.cpp#L44-L47

which leads to:

https://github.com/owennewo/SimpleCAN/blob/1abb7f97978592e77db0f42ea0816a0b589cc002/src/CanMsg.h#L43-L50

I am new to stm32 and CAN bus in general. I was trying to communicate from a stm32 b-g431b-esc1 to Arduino using CAN bus. I was going through your example code and came across this line. As far as I know CAN data bits are max 8bytes long right? But here you have defined this macro MAX_DATA_LENGTH to be 64. Is it a mistake between bits and bytes? Correct me If I'm wrong. TIA 💜

owennewo commented 3 months ago

That particular file is me trying to make this interface similar to the one used by the new uno r4 (renesas). The file represents the api and i pretty much lifted it from that with little thought. Canfd supports 64bytes but older can2b supports only 8. I suspect you are right that I've not implemented enough to switch up to 64bytes so it is wasteful.