cancel
Showing results for 
Search instead for 
Did you mean: 

Understand TX mailbox

Ash1
Associate II

Hi all

I want to understand behavior of TX mailbox here I am trying to send three ID but only i able to see two ID at a time in TIOR. I have fewer doubts which I hope you can clear.

Doubt 1:  Do I have to use three different mail box for three ID or One is enough .

Doubt 2. Like in RX mailbox I have locking mechanism in which I can see different RX frame in RXFIFO0 so I mean to say It can hold upto three different messages. So is there any logic in TX mailbox also to locked or to see all ID because I think it is overwriting the buffer.

 

 

CAN_TxHeaderTypeDef txHeader;

uint8_t tx_data[8] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};

uint32_t tx_mailbox_used;

 

txHeader.StdId = 0x3e8; // Example CAN ID

txHeader.RTR = CAN_RTR_DATA;

txHeader.IDE = CAN_ID_STD;

txHeader.DLC = 8;

 

if (HAL_CAN_AddTxMessage(&hcan1, &txHeader, tx_data, &tx_mailbox_used) != HAL_OK)

{

Error_Handler();

}

txHeader.StdId = 0x2bc; // Example CAN ID

txHeader.RTR = CAN_RTR_DATA;

txHeader.IDE = CAN_ID_STD;

txHeader.DLC = 8;

 

if (HAL_CAN_AddTxMessage(&hcan1, &txHeader, tx_data, &tx_mailbox_used) != HAL_OK)

{

Error_Handler();

}

txHeader.StdId = 0x100; // Example CAN ID

txHeader.RTR = CAN_RTR_DATA;

txHeader.IDE = CAN_ID_STD;

txHeader.DLC = 8;

 

if (HAL_CAN_AddTxMessage(&hcan1, &txHeader, tx_data, &tx_mailbox_used) != HAL_OK)

{

Error_Handler();

}

 

 

HAL_Delay(1000);

}

B.R

Ashish

0 REPLIES 0