Hi Kevin
The last test version had a huge delay of 8s and I can't imagine that the stick is still not ready, but I can't be sure at the moment. To get to the bottom of this and also allow identifying problems in the future (based on the fact that different memory sticks can behave very differently) it looks like much better debug output is going to be required, as well as the host also being very tolerant to some errors in the process that it needs to handle with repetitions and such. This will probably not be a simple and will require a lot of documenting in order to be able to follow (USB is not the nicest protocol to analyse and track). In the meantime it may be wise to find a stick that actually works reliably (as several that I have do, and also as my Cruzer does as long as I have an initial delay of greater than about 2s).
In the meantime your Cruzer stick is of course an interesting case that will also need to be understood and solved.
Attached you will find a diagram that I have which illustrates the operation of the HW driver, generic USB and class/application parts. They are not that simple to understand at the moment (I use simulation as well to make things fully clear as to how they are intended to operate) but it will help me to formally document and add error handling cases where needed - you will see quite a lot of timeout situations which will need to be handled. It is worth noting that such things are not actually handled by the HW so I plan on using a PIT for high accuracy interrupt based error timing (the HW driver already need this to generate reset timing anyway).
Since I certainly have an issue with my Cruzer stick that is not ready for operation until the power has been applied for around 2s, and I know that it stalls when operations are attempted, I have added the stall handling in the diagram. At the moment I don't remember the details of clearing a stall (I have done it at devices but will need to study up to do it as the host) but I have now added an event that the application will report on. This would then allow proving the situation for your stick - whether it is really still stalling after 8s!! [By the way - my stick would also need > 2s before the PC could work with it so if you can work with it and a PC within 8s it is also probably something else....].
Below is a reference of my Cruzer with no delay (showing the stall on the request as expected) - and then with an 8s delay (where it mounts and loads SW).
Attached is a version with this same output and a 16s delay so that you can verify with your stick. As noted before it would certainly be best to have a couple of reference sticks that do work reliably until the other ones are sorted out... I am hoping that there are not such sticks that are really going to need > 10s 'warm-up time' since it would still be anoying, even if the loader handles them correctly!
Regards
Mark
uTasker Serial Loader
=======================
[0x00008080/0x00017fff]
bc = blank check
dc = delete code
go = start application
> USB FS device detected
USB device information ready:
USB2.0 device with 64 byte pipe
Vendor/Product = 0x0781/0x5406
Manufacturer = "SanDisk"
Product = "U3 Cruzer Micro"
Serial Number = "43172009D7514E7"
Bus-powered device (max. 100mA) with 1 interface(s)
Mass Storage Class : Sub-class = 0x06 interface protocol = 0x50
Endpoints:
1 = BULK IN with size 64
2 = BULK OUT with size 64
Enumerated (1)
LUN = 2
UFI INQUIRY -> Status transport - OK
UFI REQUEST SENSE -> Status transport - OK
UFI FORMAT CAP. -> Stall on EP-0 <--- verification of stall on UFI FORMAT CAP. when requested quickly (presently halting further operation)
Mem-Stick not present
Mem-Stick not present
Mem-Stick not present
uTasker Serial Loader
=======================
[0x00008080/0x00017fff]
bc = blank check
dc = delete code
go = start application
> Mem-Stick not present
Mem-Stick not present
Mem-Stick not present
Mem-Stick not present
Mem-Stick not present
Mem-Stick not present
Mem-Stick not present <--- 8s delay in this case
USB FS device detected
USB device information ready:
USB2.0 device with 64 byte pipe
Vendor/Product = 0x0781/0x5406
Manufacturer = "SanDisk"
Product = "U3 Cruzer Micro"
Serial Number = "43172009D7514E7"
Bus-powered device (max. 100mA) with 1 interface(s)
Mass Storage Class : Sub-class = 0x06 interface protocol = 0x50
Endpoints:
1 = BULK IN with size 64
2 = BULK OUT with size 64
Enumerated (1)
LUN = 2
UFI INQUIRY -> Status transport - OK
UFI REQUEST SENSE -> Status transport - OK
UFI FORMAT CAP. -> Status transport - OK <---- now they pass without stalling
UFI READ CAP. -> Status transport - OK
Mem-Stick mounting...
Sec 0x00000000 OK
Sec 0x00000034 OK
Sec 0x00000035 OK
Disk E mounted
Mem-Stick present
Sec 0x00000f40 OK
Sec 0x00000f41 OK
Sec 0x00000f42 OK
Chunk removed...
Sec 0x00000f48 OK
Sec 0x00000f49 OK
Sec 0x00000f4a OK
Sec 0x00000f4b OK
Part 0x0000/8 0x008f5b40 OK
Part 0x0008/256 0x008f5b40 OK
Part 0x0108/248 0x008f5b40 OK
Part 0x0000/8 0x008f5b41 OK
Part 0x0008/256 0x008f5b41 OK
Part 0x0108/248 0x008f5b41 OK
Part 0x0000/8 0x008f5b42 OK
Part 0x0008/256 0x008f5b42 OK
Part 0x0108/248 0x008f5b42 OK
Part 0x0000/8 0x008f5b43 OK
Part 0x0008/256 0x008f5b43 OK
Part 0x0108/248 0x008f5b43 OK
Part 0x0000/8 0x008f5b44 OK
Part 0x0008/256 0x008f5b44 OK
Part 0x0108/248 0x008f5b44 OK
Part 0x0000/8 0x008f5b45 OK
Chunk removed...
Part 0x0000/8 0x008f5b70 OK
Part 0x0008/256 0x008f5b70 OK
Part 0x0108/31 0x008f5b70 OK
File valid
Part 0x0008/4 0x008f5b40 OK
Part 0x000c/256 0x008f5b40 OK
Part 0x010c/244 0x008f5b40 OK
Part 0x0000/12 0x008f5b41 OK
Part 0x000c/256 0x008f5b41 OK
Chunk removed...
Part 0x0000/12 0x008f5b70 OK
Part 0x000c/256 0x008f5b70 OK
Part 0x010c/27 0x008f5b70 OK
Software Updated
Hello, world... KINETIS <--- loaded application running