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.

TMS320F28388S: TxOk bit usage to detect arbitration winner on network

Part Number: TMS320F28388S


Tool/software:

I wanted to detect which node is arbitration winner on CAN network. After sending PGN over j1939 I am checking for TxOk bit of 

CAN_ES register. as per data sheet this bit shall be set to 1 once successful transmission of message. But this bit is not getting set to one. Please help me with method to check the winning node over CAN network. 
  • Hi Tejaswinee,

    Arbitration is done by the CAN protocol itself and the node ID with the lowest address always has the highest priority to transmit if there are multiple nodes that are attempting to transmit.  Just curious why you needed to identify the node that won the arbitration manually.  Looks like you will be monitoring the arbitration for the transmitting node as you are looking at TxOk status, right?  Since there will be multiple transmitting nodes, how will you be able to detect the transmitting nodes simultaneously?  Probably better to monitor this on a receiving node and recording the node ID (which is part of the CAN frame) in the order that is was received.  You can use a timer in the CAN ISR (when a message is received) to time the order of frames as they are received.

    Regards,

    Joseph

  • hi Joseph,  

    Thank you for looking into this. We are having application where multiple control units will be communicating on J1939 CAN network and one who will win the arbitration will be the master. and henceforth only master will send the request for data. Once one master is decided others will go in listening mode. My code which will go on control units shall work as, 

    1. Consider first time transmission of proprietary PGN, No one is master on network yet. Send proprietary PGN and check if transmission is successful, if yes then current node will win the arbitration and is master. current node will claim the bus and announce over network that I am the master over proprietary PGN.

    2. Consider someone is already master over network go in listening mode and do not send PGN  

    Thank You,

    Tejaswinee 

  • Hi Tejaswini,

    I'm assuming that you are using the CAN-FD module in F28388S device since you are dealing with J1939.  We do not have software examples for this application but can provide some suggestions on how this may be carried out.  Based from your description, and assuming that each node is also set to receive as well as transmit messages, I would conclude that any node that has not completed frame transmission and has received a CAN frame is not the arbitration winner.  The arbitration winner will be the node that has successfully transmitted a frame and has not received any CAN frame at all.  Based from these assumptions, you can follow below steps:

    • Enable transmission complete interrupt by setting MCAN_IE.TCE register
    • Create an ISR (interrupt routine) for when Transmission Complete flag is detected.
    • Within this ISR:
      • check for the interrupt flag MCAN_IR.TC to confirm that transmission indeed has completed
      • check for bit MCAN_PSR.RFDF.  This bit is set if node received a CAN frame
      • You can put a conditional statement within this ISR such that if MCAN_IR.TC flag is set '1' and MCAN_PSR.RFDF is clear '0', then this is the node that won arbitration.  At this point you can set a flag or send a special CAN frame that will be broadcast in the CAN bus indicating that the transmission is from a node ID that won the arbitration.

    Regards,

    Joseph