Shop OBEX P1 Docs P2 Docs Learn Events
not clear on how to serial talk propeller — Parallax Forums

not clear on how to serial talk propeller

GamekillerGamekiller Posts: 5
edited 2007-11-19 23:57 in Propeller 1
hello all
a group of friends with my self are useing the propeller as a interface to sensors and motor controler. Now we tring to get the mirror serial spin. The data that is sent back to the PC is garage and we can make heads or tails of what we are getting. In the end we are tring to make a firmware with API so a PC can send commands and get tellemetry data from a set of cogs and a cog for motor controlling.

The plan we have will use a cog as com talk and one to schdule tasks.

We just got the propterm app but have not have time to test it.

Any advice from those that have played with serial com to pc world be great.

Andy
www.jambot.org

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-19 03:49
    You are going to have to be more specific about what you are trying to do. In particular, how are you connecting the PC and the Propeller?
    What serial I/O driver are you using on the Propeller? You may need to post your program and a schematic.

    Serial I/O between a PC and a Propeller does work.
    It's not complicated, but you can do it so it works and you can try to do it so it doesn't work.

    The PC and the Propeller have to talk the same speed and same polarity signal and you have to use either a USB to serial adapter
    or some kind of RS232 interface (like the MAX3232).
  • hippyhippy Posts: 1,981
    edited 2007-11-19 04:12
    Or if you're feeling adventurous and don't need full RS232C compliance just buffer the receive from the PC via a 560K resistor. Works for me anyway, but at your own risk.

    @ Gamekiller : Put your current program to one side and write a short Propeller program which firstly sends data out of a serial pin so you can check the PC receives it. Once that's done you can move on to echoing back what's received. I'd start with "FullDuplexSerial", that worked like a charm when I used it. Then you can move up to using MirrorSerial if that's what you need.

    Once you're confident you can do serial it makes integrating with your intended program so much easier; you'll have taken a number of unknowns out of the equation if you are having problems, and you can always drop back to your simple echo program to confirm the serial is still working as it's meant to.
  • GamekillerGamekiller Posts: 5
    edited 2007-11-19 15:54
    I am sorry the first post i did via my iPhone the the smily face stuff on the side bar was making it so slow.

    We have propclip for all the projects. So we are using serial to USB. The setup are right for the propeller to PC aka buadrate and all that. My brother inlaw is coding a lot of this for me and i helping him with this step.

    We been using linux and wine to program but are switching over to a Mac with windows on so that may work a bit better. But the problem was when we looked at the raw data sent to the PC it just did not make any sence.

    I have some code for you in a bit but we are using the fulldeplex and the serialmirror code from the object exchange.

    Andy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    to mod or not mod. That is the qestion.

    www.jambot.com
  • hippyhippy Posts: 1,981
    edited 2007-11-19 17:10
    Gamekiller said...
    the problem was when we looked at the raw data sent to the PC it just did not make any sence.

    Hence the suggestion to write a simpler program which sends known data, starting with a single repeated character, once a second or so.

    If serial is working but the data you are getting does not make sense, you may be sending the wrong data because of a coding error. Not sure how we can help you with that problem without further information.

    Firstly, send a known data stream ( a simple text message ) and confirm that works and what is received makes sense.
  • GamekillerGamekiller Posts: 5
    edited 2007-11-19 17:20
    We have been sending "Hello World" with the blinkLED.pin file. So ever time it blinks it sends "Hello World" to the pc but the text is not coming out right.

    Let me get the code so you call can see it.

    Andy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    to mod or not mod. That is the qestion.

    www.jambot.com
  • AribaAriba Posts: 2,685
    edited 2007-11-19 17:28
    Have you set the right clock-mode and frequency? For serial communication you need a crystal as clock source. If you don't set this you run with the internal RC oscillator and you get no proper data.

    For a 5 MHz crystal write this in the CON section:
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    



    Andy (also)
  • hippyhippy Posts: 1,981
    edited 2007-11-19 19:12
    Try with this. It sends "U" once per second back out the download cable ...

    CON
    
      _CLKMODE = XTAL1 + PLL16x
      _XINFREQ = 5_000_000
    
      PIN_RX   = 31
      PIN_TX   = 30
      INVERT   = false
      BAUDRATE = 4800
    
    OBJ
    
      serial : "FullDuplexSerial"
    
    PUB TestCode
    
      serial.Start( PIN_RX, PIN_TX, 3 & INVERT, BAUDRATE )
      repeat
        serial.Tx( "U" )
        waitcnt( CLKFREQ + CNT )
    
    
    
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-19 19:37
    Gamekiller said...
    ... We been using linux and wine to program
    Excellent combination! French?
  • GamekillerGamekiller Posts: 5
    edited 2007-11-19 23:57
    Nope not French American but Latino by blood.

    My dev team is a big windows haters group. We all ran linux and now we all switched to Macbook pro.

    This evening i going to try the code from above provided by hippy and i report back if it worked.

    Andy

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    to mod or not mod. That is the qestion.

    www.jambot.com
Sign In or Register to comment.