Hi,
So I have a message object which corresponds to some sort of acknowledgment in my protocol.
In a certain condition, I can have that message being not succcessfull due to other messages being sent by other transmitter on the bus (priority).
However, it can happen that this acknowledgment is never sent due to me rewriting new data in that message object before it is effectively sent so it's another acknowledgment (the one after in our code) that gets sent.
My transmission function is below.
How do I check before writing to the transmission message that the data has been effectively sent ?
It's a little mystical for me in the documentation.
void CAN_sendMessage32(volatile struct CAN_REGS * CanRegs, uint32_t msgObjNum, uint32_t * data) { // Use a Shadow variable for IF1CMD to prepare the data to perform a single 32-bit write. union CAN_IF1CMD_REG CAN_IF1CMD_SHADOW; // Wait for busy bit to clear. while(CanRegs->CAN_IF1CMD.bit.Busy) {} // Write data to transfer into DATA-A and DATA-B interface registers CanRegs->CAN_IF1DATA.all = data[0]; CanRegs->CAN_IF1DATB.all = data[1]; // Set Direction to write and set DATA-A/DATA-B to be transfered to message object CAN_IF1CMD_SHADOW.all = 0; CAN_IF1CMD_SHADOW.bit.DIR = 1; CAN_IF1CMD_SHADOW.bit.DATA_A = 1; CAN_IF1CMD_SHADOW.bit.DATA_B = 1; // Set Tx Request Bit to ask for transmission CAN_IF1CMD_SHADOW.bit.TXRQST = 1; // Transfer the message object to message object RAM. CAN_IF1CMD_SHADOW.bit.MSG_NUM = msgObjNum; CanRegs->CAN_IF1CMD.all = CAN_IF1CMD_SHADOW.all; }
Thanks,
Clément