Jul 17, 2019
12:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2019
12:45 AM
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:
For CAN node:
For Rx message Obj:
And my handler code:
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.
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:
canConfig.nodePointer[IfxMultican_SrcId_0].priority = CAN2_RX_INTERRUPT_PRIORITY;
canConfig.nodePointer[IfxMultican_SrcId_0].typeOfService =IfxSrc_Tos_cpu0;
For CAN node:
canNodeConfig.transferInterrupt.enabled = TRUE;
canNodeConfig.transferInterrupt.srcId = IfxMultican_SrcId_0;
For Rx message Obj:
canMsgObjConfig.rxInterrupt.enabled = TRUE;
canMsgObjConfig.rxInterrupt.srcId = IfxMultican_SrcId_0;
And my handler 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.
- Tags:
- IFX
10 Replies
Jul 17, 2019
02:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2019
02:44 AM
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?
Jul 17, 2019
03:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2019
03:25 AM
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.
Jul 17, 2019
04:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2019
04:11 AM
MoD wrote:
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?
Jul 17, 2019
05:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2019
05:12 AM
Deleted...
Jul 17, 2019
05:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2019
05:22 AM
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.
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.
Jul 17, 2019
05:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2019
05:31 AM
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.
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.
Jul 17, 2019
06:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 17, 2019
06:11 AM
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.
Jul 18, 2019
04:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 18, 2019
04:57 AM
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?
Jul 18, 2019
06:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 18, 2019
06:11 AM
Yes, it is enough to give them all the same srcId.
Jul 19, 2019
02:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 19, 2019
02:14 AM
it's not TX message that pose interrupt, the ACK bit send back from receiver pose an RX interruption,