Shop OBEX P1 Docs P2 Docs Learn Events
How do you interface a propeller chip to a Linux web server? — Parallax Forums

How do you interface a propeller chip to a Linux web server?

Nick7Nick7 Posts: 1
edited 2012-10-07 02:00 in Propeller 1
I am currently trying to interface my propeller chip to my web server (which is Debian) via serial. I am very much new to the propeller chip. I have been able to somewhat be able to control it via the "Parallax Serial Terminal" on Windows 7 x64. So if some genius out there could please help me with example code of how to control pins via serial it would be very much appreciated. Also, if someone knows the easiest way to interface this to PHP that would be awesome.

Thanks,
Nick.

Comments

  • SRLMSRLM Posts: 5,045
    edited 2012-10-06 23:34
    Hi Nick, welcome to the forums.

    There are two components to this question: the Propeller side and the PC side. In between you'll have a serial link over the FTDI USB chip. There isn't anything readily made to do what you want, but it's fairly straight forward. I've done something similar in Python here (look in the code section).

    On the PC side you need a program (or a thread in your program) to watch the serial port. This post has some interesting information, namely the (supposed) success of writing directly to the serial port. I've used the PySerial object before, and that worked well for me. You can do more searches with a search such as "FTDI serial php", although this gave me lots of pages that matched PHP via the extension (rather than the content).

    On the Propeller side you'll need to have a serial program listing the the serial port, reading the data, and then acting on it and possibly returning a result. You'll basically have to come up with some protocol that makes sense for your application. I did this as part of the first link above. It's documented in a wiki page ($ADXXX protocol). I recommend two aspects:
    1. Do everything in plain text (ASCII), at least to begin with. It's much easier to debug.
    2. Use the FFDS1 driver at 230400 baud. It has the standard API, but it's overall a better and faster driver. And both sides (Propeller and PC) can handle the fast baud.
  • rosco_pcrosco_pc Posts: 464
    edited 2012-10-07 02:00
    I found this just earlier today: http://firmata.org/wiki/Protocol
    Used in the arduino world, but you JUST need to implement this on the propeller side (you can use node.js and this js lib: https://github.com/jgautier/firmata)

    Oh, and you can use this to speak serial in PHP: http://code.google.com/p/php-serial/
Sign In or Register to comment.