5 years, 7 months ago.  This question has been closed. Reason: Off Topic

CAN stops receiving frames?

I'm using LPC1768 to read CAN frames from a CAN node which generates messages constantly. After some messages arrive, mbed stops reading any more CAN messages, after reading them for a few seconds. The CAN node's pulling current, so it must still be generating CAN frames yet the mbed isn't able to read them for some reason.

can code

#include "mbed.h"
#include <time.h>  

RawSerial pcLogCOM13(USBTX,USBRX);       

CAN can1(p30, p29, 500000);
 CANMessage CANin;

void sendOverCAN();
void CANFrameIn();
void getTime();

time_t sysTime;
struct tm *lclTime;
char timeBuffer[32];

int main() {
    
    while(1) {
        CANFrameIn();
    }
}

void CANFrameIn() {
    getTime();
   
    if (can1.read(CANin)) {
        pcLogCOM13.printf("CAN frame received. len: %d, ID: %x, type: %d, format: %d, data: %x \n", CANin.len, CANin.id, CANin.type, CANin.format, CANin.data);
    } else {
        pcLogCOM13.printf("%s:CAN frame receive failed.\n", timeBuffer);
    }
}


void getTime() {
    time(&sysTime);
    lclTime = localtime(&sysTime);
    strftime(timeBuffer, sizeof(timeBuffer), "%x-%X", lclTime);
}

What could be the reason for this?