On Fri, 15 Nov 2019 13:35:22 -0800 (PST), in
gmane.comp.hardware.beagleboard.user
[email protected] wrote:

>I am in need of a global variable(s) to store encoder data on a few motors 
>that I have attached to my beaglebone. In the event of a power down, I need 
>to be able to recall the last encoder position (since it is not absolute) 
>of a particular motor. I would like to find a few free memory bocks on the 
>eMMC and send a streaming update to it as the motor moves. 
>

        The eMMC contains a /file system/ -- one does not access raw blocks.

        Open a file in modify mode; 
                loop
                        write the set of encoder values; 
                        flush the file; 
                        seek(0)...

or maybe mmap with a backing file, as that would allow writing each encoder
as it is moved, rather than all encoders at once.

https://linux.die.net/man/2/mmap
https://linux.die.net/man/2/msync

        Note that both (file/flush/seek and mmap/msync methods will invoke a
lot of flash memory write overhead as everytime you change a value the
flash has to allocate a new/erased block, copy unaffected data to it, write
changed data...

        Also note that on unintended power-down, you risk corrupting the file
system with partial writes... With luck the journal will catch these and
allow reasonable recovery.

-- 
Dennis L Bieber

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/gapuseh8dfg9qro7pmgdotfnfu4mmam8kh%404ax.com.

Reply via email to