RX and TX of messages on same flexcan

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RX and TX of messages on same flexcan

508 Views
vrushalitaklika
Contributor III

Hi,

I am trying to receive message on CAN_A.MB[0], and then after processing  transmit back message via same CANA via CAN_A.MB[8]. 

Observation: 

I can transmit the message 1st and then when I receive and agin call transmit function, it is not successfully transmitted.

initCAN_A();
TransmitMsg();
/* Loop forever */
while(1)
{
if(CAN_A.IFLAG1.B.BUF5I)
{

CAN_Message_Receive();
temp = CAN_A.TIMER.R;
CAN_A.IFLAG1.R = 0x00000020;

TransmitMsg();

}

0 Kudos
1 Reply

411 Views
vrushalitaklika
Contributor III

Here is my transmit function

void TransmitMsg(void)
{

CAN_A.MB[8].CS.R = 0x08600000; CAN_A.MB[8].ID.R = 0x12340000;
CAN_A.MB[8].CS.B.DLC = 1; // Set the data length in buffer 1
CAN_A.MB[8].DATA.B[0]= 8;
CAN_A.MB[8].CS.R = 0x0C610000;

while ( CAN_A.IFLAG1.B.BUF31TO8I == 0) { } // wait until the tx is completed.
CAN_A.IFLAG1.R = 0x00000100;
}

It hangs at while loop forever.

0 Kudos