Hello Everyone,
I have a problem with MPC5746C SDK Flexcan Driver. I try to transmit and receive data with sample code (flexcan_mpc5746c). I can receive succesfully but I can not transmit data from CAN0.
Message buffer is contuniuesly in FLEXCAN_TX_BUSY state. How can I fix this issue ? There is an sample code attached for simple flexcan tx/rx trial.
status_t FLEXCAN_DRV_GetTransferStatus(uint8_t instance, uint8_t mb_idx)
{
DEV_ASSERT(instance < CAN_INSTANCE_COUNT);
const flexcan_state_t * state = g_flexcanStatePtr[instance];
status_t status;
if (state->mbs[mb_idx].state == FLEXCAN_MB_IDLE)
{
status = STATUS_SUCCESS;
}
else
{
status = STATUS_BUSY;
}
return status;
}
I have looked over your project and are some inconsistency between driver configuration and the transmit configured MB. The driver is configured from non FD operation and you try to send a data as FD frame this is why you can receive but not transmit.
If you want classic frame nonFD you should use at config tx MB and send next configuration:
flexcan_data_info_t dataInfo =
{
.data_length = 1U,
.msg_id_type = FLEXCAN_MSG_ID_STD,
.enable_brs = false,
.fd_enable = false,
.fd_padding = 0U
};
BR,
Alexandru Nan