Skip to content

MAX_DATA_LENGTH should be 8?Β #7

@TanvirTaaha

Description

@TanvirTaaha

CanMsg txMsg = CanMsg(
isExtendedFrame ? CanExtendedId(txIdentifier, isRtr) : CanStandardId(txIdentifier, isRtr),
4,
data);

which leads to:

SimpleCAN/src/CanMsg.h

Lines 43 to 50 in 1abb7f9

CanMsg(uint32_t const can_id, uint8_t const can_data_len, uint8_t const *can_data_ptr)
: id{can_id}, data_length{min(can_data_len, (uint8_t)MAX_DATA_LENGTH)}, data{0}
{
if (this->data_length > 0)
{
memcpy(data, can_data_ptr, data_length);
}
}

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 πŸ’œ

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions