Hi guys, i'm doing a telemetry hardware for some testing and i also want to make a data acquisition, just to ensure i will have all data..
can someone please explain how the sdcard writing file works? if i open a file on REPL, why the file is not created but if i put on main.py some file manipulations, i can see the results on mounted sd-card after.
SDcard writing file, need to be unmounted on windows?
SDcard writing file, need to be unmounted on windows?
Last edited by saulo on Thu May 26, 2016 7:31 pm, edited 1 time in total.
Re: SDcard writing file, need to bee unmounted on windows?
Hi saulo and welcome to the forum!
This question has been asked a few times before, so I searched the recent answers, see this post and one just below it for an explanation: http://forum.micropython.org/viewtopic. ... stem#p8653
In short, may someone correct me if I'm wrong, micropython syncs the data that you write to the filesystem every complete block, I don't remember the exact size, but something around 512bytes for pyboard. Thus if you write smaller (or larger) chunks of data it will appear out of sync as the data is still in the filesystem buffer and needs to be flushed. Please see the thread I linked for more details.
Also consider using dhylands/rshell for your file manipulations without having to use mass storage.
This question has been asked a few times before, so I searched the recent answers, see this post and one just below it for an explanation: http://forum.micropython.org/viewtopic. ... stem#p8653
In short, may someone correct me if I'm wrong, micropython syncs the data that you write to the filesystem every complete block, I don't remember the exact size, but something around 512bytes for pyboard. Thus if you write smaller (or larger) chunks of data it will appear out of sync as the data is still in the filesystem buffer and needs to be flushed. Please see the thread I linked for more details.
Also consider using dhylands/rshell for your file manipulations without having to use mass storage.
Re: SDcard writing file, need to bee unmounted on windows?
If you do the I/O from the REPL you will see the changes from the REPL.
However, since the host thinks that it has exclusive access to the sdcard, it very likely won't notice the changes.
If you unmount and remount from the host, then it will re-read the sdcard and see the changes (proivided the act of unmounting doesn't wipe them out).
However, since the host thinks that it has exclusive access to the sdcard, it very likely won't notice the changes.
If you unmount and remount from the host, then it will re-read the sdcard and see the changes (proivided the act of unmounting doesn't wipe them out).
Re: SDcard writing file, need to bee unmounted on windows?
Thank you guys, now i got it!
In short terms: pyboard have some "stream limitations" to files manipulation from buffer to storage that the mounting process from host don't see, right? I assume that will happens on *nix system as well, right?
I will emulate the file behavior with a UART port, so i just send strings as i will write on file, this way i can see my debuggging messages on RPEL and also see realtime data stream to file without the need of unmount anything. maybe with a low baudrate just to emulate the SDcard perfomance...
In short terms: pyboard have some "stream limitations" to files manipulation from buffer to storage that the mounting process from host don't see, right? I assume that will happens on *nix system as well, right?
I will emulate the file behavior with a UART port, so i just send strings as i will write on file, this way i can see my debuggging messages on RPEL and also see realtime data stream to file without the need of unmount anything. maybe with a low baudrate just to emulate the SDcard perfomance...
Re: SDcard writing file, need to be unmounted on windows?
Well it's really USB Mass Storage which has the limitations.
I use pyb.usb_mode('CDC') and use rshell to copy files into and out of the sdcard/internal flash, then I never have any inconsistency/corruption issues.
I use pyb.usb_mode('CDC') and use rshell to copy files into and out of the sdcard/internal flash, then I never have any inconsistency/corruption issues.