Bug in MCAN_SetEXTFilterElement() ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug in MCAN_SetEXTFilterElement() ?

731 Views
gunnarbohlen
Contributor II

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));

0 Kudos
2 Replies

564 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Gunnar:

Thanks for your feedback, could you please let us know which board you are using?

Regards

Daniel

0 Kudos

564 Views
gunnarbohlen
Contributor II

Hi Daniel,

we have developed our own board. uController is LPC54618J512.

Now I don't use the fsl_mcan driver any more because I did have too many problems using this driver.

For example when I want to use several Buffers to send more than one can-message at once, only the LAST buffer number that is written to is stored.(I write to buffer 1,2,3 and 3 ist stored)  With the next tx-complete interrupt (buffer 1 transmitted) the driver tries to access buffer 3 and mark it as free, buffer 1 and 2 never get free again. Maybe I don't use the driver in the correct way? It works if I always only send one message and wait for transmit complete.

Instead I use the alternative CAN FD driver that is available from NXP.With this driver I can set up several tx-messages and all tx-complete events are processed correctly - and of course everything else woks as expected :-).

Regard,

Gunnar

0 Kudos