I want to write to USB flash drives. I would love for it to be easy and not put too much load on a M328. I have a CH376-based board. It turns out that the factory documentation is rather poor, and it is hard to tell what it takes exactly to get it to work. I have found some examples on the net, but they are either incomplete, or for interfacing with SPI or parallel. To reduce pin count, I am looking to use the serial interface.
I have had success in recognizing that a flash disk is attached, and I can write valid data to the file. I can close the file, and a computer can read the file properly.
But.... the best I can manage is write 127 bytes at a time. I THINK the CH376 is capable of at least 255 at a time, and I THINK that you should be able to tell it to expect more than that because I think you can send 2 bytes (16 bit integer) as the number to expect.
But when I tell it anything over 127 byes it fails to write.
I certainly could break up my data into 127 byte chunks, but that would be more of a PITA.
Does anybody have suggestions or a solution?
-Tony