This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS3137-EP: DCAN use in FIFO mode with HW Masks

Part Number: TMS570LS3137-EP
Other Parts Discussed in Thread: HALCOGEN, TMS570LC4357

Hi

I'm struggling to understand how to make use of the HW masks for filtering out CAN messages when using the controller with an Rx FIFO.

Note I'm using the Autosar MCAL in my project but I'm not so sure how this would work with HALCOGEN either.

Here is my current setup On DCAN0:

- 1 RX mailbox declared in the MCAL as basic with a fifo of 8 messages

- 56 TX maiboxes configures as full 

All IDs of the CAN messages circulating on the bus the ECU is connecto are standards (11bits long).

When ORing the ID values the ECU has to receive, it equates to 0x7F7

The setup of the mailbox is the following:

Can_MailboxType CanConfigSet_0_CanHardwareObject_0 =
{
1U, /* CanHandleType 0=Full, 1=Basic */
0U, /* CanIdType 0=standard 1=Extended 2=Mixed*/

0x7FF, //832U, /* ID value extended will have MSB set */

0U, /* CanObjectId - Holds handle Id, for CAN User to do IO on specified Object Handle */
1U, /* Hw object Index, first Object in FIFO*/
8U, /* =1 => Single object, else FIFO starting with <HwHandle>*/
0U, /* CanObjectType - Direction of Mailbox,0= Rx or 1= Tx*/

FALSE, /* CanTriggerTransmitEnable - This parameter is not used*/
&CanConfigSet_0_CanController_0, /* Controller */

0U, /* CanHwFilterCode - This parameter is not used */
0x7F7, /* CanHwFilterMask */
8U /* Length of the Mailbox */
};

With mask set to 0, then all messages are received.

With mask set to 0x7F7 no messages frpom the list are received but sending a dummy message with ID 0x7F7 will be received.

When mask is set to one of the IDs inthe list, only the message with this ID is received. 

The mailbox is behaving like a "full" mailbox type.

I need to be able to filter out some traffic as the FIFO size I've got is not large enough to contain all the messages received during each processing loops.

Some of those messages need to be gatewayed and they are getting dropped causing issues.

Thanks in advance for your help.

Regards

Seb

  • Hi Seb,

    DCAN FIFO mode allows you to receive a group of frames with the same ID (or same ID after filtering) and only generate an interrupt to the CPU when the last one comes in. If the most bytes you need to receive in this group is 64, you need to configure 8 mailboxes with the same identifier and mask. For example let's use mailboxes 1-8. The first 7 (1-7) set EoB (end of buffer) to 0 and RxIE (receive interrupt enable) to 0. On the eighth mailbox set EoB to 1 and RxIE to 1.

    You must check the NewDat bit of each mailbox as you read it. If NewDat=0, you need to skip this mailbox.

  • There is a HW bug in DCAN FIFO, please refer to the DCAN #27 in TMS570LC4357 Errata. This errta is also applicable to LS3137 device.

    DCAN#27 During DCAN FIFO Mode, received messages may be placed out of order in the FIFO buffer

    Severity: 3-Medium

    Expected Behavior: In DCAN FIFO mode, the received messages with the same arbitration and mask IDs are supposed to placed in the FIFO in the order which they are received. The CPU will then retrieve the received messages from the FIFO via the IF1/IF2 interface registers.

    Issue: Some messages may be placed in the FIFO out of the order in which they were received. If the order of the messages is critical to the application for processing, then this behavior will prevent the proper use of the DCAN FIFO mode.

    Condition: DCAN operates in FIFO mode and uses the CPU to read out the data.

    Implication(s): Application can not reliably use DCAN FIFO mode.

    Workaround(s): Use the DMA to read out the FIFO via the IF3 register. Each time a message is received into the FIFO the data is also copied to the IF3 register and a DMA request is generated to the DMA module to read out the data.

  • Hi 

    OK I missed this errata. Thanks for the feedback.

    Then the next question is how to setup the DMA with the Autosar MCAL ?

    Would you have an application note around to help ?

    Will this allow to overcome the limitation of 64 messages objects / CAN Controller ?

    Regards

    Seb

  • Hi Seb,

    As far as know, the DMA is not supported for CAN TX/RX in MCAL driver. I don't have an application note for doing this.