Mysterious fsrw26 SD Card unmount
dbpage
Posts: 217
in Propeller 1
My SD Card unmounts itself mysteriously using fsrw26.
I have a method that parses an ASCII file, reading one line at a time, until the end of file. I have a second method that reopens the same file and parses the ASCII file in another way. I am not certain that the SD Card is unmounted. I only know that I have to mount the SD Card again before the second method can open and read the ASCII file.
Is there something about fsrw26 that requires the second method to re-mount the SD Card if no files are open after a short period of time?
Between the first and second parsing methods, the SPI bus is used to send information to another device on the same SPI bus. The SD Card and other device share the DO CLK DI pins. Each has its own CS pin. I am using pull up resistors and have uncommented the command mov dira,#0 in safe_spi PASM to tristate all lines so that the SPI bus can be shared with other devices.
Could there be something about sharing the SPI bus that causes the SD Card to need re-mounting between file accesses?
I have a method that parses an ASCII file, reading one line at a time, until the end of file. I have a second method that reopens the same file and parses the ASCII file in another way. I am not certain that the SD Card is unmounted. I only know that I have to mount the SD Card again before the second method can open and read the ASCII file.
Is there something about fsrw26 that requires the second method to re-mount the SD Card if no files are open after a short period of time?
Between the first and second parsing methods, the SPI bus is used to send information to another device on the same SPI bus. The SD Card and other device share the DO CLK DI pins. Each has its own CS pin. I am using pull up resistors and have uncommented the command mov dira,#0 in safe_spi PASM to tristate all lines so that the SPI bus can be shared with other devices.
Could there be something about sharing the SPI bus that causes the SD Card to need re-mounting between file accesses?
Comments
I want to keep a file open and alternate between reading an ASCII record and writing to an external SPI device like this:
I am looking at this very old post from 2009, when lonesock was working on fsrw 2.5
https://forums.parallax.com/discussion/117409/sharing-sd-spi-pins-without-unmounting
Lonesock wrote that "FSRW will automatically reacquire the lines next time you ask 'sdfat' to do something." The only command that fsrw responds to is sd.mount, after which I have to re-open the file.
Is there a way that I get fsrw to reacquire the SPI lines without re-mounting and re-opening the file so that the code can read the next ASCII record?
As long as you are not sharing pins for the spi device you can just comment out the section that unmounts the card after 30 seconds of inactivity. I don't recommend sharing the SD card pins with other SPI devices unless you unmount the card every time you access the other SPI device as I've had problems. Sometimes it works but I've had problems with this in the past.
Is there a way for fsrw to regain control of the SPI pins without losing its place in the open ASCII file?