FAT16/32 Full File System Driver help
FX
Posts: 4
Hi, all
I have a problem with FAT16/32 Full File System Driver
this is the code
OBJ
sdfat : "SD-MMC_FATEngine.spin"
term : "FullDuplexSerial"
PUB main
' "fatEngineStart" is only called once. Either driver object can call it.
sdfat.fatEngineStart( _dopin, _clkpin, _dipin, _cspin, _wppin, _cdpin, {
} _rtcres1, _rtcres2, _rtcres3)
sdfat.mountPartition(0)
' Open serial to USB
term.start(31,30,0,115200)
term.str(string("Open file ..."))
term.tx(13)
sdfat.openFile(string("TEST.TXT"),"r")
repeat sdfat.filesize
r := sdfat.readByte
usb.tx(r)
FCV:=1
term.tx(13)
term.str(string("ok"))
repeat
if I try print in terminal a existing file in SD "TEXT.TXT" not have problem in terminal appear Open file ... OK and related contet
but if open a not existing file in SD example "AAAA.TXT" the code stops, in terminal appears only Open file ...
some suggestions?
Many Thanks in advance
Francesco
I have a problem with FAT16/32 Full File System Driver
this is the code
OBJ
sdfat : "SD-MMC_FATEngine.spin"
term : "FullDuplexSerial"
PUB main
' "fatEngineStart" is only called once. Either driver object can call it.
sdfat.fatEngineStart( _dopin, _clkpin, _dipin, _cspin, _wppin, _cdpin, {
} _rtcres1, _rtcres2, _rtcres3)
sdfat.mountPartition(0)
' Open serial to USB
term.start(31,30,0,115200)
term.str(string("Open file ..."))
term.tx(13)
sdfat.openFile(string("TEST.TXT"),"r")
repeat sdfat.filesize
r := sdfat.readByte
usb.tx(r)
FCV:=1
term.tx(13)
term.str(string("ok"))
repeat
if I try print in terminal a existing file in SD "TEXT.TXT" not have problem in terminal appear Open file ... OK and related contet
but if open a not existing file in SD example "AAAA.TXT" the code stops, in terminal appears only Open file ...
some suggestions?
Many Thanks in advance
Francesco
Comments
I am not sure because I have never used the FATEngine but I think it is possible that some methods in there are exiting with ABORT rather than RETURN. Quite likely openFile does this as it has no return value but must indicate failure in some way.
If this is the case you will have to use it something like: Do check the section on ABORT in the Propeller manual to see how this all works.
Hi, Heater
Many Thanks
I worked on your suggestion and I solved the problem, FatEngine pass result, so:
OBJ
sdfat : "SD-MMC_FATEngine.spin"
PUB main | ErrorString
' "fatEngineStart" is only called once. Either driver object can call it.
sdfat.fatEngineStart( _dopin, _clkpin, _dipin, _cspin, _wppin, _cdpin, {
} _rtcres1, _rtcres2, _rtcres3)
sdfat.mountPartition(0)
' Try to open file "TEST.DAT" (exsist)
errorString := \sdfat.openFile(string("TEST.DAT"),"r")
in errorString code return <TEST.DAT>
' Try to open file "AAAA.DAT" (not exsist)
errorString := \sdfat.openFile(string("AAAA.DAT"),"r")
in errorString code return <Entry Not Found>
(this error message is present on SD-MMC_FATEngine.spin)
Heater, again many many thanks
Francesco
Enjoy!
Mike
Mike,
but I am writing code interactive with terminal, at the prompt the request to read also can be made to a not existing file, that was the question
bye
Francesco