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.

TCAN4550: Unable to receive XID data frame, work pretty well with SID data frames

Part Number: TCAN4550

I'm using TCAN4550 with Arduino MEGA2560. When I working with SID, I'm receiving data well. But when I configure the XID filter the Interrupt won't fire up. I think XID filter doesn't work properly.
I referred the TCAN4550 demo code. It seems to be any issue with the code. I have attached the code here

/* Setup filters, this filter will mark any message with ID 0x055 as a priority message */

// TCAN4x5x_MCAN_SID_Filter SID_ID = {0};
// SID_ID.SFT = TCAN4x5x_SID_SFT_CLASSIC; // SFT: Standard filter type. Configured as a classic filter
// SID_ID.SFT = TCAN4x5x_SID_SFT_RANGE; // Range Filter. SFID1 holds the start address, and SFID2 holds the end address. Any address in between will match
// SID_ID.SFEC = TCAN4x5x_SID_SFEC_STORERX0; // Standard filter element configuration, store it in RX fifo 0 as a priority message
// SID_ID.SFID1 = 0x10; // SFID1 (Classic mode Filter)
// SID_ID.SFID2 = 0x7FF; // SFID2 (Classic mode Mask)
// TCAN4x5x_MCAN_WriteSIDFilter(0, &SID_ID); // Write to the MRAM

/* Store ID 0x12345678 as a priority message */
TCAN4x5x_MCAN_XID_Filter XID_ID = {0};
//XID_ID.EFT = TCAN4x5x_XID_EFT_CLASSIC ;
XID_ID.EFT = TCAN4x5x_XID_EFT_RANGE ; // EFT
XID_ID.EFEC = TCAN4x5x_XID_EFEC_PRIORITYSTORERX0; // EFEC
XID_ID.EFID1 = 0xCFF0308; // EFID1 (Classic mode filter)
XID_ID.EFID2 = 0xCFF1008; // EFID2 (Classic mode mask)
TCAN4x5x_MCAN_WriteXIDFilter(1, &XID_ID); // Write to the MRAM

When I use the XID filter I comment out the SID filter. What I need is I want to use an XID filter to filter ID's in the range of 0xCFF0308

  • Hi Nisal,

    Have you modified the MRAMConfiguration variable to have zero SID elements? If each of the defined elements is not populated with their respective filters, the behavior of the ID filters may be off. Make sure you have updated this value if you have commented out the SID filter shown above. You may also test the XID filter with both filters enabled to make sure that the extended ID works well without modifications to the program. 

    	/* ************************************************************************
    	 * In the next configuration block, we will set the MCAN core up to have:
    	 *   - 1 SID filter element
    	 *   - 1 XID Filter element
    	 *   - 5 RX FIFO 0 elements
    	 *   - RX FIFO 0 supports data payloads up to 64 bytes
    	 *   - RX FIFO 1 and RX Buffer will not have any elements, but we still set their data payload sizes, even though it's not required
    	 *   - No TX Event FIFOs
    	 *   - 2 Transmit buffers supporting up to 64 bytes of data payload
    	 */
    	TCAN4x5x_MRAM_Config MRAMConfiguration = {0};
    	MRAMConfiguration.SIDNumElements = 1;						// Standard ID number of elements, you MUST have a filter written to MRAM for each element defined
    	// Change the above value to 0 if no SID filter elements are used
    	MRAMConfiguration.XIDNumElements = 1;						// Extended ID number of elements, you MUST have a filter written to MRAM for each element defined
    	MRAMConfiguration.Rx0NumElements = 5;						// RX0 Number of elements
    	MRAMConfiguration.Rx0ElementSize = MRAM_64_Byte_Data;		// RX0 data payload size
    	MRAMConfiguration.Rx1NumElements = 0;						// RX1 number of elements
    	MRAMConfiguration.Rx1ElementSize = MRAM_64_Byte_Data;		// RX1 data payload size
    	MRAMConfiguration.RxBufNumElements = 0;						// RX buffer number of elements
    	MRAMConfiguration.RxBufElementSize = MRAM_64_Byte_Data;		// RX buffer data payload size
    	MRAMConfiguration.TxEventFIFONumElements = 0;				// TX Event FIFO number of elements
    	MRAMConfiguration.TxBufferNumElements = 2;					// TX buffer number of elements
    	MRAMConfiguration.TxBufferElementSize = MRAM_64_Byte_Data;	// TX buffer data payload size

    Let me know if this works or if you are still having the problem after checking this variable. 

    Regards,
    Eric Schott