Banner_AURIX_Security-Solution Banner_AURIX_Safety_Products ShieldBuddy TC275 Banner_AURIX_OnzerOS


infineon4engi@twitter twitter

infineon4engineers Facebook

infineon@linkedin linkedin

infineon@youtube youtube


+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Beginner Beginner Manvydas is on a distinguished road
    Join Date
    Jul 2018
    Posts
    7
    Points
    52.5

    TC27x Simple Multican Rx interrupt generation.

    Hello,
    I just started to using TC27x microcontroller, and I need some help. I try to setup CAN communication and I don't understand how to setup CAN Rx interrupt via iLLD library. I didn't find anything in documentations or application notes (from myinfineon for Aurix), but from search on forum I found
    that I need to configure:
    For CAN itself:
    Code:
    canConfig.nodePointer[IfxMultican_SrcId_0].priority = CAN2_RX_INTERRUPT_PRIORITY;
        canConfig.nodePointer[IfxMultican_SrcId_0].typeOfService =IfxSrc_Tos_cpu0;
    For CAN node:
    Code:
    canNodeConfig.transferInterrupt.enabled = TRUE;
            canNodeConfig.transferInterrupt.srcId = IfxMultican_SrcId_0;
    For Rx message Obj:
    Code:
    canMsgObjConfig.rxInterrupt.enabled	  = TRUE;
            canMsgObjConfig.rxInterrupt.srcId 	  = IfxMultican_SrcId_0;
    And my handler code:

    Code:
    IFX_INTERRUPT(ISR_can2_rx, 0, CAN2_RX_INTERRUPT_PRIORITY);
    void ISR_can2_rx(void)
    {
        //IfxCpu_enableInterrupts();
        IfxMultican_Message msg1;
        App_Multican* p_g_Multican = GetAppCanDataObj();
        IfxMultican_Message_init(&msg1, 0xdead, 0xdeadbeef, 0xdeadbeef, IfxMultican_DataLengthCode_8); /* start with invalid values */
    
        IfxMultican_Status  readStatus = IfxMultican_Can_MsgObj_readMessage(&(p_g_Multican->drivers.canRxMsgObj), &msg1);
        if ( readStatus & IfxMultican_Status_newData)
        {
            // handle new message here in msg1.data[]
        }
    }
    Maybe I have missed something? I can transmit CAN messages, so I assume that CAN and CAN node is initialized correctly (as far as Tx part)

    Edit:
    Handler is not triggered.
    Last edited by Manvydas; Jul 17th, 2019 at 02:00 AM.

  2. #2
    Beginner Beginner Manvydas is on a distinguished road
    Join Date
    Jul 2018
    Posts
    7
    Points
    52.5
    I found my first problem: CAN2_RX_INTERRUPT_PRIORITY was set to 0, so interrupt was never initialized. But as I understand now I get interrupt even if no message was received. It works on Tx and Rx. Is there is any possibility to get interrupt only on Rx?

  3. #3
    Advanced Advanced
    Infineon Employee
    Infineon Employee
    MoD is on a distinguished road
    Join Date
    Feb 2012
    Location
    Munich
    Posts
    71
    Points
    1344.375
    You use the same SrcId for transferInterrupt and the rxInterrupt of messageobject. If you need single interrupt of RX then you must use a SrcId only for this interrupt. You have 16 SrcIds available for all interrupts from Multican.
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  4. #4
    Beginner Beginner Manvydas is on a distinguished road
    Join Date
    Jul 2018
    Posts
    7
    Points
    52.5
    Quote Originally Posted by MoD View Post
    You use the same SrcId for transferInterrupt and the rxInterrupt of messageobject. If you need single interrupt of RX then you must use a SrcId only for this interrupt. You have 16 SrcIds available for all interrupts from Multican.
    But there is nothing missing in part of initialization of interrupt? Because if I remove transferInterrupt part, I can't receive any interrupts. So I think my Rx interrupt is not working at all.

    Edited:
    Finally I solved my puzzle. Everything was OK. Now I understand that Message object can accept only one message. So does it mean, that in total for one node you only can have 64 Rx/Tx messages??

    Edited 2:
    Maybe where is some detailed Application Note how to shuffle those Message Objects to be more flexible?
    Last edited by Manvydas; Jul 17th, 2019 at 06:18 AM.

  5. #5
    Beginner Beginner Manvydas is on a distinguished road
    Join Date
    Jul 2018
    Posts
    7
    Points
    52.5
    Deleted...
    Last edited by Manvydas; Jul 17th, 2019 at 06:14 AM. Reason: Multiposting

  6. #6
    Advanced Advanced
    Infineon Employee
    Infineon Employee
    MoD is on a distinguished road
    Join Date
    Feb 2012
    Location
    Munich
    Posts
    71
    Points
    1344.375
    In total you can have min. 0 up to max. 256 message objects for one node available.
    You have a set of 256 message objects which can be individually
    – Allocated (assigned) to any CAN node
    – Configured as transmit or receive object
    – Setup to handle frames with 11-bit or 29-bit identifier
    – Identified by a timestamp via a frame counter
    – Configured to remote monitoring mode
    If all 256 message objects are assigned to 1 can node then the other 3 can nodes are not usable bceause of no more message objects.
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  7. #7
    Beginner Beginner Manvydas is on a distinguished road
    Join Date
    Jul 2018
    Posts
    7
    Points
    52.5
    So in total I only can have 256 messages? Why I need such a thing like acceptance mask if I only can get one message to particular Message Object?

    Edit:
    And why this solution is better when like STM32 processors CAN solution, where you can get unlimited number of different ID's? I try think why infineon created mechanism like that.
    Last edited by Manvydas; Jul 17th, 2019 at 06:36 AM.

  8. #8
    Advanced Advanced
    Infineon Employee
    Infineon Employee
    MoD is on a distinguished road
    Join Date
    Feb 2012
    Location
    Munich
    Posts
    71
    Points
    1344.375
    Please have a look in the user manual chapter 23.4.9 Message Acceptance Filtering for understanding that you can get only 1 up to each messages in 1 message object.
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

  9. #9
    Beginner Beginner Manvydas is on a distinguished road
    Join Date
    Jul 2018
    Posts
    7
    Points
    52.5
    I have another question, how I make few Rx Message objects to call same interrupt on receiving message? Is it enough to give same srcId?

  10. #10
    Advanced Advanced
    Infineon Employee
    Infineon Employee
    MoD is on a distinguished road
    Join Date
    Feb 2012
    Location
    Munich
    Posts
    71
    Points
    1344.375
    Yes, it is enough to give them all the same srcId.
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.