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.

TMS320F280049C: TMS320F280049C

Part Number: TMS320F280049C

Hi Vince Toledo

I am working on a project involving LIN communication. LIN module is working in Slave mode.

There were two types of message which i am using for my project:

when the master sends ID(0x10) with DATA, this LIN slave has to just receive the data.

when the master sends only the ID(0x11), this LIN slave has to send the response data.

When I am working, i am confused about how to set the HGEN CNTRL value.

i have used the below link as reference

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1114556/lin-module-discrepancy-in-technical-reference-manual-message-filtering-and-validation

I am having the problem exactly as in the above link even now.

In the latest manual reference(SPRUI33F) i found the below at 27.3.1.9

But however in the section 27.7.2.21

It is confusing as both were contradict to each other in the manual. which one is right?

1. Since the LIN module is a slave mode what is the value which needs to be set to HGEN CNTRL( 0 or 1?). HGEN CNTRL needs to be 1 for slave mode right?

2. what value to be set for TX mask, RX mask, IDSlaveTask ( for the two types of message explained above) as in  the manual explanation were contradict to each other as highlighted in the attached image?

Thanks in Advance!

Regards,

Akshaya Chokkalingam Ramanathan

  • Hi Akshaya Chokkalingam Ramanathan,

    Thanks for your question. Answering each:

    It is confusing as both were contradict to each other in the manual. which one is right?

    The register field descriptions for LINMASK.TXIDMASK and LINMASK.RXIDMASK are queued to update with revision G of the technical reference manual SPRUI33. The correct description for those register fields should read:

    “When HGENCTRL is set to 1, this field must be set to 0xFF if the complete ID must be compared.

    Since the LIN module is a slave mode what is the value which needs to be set to HGEN CNTRL( 0 or 1?). HGEN CNTRL needs to be 1 for slave mode right?

    Correct! HGENCTRL=1 for slave mode.

    what value to be set for TX mask, RX mask, IDSlaveTask ( for the two types of message explained above) as in  the manual explanation were contradict to each other as highlighted in the attached image?

    Please see the latest suggested answer from the thread here: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1114621/tms320f280049c-lin-module-in-slave-mode---how-to-initiate-response-transmission

    The example has all of the settings that need to be set for slave mode to work.

    The post starts with "Here is an example for the LIN slave mode" and has a block of code providing an example LIN slave setup.

    Regards,

    Vince

  • Hi Vince 

    Thank you for your answer. I am using interrupt method. I have used excel of what you have suggested in the below link to calculate TX mask, RX mask, IDSlaveTask. 

    https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1194114/tms320f280039c-question-on-lin-rx-tx-idslavetask-calculation.

    I got the below results

    As i said i am using LIN in slave mode. Master sends 0x10 ID with data - Slave receives the data. While Master send 0x11 ID alone - slave has to send the response.

    But when i have used above TX mask, RX mask, IDSlaveTask. from the attached image, it is not working!

    I would like to know am i using the correct excel and the mask,ID values were right or is there is something which i am missing - because it is not working as expected!

    Thanks in advance

    LG

    Akshaya

  • Hi Akshaya,

    This doesn't look like you are using the most recent version of the calculator, my calculator is showing different values (it's showing RX=41, which should be correct). I recommend using Solution-2, which has IDSLAVETASKBYTE=51, RXMASK=41, TXMASK=40.

    Regards,

    Vince

  • Hi Akshaya,

    Also please make sure you are using the correct PIDs when transmitting to the C2000 device. The PID for 0x10==0x50, and PID for 0x11==0x11. So if you are sending "0x10" without the parity bits correctly set, you will get both a parity error and no response.

    Regards,

    Vince

  • Hallo Vince

    Thank you very much for your answer. Can you provide the latest version calculator, because i had many requirement of different IDs. It would be helpful if i have the latest calculator.

    May i know the reason for recommendation of Solution 2.? As because i had 2 IDs and running in slave mode. One PID with data from master(0x10). Another PID without data from master(0x11) - slave has to send the response for this.( so from the excel solution 1 or solution 3 would be suitable for this? Is this right? or something is missing from my side.

    LG

    Akshaya

  • Hi Akshaya,

    See latest lin_mask_calculation calculator Excel file calculator here:

    4162.lin_mask_calculation_updated.xlsm

    I recommended solution 2 because of this text "data is received by the Slave first, before it transmits to avoid collision". This appears to be what you are intending to do for the part you mentioned here:

    One PID with data from master(0x10)
    slave has to send the response for this

    Regards,

    Vince

  • Hi Vince

    I think you have misunderstood my question. Let me try to explain properly

    My requirement was to run in slave mode:-

    Master send ID(0x10) with data - slave just receive the data and no need to send response. Only Rxmask in slave has to pass through this message.

    Master send ID(0x11) without data - slave has to send the response status. Only Txmask in slave has to pass through this message.

    As you suggested i have tried with solution 2( IDSLAVETASKBYTE=51, RXMASK=41, TXMASK=40). I am having a problem.

    When i am sending 0x10 with data from master , The Rxmask in slave allow this and respective RX ISR called(Worked as expected)

    But when i am sending 0x11 from master - RXmask and Txmask pass through this message, which i was not needed. Only Tx mask has to pass through this message as the master send ID without data.

    So i have tried solution 1 or 3  (IDSLAVETASKBYTE=51, RXMASK=1, TXMASK=40) - This satisfied my requirement.

    But then comes the other problem 

    I am having another requirement as same as above  

    Master send ID(0x20) with data - slave just receive the data and no need to send response. Only Rxmask in slave has to pass through this message.

    Master send ID(0x21) without data - slave has to send the response status. Only Txmask in slave has to pass through this message.

    Previously solution 1 or solution 3 has worked, so i have calculated with excel

    Here solution 2 and solution 1 or 3 has same IDSLAVETASKBYTE=61, RXMASK=41, TXMASK=0. 

    When i am sending 0x20 with data from master , The Rxmask in slave allow this and respective RX ISR called(Worked as expected)

    But when i am sending 0x21 from master - RXmask and Txmask pass through this message, which i was not needed. Only Tx mask has to pass through this message as the master send ID without data.

    The problem is both solution 2 and solution 1 or 3 has same RXmask, Txmask and IDSLAVETASKBYTE. In this case Solution 2 is actually happening but how to make sure solution 1 or 3 has to work in this case?

    Filter is not reliable when both solution has same settings and how to make sure our needed solution works but not the others in this case?

    LG

    Akshaya

     

  • Hi Akshaya,

    Let's resolve the first problem first. Then we can move onto the other problem.

    But when i am sending 0x11 from master - RXmask and Txmask pass through this message, which i was not needed. Only Tx mask has to pass through this message as the master send ID without data.

    From what you're describing, this should not be possible. If the IDSLAVETASKBYTE=51, and RXMASK=1, then an ID sent by master with value of 0x11 should not trigger it. See below, the bit 6 in red should trigger a NO-MATCH scenario.

    Can you confirm that you have set the HGEN bit to 1 by reading the appropriate register and showing a screenshot of that here? This sounds like the normal ID-Byte is being used instead of the ID-Slave Task Byte.

    Regards,

    Vince

  • Hi Vince

    I couldn't able to understand what you were saying!!

    I think the first problem has been resolved. For that you  have suggested Solution 2. That has not worked in  my case. Solution 1 or 3 works fine - this is what I have explained above.

    HGENCTRL sets ID-Slave Task Byte as you see the above image!

    Solution 2 which you described = ( IDSLAVETASKBYTE=51, RXMASK=41, TXMASK=40)

    But here the problem lies when master sending 0x11. Both RXMASK and TXMASK passing through. 

    When 0x11 sends from master without data. Slave just has to respond. So only TXMASK has to pass through for my requirement.

    The above image is solution 2. 0x11 pass through by both RXMASK and TXMASK. But only TXMASK has to pass through which was satisfied by solution 1 or 3. I have tried with solution 1 or 3 and my requirement was satisfied.

    But the real problem is 

    Here both solution 2 and solution 1or solution 3 has same RXMASK, TXMASK, IDSLAVETASKBYTE. How the controller filtering will differentiate both solution in this case. I need solution 1 or 3. As even solution 2 is having same mask and idslavetaskbyte - solution 2 is really happening when I am testing!

    LG

    Akshaya

  • Hi Akshaya,

    With the IDs RX=0x20 and TX=0x21, it is not possible for the RX to not be triggered when the TX is triggered. The RX will always trigger when TX triggers, for these two IDs. You have to change the IDs.

    That is why you're seeing this issue. Here's an explanation using an image:

    Notice how there is only a single "1" in the RXID row, at bit 5.  The problem is the TXID also has a "1" in the same spot. So there is no unique "1" for RXID. Every single "1" in the RXID also has a "1" in the TXID.

    So the solution is to change the RXID so it has a bit in one of the spots in yellow above.

    Example: Change RXID to 0x19

    That will give you the ability to mask RX and TX separately.

    Regards,

    Vince