I'm using STM32F103 and I can't read and neither clear the flag, I'm trying in the interrupt function this is the code:
void USB_LP_CAN_RX0_IRQHandler (void) {
if(CAN->RF0R & CAN_RF0R_FOVR0) { lost_frame++; CAN->RF0R |= CAN_RF0R_FOVR0; }
if (CAN->RF0R & CAN_RF0R_FMP0) { // message pending ? CAN_rdMsg (&CAN_RxMsg); // read the message Packages_received++; CAN_RxRdy = 1; // set receive flag } }