Hi @Embedded_novice
Are you testing CAN2 with another node in the bus? Such as CAN analyzer or another CAN device. If CAN2 is not connected, try enabling loopback for single-node tests.
CAN error flag should be cleared like so:
CAN2->ESR1 |= FLEXCAN_ESR1_ERRINT_MASK; // Clear error interrupt flag
However, I can see ESR1 is empty. Maybe the flag has been cleared before you've stopped execution?
You can disable reentry by disabling error interrupts for now:
CAN2->CTRL1 &= ~FLEXCAN_CTRL1_ERRMSK_MASK;
CAN2->CTRL1 &= ~FLEXCAN_CTRL1_BOFFMSK_MASK
Best regards,
Julián