Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User15457
Level 1
Level 1
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:
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.
0 Likes
10 Replies
User15457
Level 1
Level 1
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?
0 Likes
MoD
Employee
Employee
10 likes given 50 likes received 500 replies posted
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.
0 Likes
User15457
Level 1
Level 1
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?
0 Likes
User15457
Level 1
Level 1
Deleted...
0 Likes
MoD
Employee
Employee
10 likes given 50 likes received 500 replies posted
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.
0 Likes
User15457
Level 1
Level 1
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.
0 Likes
MoD
Employee
Employee
10 likes given 50 likes received 500 replies posted
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.
0 Likes
User15457
Level 1
Level 1
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?
0 Likes
MoD
Employee
Employee
10 likes given 50 likes received 500 replies posted
Yes, it is enough to give them all the same srcId.
0 Likes
User16898
Level 4
Level 4
it's not TX message that pose interrupt, the ACK bit send back from receiver pose an RX interruption,
0 Likes