Closed audiobird closed 9 months ago
Have you got a serial terminal, logic analyzer, or oscilloscope to verify what's happening with the serial link to the slave device? It certainly sounds like the USB communications are getting stuck waiting on the slave to acknowledge the data, which never comes.
There will indeed be a timeout on the mass storage request from the host, but it's normally fairly generous. As long as your link isn't running at one bit per second or incurring multiple second delays, it should still be able to complete each part of the transaction before hitting any timeout.
Thanks for the response. I ended up getting it to work eventually. You were correct, the slave device was not acknowledging the data properly. It was a problem with the slave device's bootloader. Everything is working well now, thanks again. Lufa is awesome!
I'm using the atmega16u2 as a mass storage device to simply pass through data to a second processor running a bootloader.
Here is my
WriteBlocks
function belowBasically, the second processor just echoes each byte it receives back to the m16u2.
I have a 1024 byte UF2 file that gets passed through the 16u2 and successfully flashes the second micro.
The problem: I have a second UF2 file that is 13 KB. After copying it to the mass storage device my second micro starts flashing itself but it never stops. It seems that Windows tries and tries to copy the file until it finally quits with
Error 0x80070079: The semaphore timeout period has expired.
So 1KB is fine but 13 is not. I imagine this is because I'm spending too much time in the
WriteBlocks
function. Perhaps waiting for the echoed byte is breaking things..I tried inserting
In the while loop that's waiting for serial data but that didn't help.
Apologies if there is something simple I'm missing. I'm new to working with USB.