Shop OBEX P1 Docs P2 Docs Learn Events
Can 2 propellers share a resource? — Parallax Forums

Can 2 propellers share a resource?

mljohnstmljohnst Posts: 1
edited 2013-04-07 08:55 in Propeller 1
First time poster......

Is it possible to have two propellers share a resource, like an eeprom or sd card? I'm working on a project with a Spinneret and a second propeller. The Spinneret is basically maxed out. The second propeller would interface with several input devices. The "typical" approach seems to be to have the two propellers talk back and forth with a serial protocol, but if I approach it this way, I'm finding I need LOTs of code on the Spinneret to break apart the messages from the secondary prop and act upon them.

What I'd like to do is to simply use the secondary prop to write XML files to the same SD card as the Spinneret file uses, and then use the Spinneret to serve up the XML files to the internet. I realize I'd need some sort of lock to prevent access from one Prop while the other is using the SD card, but from an electrical standpoint, is this possible? Any interfacing considerations? I tried various searches but didn't find any threads that seemed to address this.

Thanks in advance,

Mike

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-04-04 16:11
    You just need to make sure the SD card driver releases the I/O pins (puts them in an input state). I'm pretty sure Kye's drivers do this, I'm not sure about the other SD drivers out there.
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-04-05 09:58
    if you can use forth, the propforth development setup has spineret talking to another prop over synchronous serial, very fast. even if you dont use forth, you copy what has been done or use it as a starting point.

    the test and demo material include http pages from SD , and multiple telnet sessions.

    give it a whirl!
  • kwinnkwinn Posts: 8,697
    edited 2013-04-05 16:52
    DOH! Why didn't I think of that? Yes, it is possible and relatively simple from an electrical standpoint. For some applications it is an elegant way to share a resource. The tricky part may be the locking mechanism.

    Thanks for the idea. It may be the solution to a problem I have been struggling with.
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-04-06 10:16
    I think for the propforth implementation, one cog handles the SD, and other cogs end up just make requests, so no locking per se is needed, its all inherent. Same as the way cog 7 handles the serial port communication for the terminal, and its transparent so it APPEARS we are talking directly to cog 6.

    The issue is that the HTTP support is very big. Its configured with a minimal kernel as there isn't enough room for much dev support after HTTP stuff is loaded. But, it can serve HTTP pages all day just fine. AND the second prop can do pretty much anything you need, and just send the specific HTTP oriented requests to spinneret.

    Its a good solution for some applications. In other cases, consider just using a Raspberry Pi. It can provide all the networking services for free, plus database and number crunching services. The way Sal does it is using Go channels, the RPi looks sort of like another cog to the prop, and the prop cogs looks like additional tasks to the RPi. If the prop does all the real time stuff,and the RPi does all the crunchy stuff, it can work out really well. I don't have a good demo set up yet.

    But as long as you were planning to do the work on spinneret, it might net LESS work to do the network stuff on the RPI, and cost less, and offer interesting alternatives. It kind of cool but we haven't explored this very far yet.
  • Clock LoopClock Loop Posts: 2,069
    edited 2013-04-06 16:50
    You must design them properly ... physically. And the program must also know that its a parallel situation. But it works very well with the propeller chip.

    The link I have attached shows a way to program two prop chips identically, using a single propplug. The schematic shows the props use the same single crystal also.
    Each prop has its own eerpom to allow self modifying code. (shown in 2nd schematic)

    http://forums.parallax.com/showthread.php/124520-Anyone-that-wants-more-data-up-the-USB-serial-pipe-Dual-FTDI-Parallel-Props-(hanno!)
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2013-04-06 16:52
    mljohnst wrote: »
    Is it possible to have two propellers share a resource, like an eeprom or sd card?

    Without driving each other crazy?
  • cavelambcavelamb Posts: 720
    edited 2013-04-07 08:55
    Set a flag (who has access) and Test for it before doing anything.
    0 = available
    1= prop 1
    2 = prop 2
    etc
    The processor doesn't have a formal instruction to do that, so DIY.
Sign In or Register to comment.