My requirement is to check, if the USB is connected to my device or not.
I have implemented the following code from example drivers;
USBMSCHFatFs_Handle usbmschfatfsHandle; USBMSCHFatFs_Params usbmschfatfsParams; USBMSCHFatFs_Params_init(&usbmschfatfsParams); usbmschfatfsHandle = USBMSCHFatFs_open(Board_USBMSCHFatFs0,USB_DRIVE_NUM,&usbmschfatfsParams); if (!usbmschfatfsHandle) { sprintf(txBuffer,"Error starting the USB Drive\n"); UART_write(uart,txBuffer,strlen(txBuffer)); } else { sprintf(txBuffer,"\t\t\tDrive %u is mounted\n", USB_DRIVE_NUM); UART_write(uart,txBuffer,strlen(txBuffer)); USBMSCHFatFs_close(usbmschfatfsHandle); }
But when I remove, the USB drive, also it is showing Drive is mounted. Help needed