Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 8 months ago.
usbhost for FRDM K64-no interrupts
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 was the interrupt handler got called USBHALHost::UsbIrqhandler();
I used the same main.cpp code as in the example(F401RE-USBHostMSD_HelloWorld).
main.cpp snippet
#include "USBHostMSD.h"
DigitalOut led1(LED_GREEN);
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);
}
}
What could be the problem here ?
I already see that the code contains the change required for K64 platform
snippet
#if defined(TARGET_K64F)
MPU->CESR=0;
#endif
Regards yk