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.

TMS570LS1224: CAN mailbox configuration tradeoffs

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

Context
My Halcogen application has the following requirements:

- Transmit 10 different CAN messages with a period of 250ms.
- Receive 10 different CAN messages with a period of 250ms.

Let's assume we can ignore message priority.
Let's assume we can only use the CAN1 peripheral.
Let's assume the CAN bus has only those messages on it.

Solution
To my understanding, to solve this problem, I could do 

- 1 mailbox for receiving with a filter accepting all 10 CAN message's ID
- 1 mailbox for transmitting

I could also do

- 10 mailbox for receiving; each mailbox only 1 message ID
- 10 mailbox for transmitting; each mailbox only 1 message ID

or, of course, an in-between solution.

Questions
How do you select the proper CAN mailbox configurations strategy?
Is there some TI app notes about evaluating those tradeoffs and explaining CAN nodes configuration (SPNA131 is not detailed enough, IMO)?
I would like to better understand:
- How does mailbox handle message collisions? 
- What happens if multiple messages arrive at the same time in the same mailbox?
- How does the TI SDK (canMessageNotification) handle multiple interrupts from multiple mailboxes?
- How big is the internal CAN node Queue (when a message will be deleted)?


Regards,
Gabriel 

  • Hello,

    The CAN mailbox is used to define the message object and the ID mask. The CAN frame on CAN bus has many fields which are specified in message object: IDE (11-bit ID, or 29-bit ID), ID which also sets the message priority, DLC, Data bytes. Make sure two nodes will never send the same ID value at the same time. 

    Any CAN node starts a transmission when it has detected an IDLE bus. Two or more nodes may start a message at the same time. The conflict or collision is resolved by the arbitration. Arbitration is performed bit-wise (bit by bit on the ID and the IDE bit, no other bits are used). The node with the highest priority (lower ID value) continues and lesser priority nodes stop sending and immediately turn into receivers. Note: The losing node “knows” the beginning of the other message. CAN arbitration is non-destructive. The losing nodes will attempt to re-transmit at the next idle bus time.

  • - What happens if multiple messages arrive at the same time in the same mailbox?

    QJ> there is only one valid message on CAN bus at a time. 

    - How does the TI SDK (canMessageNotification) handle multiple interrupts from multiple mailboxes?

    QJ> The interrupt source is determined by the int1ID and int0ID in the interrupt register. The message object 1 has the highest priority, and last message object (for example 64) has the lowest priority. The interrupt service routine (ISR) resets the message object's IntPnd when reading the message. When intPnd is cleared, the interrupt register will point to the next pending object with a pending interrupt (interrupt pending x register).

    - How big is the internal CAN node Queue (when a message will be deleted)?

    QJ> LS1224 supports 64 mailboxes. The CAN module doesn't delete the received message in message RAM. But the received message object in message RAM may be overwritten by the new coming message.

  • Hi QJ,

    Thanks for your answer.

    I'm familiar with the CAN protocol, but not with the TI SDK. (The TI SDK approach for HAL configuration is different from other manufacturers (NXP S32SDK, STM32 CubeMx, Nordic Semiconductor, etc))


    I want to define my CAN message inside of my source code. Not inside halcogen.

    Therefore, If I want to configure dynamically 1 mailbox for sending CAN message, I need to 

    1. Update the mailbox ID with `canUpdateID()`
    2. Update the mailbox DLC with ???
    3. Send the information with `canTransmit()`

    To my understanding, there's no API for changing the mailbox size in the SDK?
    Does the mailbox adjust automatically?

    Another approach to solving this problem would be to configure the CAN mailbox before calling canInit().
    Can this be done with `can2GetConfigValue()`?



  • Hello Gabriel ,

    There is no API for changing the DLC. In the HALCoGen generated code, the DLC is defined in canInit(). You can add code in canTransmit() to change the DLC, or you can write a new API to change the DLC.

    can2GetConfigValue() does retrieve the config value of control registers, but not mailbox