Sharing the SD card on the W5200 board with a second Propeller
MJHanagan
Posts: 189
in Propeller 1
Are there any particular difficulties of "sharing" the SD card on a W5200 for QuickStart board with a second Propeller board? Sharing an SD card would eliminate the hassle of transferring data back and forth between the two Propellers. The second Propeller gathers the data to be served out by the W5200 and occasionally requests data from the W5200 (periodic SNTP sync, etc).
The schematic for the W5200 board shows all four SD pins (CLK, CS, Dout and Din) are all pulled up by 10k resistors. Presumably then a second Propeller could share these four pins and the SD card would not know (or care) who it is communicating with. At least one other pin from each Propeller would be need to signal the other it wants access to the card and negotiate who controls it and when it is finished using it. I would also assume each Propeller would need to close any open file and set its four pins as input once it is finished with its I/O routine.
I'm thinking only two short methods would be needed to alter whatever FAT code is used. One method that sets the CS, CLK and Dout pins as output would be called after being granted permission to talk with the SD card and another method setting these three pins as inputs just before releasing control of the SD card. The rest of the FAT code would remain untouched and oblivious to the trickery being played out. Could it be that simple?
Would each Propeller need to mount before and unmount after each use, or would one mount event suffice for sharing?
The schematic for the W5200 board shows all four SD pins (CLK, CS, Dout and Din) are all pulled up by 10k resistors. Presumably then a second Propeller could share these four pins and the SD card would not know (or care) who it is communicating with. At least one other pin from each Propeller would be need to signal the other it wants access to the card and negotiate who controls it and when it is finished using it. I would also assume each Propeller would need to close any open file and set its four pins as input once it is finished with its I/O routine.
I'm thinking only two short methods would be needed to alter whatever FAT code is used. One method that sets the CS, CLK and Dout pins as output would be called after being granted permission to talk with the SD card and another method setting these three pins as inputs just before releasing control of the SD card. The rest of the FAT code would remain untouched and oblivious to the trickery being played out. Could it be that simple?
Would each Propeller need to mount before and unmount after each use, or would one mount event suffice for sharing?
Comments
It would be possible, if you wrote your own SD/FAT driver, to speed things up drastically. One board could take care of initializing the SD card (this has to happen prior to any FAT mounting, and only happens once per power-up). After that, both boards could take their turns reading the boot sector and FAT table to glean all necessary data required for mounting. Following that, they would both be free to access the card as they please (assuming you ensure they are not accessing the SPI lines simultaneously).
Interesting idea... though I'd be surprised if this ended up being simpler/faster/better than having a UART bus between the two Props to handle whatever type of communication is needed.