Wednesday, July 13, 2016

USB Host MSC succesfull test

Tutorial: Creating a test to validate a logging function on the USB Flash drive.

Validate in this context means - create a simple test that seems like it is reasonable exercise of some functionality and then let it run.

Test : Write entries to a log file.

The test script "shuntil"
------------------------------------
set FSTOP /usb0/tst1/fstop
until [ -f $FSTOP ]
do
 date >> /usb0/tst1/l_date
 free >> /usb0/tst1/l_free
 ps   >> /usb0/tst1/l_free
 sleep 1
done
------------------------------
is pretty simple. Write three entries to two files every second.
Initially I enabled vi 
Application Configuration à System Libraries and NSH Add-Ons
[*] VI Work-Alike Text Editor  ----  CONFIG_SYSTEM_VI
  (64)  Display width (columns) (NEW)
      (16)  Display height (rows) (NEW)
      (0)   Debug level (NEW)
      (2048) Builtin task stack size (NEW)
      (100) Builtin task priority (NEW)

I'm not that proficent in 'vi', I've always had another editor to use. So I spell it out for anybody else taking the plunge. The help is theapps/system/vi/vi.c
mknx.sh
stwr

To start the testing 
nsh> uname -a
NuttX 17.6 nxd47wk_wkd47tst1_20160713_1444 arm stm32f4discovery
nsh> mount -t vfat /dev/sda /usb0
nsh> cd /usb0/tst1
# It turns out vi doesn't use pwd - so start it up and then specify the write path at the end
nsh>vi
i #cmd to input - copy the test script in. There is a limit on Rx buffer size so copy/paste half the file and then next half. Mental note need to try xmondem,
#To finish - 
<ESC> : w /usb0/tsts1/shunitl<ret>
:q<ret>
>nsh ls -ls  # shows file

nsh> sh shutil &

# Thats it test is running. Best leave overnight.

# Come back next morning - 10hrs later.
echo stop >fstop   # stop test.

Inspect the files l_date for number of entries and then l_free.
Wonderful - an speeded up soak test that ran for 10hrs last night with flying colours. -

So close to 100K file level access to the USB flash, including append to a single file 72,000 times resulting in a file 17Mbytes. 

So that's cool !.

Update July14-0724pst:
Rerunning this test overnight with yesterdays latest update, stoping the test and attempting to remove the USB Flash drive for inspection I get
"Umount failed: 22" or "Invalid argument"


nsh> uname -a
NuttX 17.6 nxd47wk_wkd47tst1_20160713_1444 arm stm32f4discovery
nsh> pwd
/
nsh> ls
/:
 dev/
 proc/
 usb0/

nsh> umount usb0
nsh: umount: umount failed: 22




No comments:

Post a Comment