Hi,
I lose sporadic tx messages on the FlexCAN. There are two different impacts:
- I get a "STATUS_BUSY" from the FLEXCAN_DRV_Send() function. The message was not sent, so there is no interrupt (void FLEXCAN_IRQHandler(uint8_t instance)) that can set the message box back to idle.
- I get no error at all.
The misbehavior has nothing to do with the can-identifier or number of the message box It gets worse with high busload.
My remote unit (Vector CANoe and VN1610) checks the sequence as well as the crc / counter for plausibility. And some Messages are just lost. I double checked with an oscilloscope, the messages are not on the bus.
my Setup:
I use a S32k144 with SDK 4.2 (Configured with S32k Studio), baud is 500k. I send 10 tx messages and receive 6 rx messages. Each tx message has its own MessageBox. RxFifo is used.
My tx MB start at 16 and i configured CAN_CTRL1_LBUF(1U) (i need a fixed transmit order)
MB 16 all 20ms ( ID= 100 Message1 )
MB 17 all 20ms ( ID= 101Counter and CRC of Message 1)
MB 18 all 20ms ( ID= 120 Message2 )
MB 19 all 20ms ( ID= 121 Counter and CRC of Message 2)
MB 20 all 20ms ( ID= 140 Message3 )
MB 21 all 20ms ( ID= 141 Counter and CRC of Message 3)
MB 25 all 20ms ( ID= 160 Message4 )
MB 27 all 20ms ( ID= 161 Counter and CRC of Message 4)
MB 29 all 500ms ( ID= 200 Message5 )
MB 30 all 500ms ( ID= 201 Counter and CRC of Message 5)
CanConfig:
.fd_enable = false,
.pe_clock = FLEXCAN_CLK_SOURCE_OSC,
.max_num_mb = 32,
.num_id_filters = FLEXCAN_RX_FIFO_ID_FILTERS_8,
.is_rx_fifo_needed = true,
.flexcanMode = FLEXCAN_NORMAL_MODE,
.payload = FLEXCAN_PAYLOAD_SIZE_8,
.bitrate = {
.propSeg = 7,
.phaseSeg1 = 4,
.phaseSeg2 = 1,
.preDivider = 1,
.rJumpwidth = 1
},
.bitrate_cbt = {
.propSeg = 7,
.phaseSeg1 = 4,
.phaseSeg2 = 1,
.preDivider = 1,
.rJumpwidth = 1
},
.transfer_type = FLEXCAN_RXFIFO_USING_INTERRUPTS,
.rxFifoDMAChannel = 0U
Installed Error Callback
FLEXCAN_DRV_InstallErrorCallback(INST_CANCOM0, (flexcan_error_callback_t)flexcan_callback, &canCom0_State);
flexcan_event_type_t eventType, uint32_t buffIdx, flexcan_state_t *flexcanState)
{
can_callback_event = eventType;
callback_error_status = FLEXCAN_DRV_GetErrorStatus(instance);
}
I save the registers (CTRL1, IFLAG1, IMASK1, mb_idx, msg_id, state->mbs[mb_idx].state, ECR, ESR1, ESR2 ) in a trace. However, there are no suspicious things here either.
Does anyone have a tip for me?