djuseeq / Ch376msc

Arduino library for CH376 mass storage contoller
MIT License
77 stars 17 forks source link

writeFile(buff, len) doesn't work reliably. #32

Closed ohbhatt closed 1 month ago

ohbhatt commented 4 years ago

Files are left with a single character written. Logically implementing the same code using writeChar(char) gives the desired result. Felt I should through some light on it.

djuseeq commented 4 years ago

Hi, that is weird, please can you share more info about your project, i mean using SPI or UART(hw or sw?), speed? Do you use some interrupt in your code? Have you tried the example code? If yes the it have the same behavior? Thanks

ohbhatt commented 4 years ago

Thank you for your response. I am using Hardware Serial @ 115200 Baud. I have tried the example code and it works well most of the time. Sometimes, it only writes one character to the file. I do use interrupts in the rest of my code, A GPS uses another Hardware Serial port, here this problem is more frequent.

I tried writing the same file again and the frequency of the problem has reduced quite a bit, but it still happens 1/5 times. Please let me know if another Serial connection could hinder with the functions of the library.

My particular code is very large, but I have exactly replicated what is done in the example.

djuseeq commented 4 years ago

Sorry but i can't reproduce it. Can you try over SPI? Check the wires and try just with Arduino board without attaching any other modules on it with the example ino file.

ohbhatt commented 4 years ago

Sure I can do that. I'll get back to you soon with my result.

On Tue, 29 Sep, 2020, 6:35 pm György Kovács, notifications@github.com wrote:

Sorry but i can't reproduce it. Can you try over SPI? Check the wires and try just with Arduino board without attaching any other modules on it with the example ino file.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/djuseeq/Ch376msc/issues/32#issuecomment-700688974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOQ3KQGRX4NSN5NJQKREEK3SIHLTHANCNFSM4RF3EQ6Q .