I have verified AN4379 MSC bootloader on FRDM-KL25Z successfully. https://community.freescale.com/docs/DOC-97782
Now I am doing the same thing on FRDM-K20D50M. The bootloader can enumerated on Windows XP. But saving S19 files failed.
So I put debug printf() in MSD_Event_Callback() of disk.c.
printf("event=%02X",event);
switch (event)
case USB_APP_DATA_RECEIVED (0x4) -> br
case USB_APP_SEND_COMPLETE (0x03) -> br
case USB_MSC_START_STOP_EJECT_MEDIA -> br
case USB_MSC_DEVICE_READ_REQUEST (0x81)
case USB_MSC_DEVICE_WRITE_REQUEST (0x82)
case USB_MSC_DEVICE_FORMAT_COMPLETE -> br
case USB_MSC_DEVICE_REMOVAL_REQUEST (0x84)
case USB_MSC_DEVICE_GET_INFO (0x85)
default -> br
After sending file to bootloader, I found following log on terminal.
......
event=03
event=82
offset=0x00000000,offset>>9=0x00000000
event=84
event=03
The normal operation should be a sequence of event 0x82 (USB_MSC_DEVICE_WRITE_REQUEST ). But K20 firmware stops and host calls USB_MSC_DEVICE_REMOVAL_REQUEST later on.
The host reports Cannot copy K20_DEMO: The request could not be performaned because of an I/O device error.
K20_DEMO.S19 is a demo project with relocated address starts from 0x8000.
Any idea? Why host send USB_MSC_DEVICE_REMOVAL_REQUEST for which error?