AnsweredAssumed Answered

Bug in MCAN_SetEXTFilterElement() ?

Question asked by Gunnar Bohlen on Nov 24, 2017
Latest reply on Dec 13, 2017 by Gunnar Bohlen

Hello,

 

this function should copy the filter element into the memory buffer.

The existing code is:

void MCAN_SetEXTFilterElement(CAN_Type *base,
                              const mcan_frame_filter_config_t *config,
                              const mcan_ext_filter_element_config_t *filter,
                              uint8_t idx)
{
    uint8_t *elementAddress = 0;
    elementAddress = (uint8_t *)(MCAN_GetMsgRAMBase(base) + config->address + idx * 8U);
     memcpy(elementAddress, filter, sizeof(filter));    // BUG?
}

 

This memcpy() copies sizeof(filter) which is 4 bytes.

The filter element for 29bit CAN-ID's is 8 bytes, therefor I think it should be something like this:

memcpy(elementAddress, filter, sizeof(mcan_ext_filter_element_config_t));

Outcomes