Can_tx_rx same time

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

Can_tx_rx same time

735 Views
intern_praveena
Contributor II

How can transmit and receive at a time?? I am using CAN_PAL.Here is my code,CAN any one help me??

/*************************************/

CAN_Init(INST_CAN_PAL1, &can_pal1_Config0); //CAN intialize

can_buff_config_t tx_buff = {
.enableFD = false,
.enableBRS = true,
.fdPadding = 0U,
.idType = CAN_MSG_ID_EXT,
.isRemote = false
};

CAN_ConfigTxBuff(INST_CAN_PAL1,0,&tx_buff);

can_message_t tx_msg = {
// .cs = 0U,
.id = 0x01,
.data[0] = 0x02,
.data[1] = 0x04,
.data[2] = 0x08,
.length = 3
};
can_buff_config_t rx_buff = {
.enableFD = 0,
.enableBRS = true,
.fdPadding = 0U,
.idType = CAN_MSG_ID_EXT,
.isRemote = false
};

CAN_ConfigRxBuff(INST_CAN_PAL1,0,&rx_buff,1);

can_message_t rx_msg = {
//.cs = 0U,
.id = 1,
.length = 2

};

while(1)
{
CAN_Send(INST_CAN_PAL1,0,&tx_msg);
CAN_Receive(1,0,&rx_msg);

}

/****************************************/

0 Kudos
2 Replies

587 Views
alexandrunan
NXP Employee
NXP Employee

On which chip and what sdk version you use ?

Second what configuration was applied to CAN_Init ? Because from your configuration of tx message buffer is something not right, becasue brs and fd must be enable else the function will return status error. in your code first I suggest to check the function status return in case something is wrong or missconfigured. 

And the major issue is that the Pal function requires a structure as parameter that identify the structure type and instance number not a macro defined as symbol for instance no. 

CAN_Init(INST_CAN_PAL1, &can_pal1_Config0);

This is correct only if you defined the symbol INST_CAN_PAL1 as address to the structure.

0 Kudos

587 Views
vinothkumars
Senior Contributor IV

Praveena,

What is the result, did you check send and receive separately?

Is there any packet loss, which address mode and what is the frequency?

Please provide the full file also.

Regards,
Vinothkumar Sekar
0 Kudos