cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple CAN frames

Choudharyas
Associate III

Hi,

I am working on a CAN Bus project with TCAN1051 and STM32G0. In this project i have to send approx. 175 bytes of data though CAN. It will take around 22 frames to send this data. And i can't figure out how to send all the frames. If i send all of them at once i might get RX_FIFO overflow error. Can anyone help me with this. Thanks

2 REPLIES 2
Javier1
Principal
 
	//check space in the mailbox
	howmanyTXmailboxes = HAL_CAN_GetTxMailboxesFreeLevel(hcan_object_reference);
 
	if (howmanyTXmailboxes > 0) {
		status = HAL_CAN_AddTxMessage(hcan_object_reference, &canTxheader,
				messageTxData, &pTxMailbox);
		if (status != HAL_OK) {
			//Canbus_Error_handler(1); //error de transmision
		}
	}else{//OR FULL MAILBOX
		status=HAL_BUSY;
		HAL_CAN_AbortTxRequest(hcan_object_reference, CAN_TX_MAILBOX0+CAN_TX_MAILBOX1+CAN_TX_MAILBOX2);//empty all mailboxes
	}

Or, If you dont want to get very smart about it, a simple HAL_Delay(10) in between canbus TX should be enough (at 125Kbauds)

we dont need to firmware by ourselves, lets talk

Okay got it, Thanks.