Shop OBEX P1 Docs P2 Docs Learn Events
X-communication between a website and a propeller C3 — Parallax Forums

X-communication between a website and a propeller C3

JChrisJChris Posts: 58
edited 2014-07-20 06:52 in General Discussion
Hello,
I am trying to achieve some form of data exchange between a website, that I developed in PHP, and a C3 development board.
However, I am experiencing some difficulties in receiving the data, on the propeller side, and I wonder whether somebody faced the same issue and managed to solve it.

Practically speaking I am sending the data onto a serial port of the PC. The propeller is plugged on this same port through a USB serial adapter. In this case, port 17, with 8N1 communication parameters (see below).
The baud rate has been set at 38400 on both sides (PC and propeller) and I tried different values (ranging from 9600 to 115200) without seeing any difference.
Checking with the ProScope data logic analyzer I was able to validate that the 8 bytes I was sending were actually well received on Pin 31 of the propeller.

The thing is: I cannot get this data read by the propeller from the input buffer.

To avoid possible conflicts on pin 30 and 31, I am using a LCD connected to pin 1 to display the result, i.e. the bytes I am trying to fetch from the buffer.
The RX method (in the FullduplexSerial library) is used to fetch the data but it gets stuck and I am not able to retrieve anything from the input buffer. It seems that RX waits forever for a character to come.

Any thoughts on what could be wrong? Any help would be appreciated.

Extract from the PHP sender
send on port php.png

Spin receiver program
code propeller.png
383 x 146 - 23K
342 x 401 - 56K

Comments

  • SRLMSRLM Posts: 5,045
    edited 2014-07-16 10:29
    It looks like you're mixing a byte method (PC.Rx) with a string method (LCD.Str).
  • JChrisJChris Posts: 58
    edited 2014-07-16 15:15
    I tried to use LCD.Hex. I also tested another library "Serial_Lcd", using the "putc" function but to no avail.
    Any other suggestion?
  • SRLMSRLM Posts: 5,045
    edited 2014-07-16 15:30
    You're still mixing up the functions. Using vanilla FDS, you can just do this:
    repeat
        LCD.tx(PC.rx)
    

    That reads a single byte from the PC FDS variable, and outputs that single byte to the LCD FDS variable.
  • JChrisJChris Posts: 58
    edited 2014-07-17 13:10
    Thank you for your answer, It's working now but the problem was not in the code... My propeller board was plugged on a 4-port USB hub and this was the root cause of the problem. I plugged it directly on the PC USB port and it's now working fine.
    LESSON learned: never plug the propeller on a USB Hub when transferring data between a PC and a propeller board.
    Thanks for your help
  • RS_JimRS_Jim Posts: 1,766
    edited 2014-07-20 06:52
    LESSON learned: never plug the propeller on a USB Hub when transferring data between a PC and a propeller board.
    Thanks for your help

    My propeller is always connected to my PC via a powered hub!
    Jim
Sign In or Register to comment.