Will comment the sleep and try to go further.
Alexandre
Code: Select all
void can_lld_transmit(CANDriver *canp, canmbx_t mailbox, const CANTxFrame *ctfp) {
uint32_t put_index = 0;
uint32_t *tx_address = 0;
(void)mailbox;
osalDbgCheck(dlc_to_bytes[ctfp->DLC] <= CAN_MAX_DLC_BYTES);
/* Retrieve the TX FIFO put index.*/
put_index = ((canp->fdcan->TXFQS & FDCAN_TXFQS_TFQPI) >> FDCAN_TXFQS_TFQPI_Pos);
/* Writing frame. */
tx_address = canp->ram_base + (SRAMCAN_TBSA + (put_index * canp->word_size));
*tx_address++ = ctfp->header32[0];
*tx_address++ = ctfp->header32[1];
for (unsigned i = 0U; i < dlc_to_bytes[ctfp->DLC]; i += 4U) {
*tx_address++ = ctfp->data32[i / 4U];
}
/* Starting transmission.*/
canp->fdcan->TXBAR = ((uint32_t)1 << put_index);
/*
* FIXME This sleep not needed if we send two frames with different SID/EID
* why?
*/
osalThreadSleepMilliseconds(1);
}