Hi there, I want to use more than 32 CAN objects for my application. Currrently TIVA driverlib only support upto 32 message objects. Is there any way I can extend the CAN message objects? Thanks
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.
Hi there, I want to use more than 32 CAN objects for my application. Currrently TIVA driverlib only support upto 32 message objects. Is there any way I can extend the CAN message objects? Thanks
Hi, Thanks for your reply. Problem is that for my application, I want to receive CAN messages from 40 different CAN IDs. Is there any way can I achieve this? Thanks
Mohsin Mahmud said:Hi, Thanks for your reply. Problem is that for my application, I want to receive CAN messages from 40 different CAN IDs. Is there any way can I achieve this? Thanks
Previous Reply said:Keep in mind that each object can represent multiple IDs
Hi, Thanks for your reply again. How can I receive multiple CAN messages from different IDs at the same using single message object? Can you send me some code for that? Thanks
Mohsin Mahmud said:How can I receive multiple CAN messages from different IDs at the same using single message object?
Just as I explained in the last post. Each message object has an ID and a mask to mask off the bits to compare. I gave you link that explains further. Do you have some specific questions?
Mohsin Mahmud said:Can you send me some code for that?
No. I don't have example code. Although there might be some in the TIVAWare examples.
Robert
Hi,
Problem is that when I try to send multiple CAN messages, I couldn't able to send using 1 message object. See my code below. When I call this in my program, I couldn't send 5 messages at the same time. Sorry for keep asking but I'm bit confused understanding this. Thanks
int i;
for (i = 0; i<5; i++)
{
g_sCAN0TxMessage.ui32MsgID = 0x001 + i;
g_sCAN0TxMessage.ui32MsgIDMask = 0x7ff;
g_sCAN0TxMessage.ui32Flags = MSG_OBJ_NO_FLAGS;
g_sCAN0TxMessage.ui32MsgLen = 4;
TxMsg1Data[0] = 0;
TxMsg1Data[1] = 1;
TxMsg1Data[2] = 2;
TxMsg1Data[3] = 3;
g_sCAN0TxMessage.pui8MsgData = TxMsg1Data;
ROM_CANMessageSet(CAN0_BASE, 1, &g_sCAN0TxMessage, MSG_OBJ_TYPE_TX);
}
Hi Robert, I'm trying to poll the status. I'm using interrupt on receivering CAN messages. I can't use interrupt to get Tx status as I want to send a can message upon receiving a CAN message in interrupt handler. Hence I want to poll the TX status.
Problem is that It never get the status back and hence It hangs my program. See my code below
g_sCAN0TxMessage.ui32MsgID = 0x001;
g_sCAN0TxMessage.ui32MsgIDMask = 0x7ff;
g_sCAN0TxMessage.ui32Flags = MSG_OBJ_NO_FLAGS;
g_sCAN0TxMessage.ui32MsgLen = 4;
TxMsgData[0] = 0;
TxMsgData[1] = 1;
TxMsgData[2] = 2;
TxMsgData[3] = 3;
g_sCAN0TxMessage.pui8MsgData = TxMsgData;
ROM_CANMessageSet(CAN0_BASE, 2, &g_sCAN0TxMessage, MSG_OBJ_TYPE_TX);
while (ROM_CANStatusGet(CAN0_BASE, CAN_STS_CONTROL) != 2)
{
}
Kindly guide me on this. Thanks.
Mohsin Mahmud said:Hi Robert, I'm trying to poll the status. I'm using interrupt on receivering CAN messages. I can't use interrupt to get Tx status as I want to send a can message upon receiving a CAN message in interrupt handler. Hence I want to poll the TX status
OK, this is more likely to fail than work. You've extended your receive interrupt time (and thus latency) tremendously.
There is no reason you couldn't either transmit using polling or a transmit interrupt to achieve this end. Given your apparent level of experience I'd suggest polling. Just set a flag in the interrupt that your main polling routine can read.
Mohsin Mahmud said:Problem is that It never get the status back and hence It hangs my program. See my code below
g_sCAN0TxMessage.ui32MsgID = 0x001;
g_sCAN0TxMessage.ui32MsgIDMask = 0x7ff
Use paste code (the </> symbol when you are editing in the formatted response window), the result is a lot more readable.
Mohsin Mahmud said:while (ROM_CANStatusGet(CAN0_BASE, CAN_STS_CONTROL) != 2)
I believe the return from this function is a bitmap, not an index.
Robert
Hi,
At this stage some hardware info are needed: did you checked with an oscilloscope if there is some activity on the bus?
Also, you mention some words about the CAN status - but what is its content? what bits are set? BOFF? also LEC field is important to detect what is wrong. Same for CANERR register - how many are reported.
Depending how the bus is realised, maybe sometime CAN bit timing should be carefully changed/trimmered.
Set a breakpoint and inspect those registers and figure out what really goes wrong.
From software point of view, maybe it will be useful to read some things about CANopen protocol, some useful ideas. There are some micros with this protocol embedded into ROM, similar to driverlib (unfortunately not from TI, but is good to know).