Shop OBEX P1 Docs P2 Docs Learn Events
Behave like a SD- card? — Parallax Forums

Behave like a SD- card?

Christof Eb.Christof Eb. Posts: 1,200
edited 2014-02-09 17:14 in Propeller 1
Hi, this is just an idea and I am wondering, if it would be possible:

Photo- Frames are quite affordable these days. They have slots for SD- Cards and can change to the next picture after some time.

Would it be possible for the Prop to emulate a SD Card and possibly create new pictures and feed it to the reader each time it asks for a new picture?

Christof

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-02-09 10:56
    It would depend upon the data rate and the kinds of images the photoframe can accept. If .bmp files are okay, they're not too difficult to create with a Prop; but .jpg files are a whole 'nuther story and probably out of the question. You'll also ahve to simulate the file system, because the photoframe will probably ask for a directory from which to choose its next image.

    -Phil
  • Heater.Heater. Posts: 21,230
    edited 2014-02-09 15:05
    Let's assume the Prop generates images and puts them on files on an an attached SD card. We can easily do that with a FAT file system object from OBEX.

    The interface to the photo frame knows nothing of a file system, it is only exchanging numbered blocks with the Propeller, which it thinks is an SD. The Propeller would get those blocks from that real SD and send them to the photo frame.

    The problem here is that now we have a Propeller with a live file system talking to an SD. At the same time the photo frame has it's own file system software maintaining a live file system on the same SD.

    I can see this going awfully wrong and all kinds of corruption happening.

    Might possibly be made to work if the Prop closes down that interface to the photo frame, mounts the SD card file system, opens a file, writes the image, closes the file and un-mounts the SD card.

    Meanwhile, if the photo frame wants to read files it will error out until the Prop has finished, and hopefully try again.

    The idea is of course that only one device has SD access at a time.

    All sounds like too much hard work to me. Even if you can make a fast enough SD interface.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-02-09 15:16
    Heater,

    In the scenario you present, there would be no point in involving the Propeller at all. Why not just plug in a real SD card, and be done with it? I think what the OP is after is a way for the Prop to generate its own images on the fly and use the photoframe as its display. In that case it would have not only to convert raw images to a format the photoframe understands (.bmp, .jpg, etc.) but emulate a file system with a directory so the photoframe could retrieve said images as if the Prop were a real, FAT-formatted SD card. That's not to say, of course that Kye's FAT32 object could not be changed to emulate a virtual filesystem for the on-demand images, but I don't think a real SD card attached to the Prop is necessary.

    -Phil
  • Heater.Heater. Posts: 21,230
    edited 2014-02-09 15:28
    Yes, yes. We want the Prop to make the images. Say data logging graphs from sensor inputs, or whatever. Of course we don't know what images the OP has in mind but let's go with that.

    A couple of reasons for using a real SD card:

    1) Caching:

    The Prop does not have to generate images on the fly as they are requested. Rather it could save them to SD and serve them up super quick from there. In the data logging example you might have ten different sensors and want 10 separate graphs. Log the data, create the bmps, at your leisure, swap them into files the photo frame sees when done.

    2) Convenience.

    We already have FAT file systems for SD that work fine.

    All we need here is to create the SD interface for the photo frame and give raw blocks from the real SD to it when requested.

    As long as we can stop them fighting over the FS structure on that SD we are good to go.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-02-09 15:36
    heater wrote:
    As long as we can stop them fighting over the FS structure on that SD we are good to go.
    There's an easy way to test that: have the Prop write its images to the SD card, then plug the SD card into the photoframe. If the photoframe can read it, then using the Prop as a data-block intermediary should work okay, too.

    -Phil
  • Heater.Heater. Posts: 21,230
    edited 2014-02-09 15:59
    That would be a very good start Phil. I'm confident that will work, people have been moving data from Prop to PC via SD card before. I have read Prop generated files from SD on my Android devices.

    My next test would be to yank the SD out of the photo frame for a while and see if it recovers nicely when I put it back. Thus simulating the Prop taking over card access for it's own business.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-02-09 16:07
    That brings up an interesting question: can SD cards generate wait states similar to I2C's clock-hold, forcing the host to slow down or pause?

    -Phil
  • Buck RogersBuck Rogers Posts: 2,185
    edited 2014-02-09 16:11
    Hi, this is just an idea and I am wondering, if it would be possible:

    Photo- Frames are quite affordable these days. They have slots for SD- Cards and can change to the next picture after some time.

    Would it be possible for the Prop to emulate a SD Card and possibly create new pictures and feed it to the reader each time it asks for a new picture?

    Christof

    Hello!
    Whose photo frame are you thinking of? I've seen plenty available as viewers on keychains, and seen people reuse them because their screens are better then some of the individual displays that are also available. Then I've seen several actual frames, and as it happens the big sticking point is in fact a classic, the backlight. Typically they use CCFL means to light them and typically the management electronics typically fails. The user gets stuck using one from the company, unless he knows how the thing can be wired and has made a third party one work.

    And also gotten Linux for that processor to run on it unassisted. Typically it already is, but its only purpose is in managing the display of pictures. But he wanted to display his pictures properly, and without the assistance of bloat from the original vendor......

    So your idea is a good one.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-09 16:35
    That brings up an interesting question: can SD cards generate wait states similar to I2C's clock-hold, forcing the host to slow down or pause?

    -Phil

    No, the SD card's "processor" requires the clocks but typically when you issue a read command you must keep clocking until you receive a read token to indicate that the data follows. So by leaving the data line high the host will continue to clock for a system dependant timeout period until it finds a response (non $FF).

    As for the OPs request I would find it more practical to hack the actual display and drive it directly as otherwise you can only provide information in jpg format, not something you can create dynamically.
  • localrogerlocalroger Posts: 3,451
    edited 2014-02-09 17:14
    No, the Propeller is not fast enough to emulate a SD card. There wouldn't be much point if it could, as the Propeller also doesn't have the massive data store that a SD card does for storing frame data. SD cards are interesting; they actually contain fairly powerful CPU's themselves, and I recently saw somewhere (hackaday?) an article about hacking one to run arbitrary code.

    It is possible to hack some of the 7 inch portable DVD players and photo frames to use them as displays; I demonstrated such a photo frame hack at the 2010 UPEW. This is possible if the LCD is being driven by analog RGB signals, and the hack requires the original hardware to generate the very complex timing for the LCD (generally thinking it's displaying a screen saver or slide show) which is read by the Propeller, and letting the Propeller inject the RGB signals to form an image.
Sign In or Register to comment.