2010-12-06 02:36 AM
STM32F107 and USB Stick - Read fails after few packets
2011-05-17 05:17 AM
After further investigation it seems to me, that the OTG core receives some packets and does not store them in the FIFO. When the problem occurs during a transfer of a block (512 Bytes = 8x 64Byte packets) PKTCNT in HCTSIZ is set to 0, but only half of the packets (4 out of 8) are reported, stored and fetched from the FIFO. No RXLVL for the remaining 4 packets occurs, but I do get some ACK interrups. Like if there were empty packets sent by the USB stick.
Currently I am stuck and have no ideas any more. (Besides moving to the LPC1768...). Any suggestions are welcome...2011-05-17 05:17 AM
How about programming another board (an STM32F103 board for instance) as a USB mass storage device and communicating with that. Then you will be able to monitor (and control) exactly what is being sent to the STM32F107.
2011-05-17 05:17 AM
Yep, I already considered that, too. But this will make things really complicated. Especially as the OTG controllers are not easy to debug - they change their state by simply reading a register (GRXSTSP). Maybe the non OTG in the F103 is more user friendly? but I am not familiar with it at all...
Of course the easiest solution would be to buy a USB protocol analyzer. And at the same time the most expensive, I guess. If there is a way to find out what deivce is sending on the USB bus, I would simply hook the logic analyzer to it. Because of frame positions, length of signal, etc. some information can be collected without looking at the bytes in detail. This may be enough at the moment and help to get further. Maybe.2011-05-17 05:17 AM
Ok, finally: Bug found, it is WORKING!!
The problem was: FIFO sizes are given in WORDS. What a stupid, stupid bug. S*$''$§ !! It took me >50h to find out. What happened: The RXFIFO run into the HNPTXFIFO after a few blocks. And the results are... well... entertaining. My first thought was, that the code in the OTG lib was wrong, but now it makes sense... Thank you for listening. And having a place to complain ;) Regards, Johannes
2011-05-17 05:17 AM
could you share your code please ?