8 years, 2 months ago.

FRDM K64- USB host no interrupts got

I used the USB host library from Norimasa Okamoto ( https://developer.mbed.org/users/va009039/code/F401RE-USBHost/) for my FRDM K64 board and then a simple app to test the MSD.

When I insert the USB stick into the OTG port, I do not get any interrupts and no interrupt function is called. I tried with USB keyboard,but the same result.

I keep getting "Please attach USB device". Never the interrupt function got called USBHALHost::UsbIrqhandler();

used the same code as in the example(F401RE-USBHostMSD_HelloWorld).

I also saw that MPU->CESR=0; is already present for FRDM K64 board.

Below is my main.cpp which is as below (taken from the same link as above from Norimasa Okamato.

main.cpp snippet

#include "USBHostMSD.h"
 
DigitalOut led1(LED1);
 
int main() {
    USBHostMSD msd("usb");
    if (!msd.connect()) {
        error("USB Flash drive not found.\n");
    }    
    FILE* fp = fopen("/usb/test1.txt", "a");
    if (fp) {
        fprintf(fp, "Hello from mbed.\n");
        for(int i = 0; i < 21; i++) {
            fprintf(fp, " %d", i);
            led1 = !led1;
        }
        fprintf(fp, "\n");
        fclose(fp);
    }
    fp = fopen("/usb/test1.txt", "r");
    if (fp) {
        int n = 0;
        while(1) {
            int c = fgetc(fp);
            if (c == EOF) {
                break;
            }
            printf("%c", c);
            n++;
            led1 = !led1;
        }
        fclose(fp);
        printf("%d bytes\n", n);
    }
 
    while(1) {
        led1 = !led1;
        wait_ms(200);
    }
}

Is there any input why this behaviour and no interrupts got ?

Regards yk

Be the first to answer this question.