Hi all,
I have a Sparkfun USB Host Shield, bough this past week, connected to a Mega2560 board.
Version 2.0-1.3.2 of the Circuits@Home USB Shield library is installed.
I am trying to do a simple read/write of text data from a flash drive.
I have the boards powered by a robust 12 Volt supply.
The Board_QC and USB_Desc Examples work perfectly.
I am having no luck, however, getting testusbFAT to read and write from the Flash drive.
I have tried multiple Flash drives, and get the same result with each.
The sketch starts, runs until USB_State settles at 0x90 (State_Running),
shows USB_ON and MAXLUN =0, then loops once every 10 seconds.
I never see the Flash Drive “Total Sectors” or "Sector Size " messages, and if I hit “t(return)” on my keyboard,
which should do a read/write test of a 10 mB file, nothing whatsoever happens, except I get a serial message
" r creates a new 10MB test file (10MB.bin)". After this message, the sketch continues to loop once every 10 seconds.
Doing some debugging with serial message tags, I find that the program cannot get past Line 495, where
the following test is done: " if(UHS_USB_BulkOnly->LUNIsGood(i))".
It Faults out every time, branching to the “fail” code, which writes NULL to the sto registers.
I am at a wall, trying to understand why this test does not result in a True state and what I might do to fix the problem.
I’ve made NO changes to the stock code, save to change the Baud Rate to 9600 for convenience.
Can anyone help me through this maze?
I’m a pretty experienced embedded developer, but unraveling this puzzle seems to be beyond me.
Any help and advice MUCH appreciated!
thanks