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

DAVE™ Forum Discussions

User8570
Level 3
Level 3
I am testing the CAN001App using external transceiver. Using the example, I am running on Main every 50 ms:


CAN001_UpdateMODataRegisters(&CAN001_Handle0,1,8,Data);
/* Send Data frame with ID 0x255 on chip internal CAN bus (Loop-Back Mode) */
CAN001_SendDataFrame(&CAN001_Handle0,1); //

I am not able to see any activity on Pin 1.9 (TX).

Any suggestions how to check the CAN001App /?

Thanks
0 Likes
7 Replies
Not applicable
Hi Jean Paul,

The simplest way to check the CAN001 App is just using CAN001_Example1. Un-check the "Enable Look Back mode" in CAN001_0 "CAN Configuration" tab. Generate code, compile, download and run. Make sure the external CAN Transceivers is connected. If you have XMC4500 CPU card and COM card, try it. The CAN_ Rx & Tx is assigned to P1.8 & 1.9.

BR,
Zain
0 Likes
User8570
Level 3
Level 3
Zain

Thanks for the suggestions. I was able to transmit data but I have another question which I had been reading in other posts about transmitting/receiving a CAN packet in the same LM0X. I changed the acceptance mask to 0 but it didn't work.

My ISR looks like:


void EventHandlerCAN001_0()
{

/* Check transmit pending status in LMO1 */
if(CAN001_GetMOFlagStatus(&CAN001_Handle0,1,TRANSMIT_PENDING) == CAN_SET)
{
/* Clear the flag */
CAN001_ClearMOFlagStatus(&CAN001_Handle0,1,TRANSMIT_PENDING);

}

if(CAN001_GetMOFlagStatus(&CAN001_Handle0,1,RECEIVE_PENDING) == CAN_SET)
{
/* Clear the flag */
CAN001_ClearMOFlagStatus(&CAN001_Handle0,1,RECEIVE_PENDING);
/* Read the received Message object and stores in variable CanRecMsgObj */
CAN001_ReadMsgObj(&CAN001_Handle0,&CanRecMsgObj,1);

}
}

I have connected the RX/TX Events to the NVC002 App for interrupt but I only got interrupts for the TX process. My CAN001 App looks like:

771.attach
0 Likes
Not applicable
Hi Jean Paul,

With referring to Forum thread "CAN001 tx/rx LMO problems", the proper way to configure a single LMO to both transmit and receive is:
1) To receive a data frame <- configure LMO as a Rx object
2) To send a data frame <- configure LMO as a Tx object

BR,
Zain
0 Likes
User8570
Level 3
Level 3
Zain

Thanks for your reply. I was able to get it working with your suggestion. Something I would like to know is the following :

Using CAN001 App in polling mode. Which register should I use to check if there is a new TX or Rx CAN message pending?

Is it possible to know how many CAN messages can be buffered using this app? Just in case if it takes some time to run the check on polling mode for a new message.
0 Likes
Not applicable
Hi Jean Paul,

You can use CAN001_GetMOFlagStatus() API which is checking Message Object n Status Register MOSTATn.
Unfortunately there is no FIFO buffer function provided in the App.

BR,
Zain
0 Likes
User8570
Level 3
Level 3
Zain

Thanks for the feedback. Wondering if I should use the native CAN registers to setup a FIFO or create one abode CAN001 App. Were you able to setup a CAN fifo on the XMC4500 family MCU?
0 Likes
Not applicable
Hi Jean Paul,

From the RM (Reference Manual) I understand that you can combine message objects to setup a FIFO buffer. Sorry I didn't try it before. Perhaps you can make a try and share your results.

BR,
Zain
0 Likes