|
![]() USB
![]() Endpoint freeze on Bulk
|
| next newest topic | next oldest topic |
| Author | Topic: Endpoint freeze on Bulk |
|
egawtry Member |
I have a MSD that runs for a few seconds, then stops working. I have traced it to In_count not being reset. This is standard MSD for the ISR.c file. Either the endpoint is going into stall, or the interrupt is not being called to reset In_count. Anyone know what could cause this? -Erik IP: Logged |
|
egawtry Member |
Found the issue. Many, many things wrong with the MSD code from SiLabs. When I get a few minutes, I will post some of the most glaring ones and the fixes. -Erik IP: Logged |
|
moxel New Member |
When I get a few minutes, I will post some of the most glaring ones and the fixes. Yes, please. I'm very interested in hearing about your findings. It looks like I'm having similar problems here... IP: Logged |
|
ferika Member |
Hi! Something like this? ----------------------------------------------- http://www.cygnal.org/ubb/Forum9/HTML/002088.html ----------------------------------------------- I had worry about, that the CPU's have hard/firm problems. It seems, like the CPU is very good, only that the software have problems and should be a little bit redesigned. If you have better code, that i found here and you agree, then pls. post it here. Thx, Feri IP: Logged |
|
egawtry Member |
I have made so many changes that it is difficult to relate them to the original code. I will try. 1. The FLASH timing flag is missing. Add:
At the bottom of the clock set if you are using USB_4X_CLOCK. 2. A trick I got from Tsuneo, if you are not bus powered, disable suspend:
Everywhere there is a POWER. I also added it just before setting the ports in Port_Init() just to be safe. 3. The tick timer is off. Use 0xF05C instead of 0xF05E. 4. Add a short delay before setting the crossbar in Port_Init();
5. In the descriptors: A. configuration_descriptor - bmAttributes - If you are not bus-powered, change to 0xC0 from 0x80. This will prevent random overheats in the usb hub. B. when Get_Descriptor() is called with DSC_CONFIG, the whole set needs to be returned, configuration_descriptor, interface_descriptor, and the two endpoint_descriptors. Group them into one structure containing all four, and return that structure and the size of the super-struct. C. Get_Descriptor() - DSC_STRING - String #3 the serial number. Always remember to return a unique number in UNICODE. 6. I turned on Reset_MSD() and Get_MaxLUN() although I'm not sure they are needed. 7. Important! Change USB_In to return a true or false depending on if Handle_In() is called. This is important later. 8. In MSD_MSD.c. A. Mistake - the MSD_READY code is very flawed. It throws out many good packets. Here is fixed code:
B. The MSD_STATUS_TRANSPORT assumes that the data is sent. That is incorrect. MSD can jam if the data is not sent. Based on setting the USB_In() to return a value:
This will keep trying until it succeeds or a recovery packet is sent. 9. MSD_scsi.c – This is really messed up. I rewrote it, so here are some of my basic changes: A. The Scsi_Standard_Inquiry_Data structure. The response format should be 0, not 2.
B. Mode Sense 6 should NOT be used. Mode Sense 10 is the one allowed for Mass Storage. And you also need to add the Flex Disk descriptor:
C. And the matching call in Scsi_rx():
D. On Read10 and Write10, the big mistake is using the cbw.dCBWDataTransferLength.
10. ntohs and ntohl are not defined in Keil
=========================================== I have many many more fixes, but they have to do with the disk. -Erik [This message has been edited by egawtry (edited August 13, 2010).] IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() |
|
Have you seen our MCU Knowledge Base?