I see a weird phenomenon on my Beaglebone-like AM335x Linux machine:
I have a SDcard with 2 partitions, the first one (mmcblk0p1) is a 3GB VFAT (where my kernel and some data resides) and the second one (mmcblk0p2) is a 1GB ext4FS where my rootFS resides.
The first partition (VFAT) is also used a USB mass-storage-device when I connect the AM335x to a USB Host. And this partition is also auto-mounted in fstab, so that I have access to the data on this partition from Linux. In fact I use this partition to exchange data between Linux and Windows.
In my /etc/fstab I have the following entry to automount the VFAT partititon:
/dev/mmcblk0p1 /media/X5data vfat defaults,umask=0000 0 0
At startup I have a script (/etc/init.d/S60USB) that installs the g_mass_storage USB driver to use the VFAT-partition:
modprobe g_mass_storage.ko file=/dev/mmcblk0p1
The AM335x properly connects to e.g. a Windows PC as a mass storage device.
Everything works fine until e.g. I overwrite files via USB (e.g. from a Windows PC) on the VFAT-partition.
Then I see this new data on the drive of my WindowsExplorer, but when I make a "ls -l" on that directory in Linux I DO NOT SEE THE NEW FILES there - I still see the old filesize. And also when I look at the data in that file I see the old data. Only when I restart the device (the AM335x) I see the new data on that partition in Linux (even when I turn off the power supply directly after doing the filetransfer via USB, without issuing "poweroff"!).
Its the same behaviour in the other direction: When I copy data in Linux to /media/X5data while USB is connected to the Windows PC I do not see the new data on that Windows-drive! Only when disconnecting and reconnecting USB I see the new data on that drive.
Issuing the "sync" command does not change this behaviour!
I am using the TI SDK 6.0 (PSP 04.06.00.11, Kernel 3.2, Linaro GCC 4.7) to build my kernel and I am using buildroot to make my FS.
All 6 patches regarding the MUSB for AMSDK 06.00.00.00 are applied.
uname -a gives:
"Linux X5 3.2.0 #296 Mon Aug 17 15:08:50 CEST 2015 armv7l GNU/Linux"
mount gives (for /dev/mmcblk0p1):
/dev/mmcblk0p1 on /media/X5data type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/mmcblk0p1 on /home/ftp type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
cat musb_hdrc.0 gives (while USB connected to host):
Status: MHDRC, Mode=Peripheral (Power=f0, DevCtl=99)
OTG state: b_peripheral; active
Options: ?dma?, otg (peripheral+host), [eps=16]
Peripheral address: 00
Root port status: 00000100
CPPI: txcr=0 txsrc=0 txena=0; rxcr=0 rxsrc=280de80 rxena=0
Gadget driver: g_mass_storage
ep0 (hw0): 1buf, csr 0000 maxp 0000
(queue empty)
ep1in (hw1): 1buf dma, csr 2400 maxp 0200
TX DMA0: 00000000 00000000, 00000000 00000000; 00000000 00000000 00000000 .. 00000000 (queue empty)
ep1out (hw1): 1buf dma, csr 2000 maxp 0200
RX DMA0: 2 left, 00000000 00000000, 00000000 00000000; 00000000 00000000 00000000 .. 00000000 req de2cced0, -552361752/-566795744
What am I doing wrong so that data on the USB-mass-storage-drive and the Linux filesystem (both at /dev/mmcblk0p1) is different as long I do not restart?