Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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: SPI Error during SPI Communication

Part Number: TCAN4550

Hi,

     I am trying to configure TCAN4550 Registers via SPI and i am able to successfully communicate with the device  as read and write operation is getting executed successfully. But during the Operation sometime i am getting Error while reading the SPI Status Register (0x000C). The value i am getting while reading the register is 0x0001000A . and the error is "SPI read sequence ended with less data transferred then requested".

Could you please guide us to know the possible reason for the above mentioned error . Please let us know if we need to check other parameters to determine the reason for the error.

Please let me know if you need any further information.

Regards,

Kumar Ashutosh

  • Kumar,

    This is usually caused by an issue with the clock that connects to the TCAN4550. What clock rate are you using and can you send the part number?

    Regards,

  • Hi Eric,

      Thankyou for your response. Clock that connect the TCAN4550 is 40MHz and the part no is NX2016SA-40M-STD-CZS-3. The SPI baudrate we have configured to communicate with TCAN4550 is 1Mhz.

    Please let me know if you need any further information.

    Regards,

    Kumar Ashutosh

  • Kumar,

    Can you specify when this is happening or is it random?

    This error is caused by the read command requesting a defined amount of data (i.e. 2 words of data from a specific address) but returning less than expected. Is this happening when you're reading from the allocated memory, or a register on the TCAN4550?

    Regards,

  • Hi Eric,

     

         This is happening when CAN Frame Transmit Sequence is Executed. Below mentioned is the sequence.

        

    void CANFD_Test(void)
    {
    static uint8_t dataPayload[64] = {0};

    /* Define the CAN message we want to send*/
    TCAN4x5x_MCAN_TX_Header header = {0}; 

    header.DLC = MCAN_DLC_64B; 
    header.ID = TX_IDENTIFIER; 
    header.FDF = CANFD_ENABLE; 
    header.BRS = BRS_ENABLE; // Bit rate switch enabled
    header.EFC = 0;
    header.MM = 0;
    header.RTR = 0;
    header.XTD = 0; 
    header.ESI = 0; 


    Transmit_CANFD(&header, dataPayload);


    /*Receive CAN FRAME*/
    Receive_CANFD(dataPayload);

    }

    TRANSMIT FUNCTION:- 

    void
    Transmit_CANFD(TCAN4x5x_MCAN_TX_Header *header, uint8_t *dataPayload)
    {

    TCAN4x5x_MCAN_WriteTXBuffer(0, header, dataPayload); 

    TCAN4x5x_MCAN_TransmitBufferContents(0);

    }

    Please let me know if you need any further information.

    Regards,

    Kumar Ashutosh

  • Hi Eric,

      Can you Please update on above mentioned Issue.

    Regards,

    Kumar Ashutosh

  • Kumar,

    It seems like this would be occurring in the receive_CANFD function, but I can't find the definition in the sample code from the web. Is this a function you wrote yourself? And are there any other SPI reads in this function block? I ask because this flag gets thrown when reading back less data through SPI than what was expected.

    Also, one other point I wanted to make is that while this is an error flag, this doesn't cause any functions to stop working on the TCAN4550-Q1 device.

    Regards,

  • Hi Eric,

             we are using int pin interrupt to detect CAN receive event since this is the only interrupt signal connected to MCU in the PCB(GPIO1 pin is not used). We see software is stuck since the interrupt is continuously hit.  For our testing We have disable the receive part as of now and we have one dummy interrupt handler in which software is stuck since the interrupt is continuously hit.

    Below mentioned is the interrupt handler.

    CY_ISR(CAN_FD_RX_INTERRUPT_Interrupt)
    {

    TCAN4x5x_Device_ClearInterruptsAll();

    }

    Regards,

    Kumar Ashutosh

  • Kumar,

    Understood, that makes sense.

    Is it possible to address the questions in my previous post? This issue happens when SPI transactions receive less data than what was requested on the SPI transaction, but it's not obvious in your code snippet with the CAN frame transmission where that could be happening.

    Also, the SPI underflow error is indicated in the SPI transaction after the error occurs. So is this error being indicated in the same SPI transaction as the CAN transmit function, or after that transaction?

    Regards,

  • Hi Eric,

               I have removed the SPI read Functions in CAN Transmit and Receive function. I have observed that while transmission we are not receiving any empty frames now but the software is getting stuck in Interrupt .

    But during the Operation sometime i am getting Error while reading the SPI Status Register (0x000C).  Can you please let us know ,is any other configuration we need to do for Interrupt Execution.

    Regards,

    Kumar Ashutosh

  • Hi Eric,

      Can you Please update on above mentioned Issue.

    Regards,

    Kumar Ashutosh

  • Kumar,

    Can you read register 0x0820 as well to make sure you're getting only the SPIERR? The SPI underflow issue should trigger this flag but I want to know if any other interrupts are being thrown.

    And the error you're getting when reading 0x000C is the SPI underflow error, correct?

    Regards,

  • Hi Eric,

         I have read both the registers . Register 0x000C ,i am getting value "0x00000008" and reading 0x0820 i am getting "0x000004A0".  It seems after removing SPI read i am not getting Spi Error in 0x000C register but reading register 0x0820 , i am getting value 0x000004A0 and the error is CAN Error and still  software is getting stuck in interrupt.

    Please let me know if you need further information.

    Regards,

    Kumar Ashutosh

  • Kumar,

    The errors showing up in register 0x0820 are CAN silent, CAN error, and global error. CAN error is the logical OR of the CAN silent and CAN dominant interrupts, and global error is the logical OR of any interrupts in register 0x0820. So the CAN silent flag is what is causing the other two flags to be raised, and CAN silent is raised if the bus has no communication for longer than ~850ms (see the tsilence parameter in the datasheet). Once you clear this interrupt on write, then continue CAN messaging, it should no longer show up, and the nINT pin will no longer toggle low to interrupt the software.

    You can also disable the CAN silent interrupt by writing a 0 to bit 10 in register 0x0830 if you wish for this interrupt to not toggle the interrupt pin anymore.

    Please let me know if you have any questions.

    Regards,