Shop OBEX P1 Docs P2 Docs Learn Events
FullDuplexSerial Locks Propeller — Parallax Forums

FullDuplexSerial Locks Propeller

John R.John R. Posts: 1,376
edited 2007-01-14 02:57 in Propeller 1
I tried searching (with the google tool) and couldn't find this, so my appologies if it has been covered. (I am not a "search master", but I try.)

I'm doing some testing with the FullDuplexSerial object for Popeller/PC communicaiton on pins 31/30.

It works fine (at least sending from the prop to the PC), except:

If I start the object without hyperterm connected, all is fine.

When I connect hyperterm, I start getting the data I expect.

If I disconnect hyperterm, the prop appears to lock up. If I try and re-connect hyperterm, things still sayed locked up.

I didn't see any "time out" features avaialable for the xmit functions.

Am I missing something?

I've basically started adding a few things to Jon W's Servo32_Demo program. I have two servos "panning", and one of the reasons I say the prop locks, is that in addition to the data stopping (obviously), the data also stops going to the LCD, as well as the servos stop.

Here's the code:

CON
    _clkmode = xtal1 + pll16x                           
    _xinfreq = 5_000_000                                'Note Clock Speed for your setup!!

    PanServo3 = 7                                       'For DEMO only  Set servo on pin7  
                                                                 '; could be any pin
    PanServo4 = 8                                       'For DEMO only  Set servo on pin8  
                                                                 '; could be any pin
    
OBJ
  SERVO : "Servo32"
  LCD : "Serial_Lcd"
  SN : "Simple_Numbers"
  FD: "FullDuplexSerial"

VAR
  Byte bPanCount  
PUB Main | temp

    'Preset Servo's you want to use to center position
    SERVO.Set(PanServo3,1500)
    SERVO.Set(PanServo4,1500)

    'Note: Servo pins that will be used must be preset before running "SERVO.Start".
    '      This is because the I/O direction is set here and is only executed
    '      at the beginning of "SERVO.Start".  Servo pins that aren't used will remain
    '      in their original direction state.

    SERVO.Start                                         'Start Servo handler
    LCD.Start(16, 9600, 2)
    LCD.Str(string("This is a test"))
    bPanCount := 0
    FD.Start(31, 30, 0, 9600)
    
    repeat                                              
                                                        'Pan selected DEMO servo3 & 4 
                                                        'back-n-forth opposite of each other
     repeat temp from 1000 to 2000
      waitcnt (cnt+125_000)
      SERVO.Set(PanServo3,temp)
      SERVO.Set(PanServo4,3000-temp)
     repeat temp from 2000 to 1000
      waitcnt (cnt+125_000)
      SERVO.Set(PanServo3,temp)
      SERVO.Set(PanServo4,3000-temp)
     bPanCount += 1
     LCD.cls
     LCD.Str(SN.DEC(bPanCount))
     FD.Dec(bPanCount)




Now in my case, this is kind of like when you tell the doctor "It hurts when I drop a rock on my foot", and she replies "Don't drop a rock on your foot." I can obviously keep the port on the PC open, at least for now, but I would like the ability to open and close communications in the future, and also deal with a "lost" communication without the prop locking.

Other than some minor playing around with the Prop Education Kit, this is my first real work with the Propeller, so I may be doing something totally bone headed.

Thanks for any help and suggestions.

(I'll also take any hints on other areas of "sloppy" code, this is just "hacked" together to see how things work.)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John R.

8 + 8 = 10

Post Edited (John R.) : 1/14/2007 2:14:30 AM GMT

Comments

  • Mike CookMike Cook Posts: 829
    edited 2007-01-14 02:06
    Are you using a PropStick? If so, just guessing here, HyperTerm may be toggling DTR, which would reset the Propeller when you open and close HyperTerm communication port.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-01-14 02:06
    When HyperTerminal is cycled, DTR may be cycling causing the Prop to reset. Use F11 when downloading so that your program is in EEPROM and reboots.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    StampPlot - Graphical Data Acquisition and Control
    AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
  • John R.John R. Posts: 1,376
    edited 2007-01-14 02:18
    I have a PRC (Propeller Robot Controller from Wulfden) and am using the USB2SER to communicate.

    While using f11 might get me going again, the reset would not be desireable "in the real application".

    I assume that moving the USB2SER off the Programming ports (and/or building in a way to break the "RESET" connection in "run mode") would also fix this, correct?

    And thanks for the very fast responses!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • Mike CookMike Cook Posts: 829
    edited 2007-01-14 02:22
    John,

    I've got a home built demo board, and on my setup I've got a switch on RSTn (Program/Run) this way after I download a program I switch to RUN then I can open a communications program like ProComm ot HyperTerm with out resetting the Propeller. If you can find a way to disable the DTR pin on your cable that would work too.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike
  • John R.John R. Posts: 1,376
    edited 2007-01-14 02:25
    Great, for now "I won't do that", and will either get things on a different set of pins, or find a way to break (and remake) the connection to the reset pin.

    Thanks again guys, and have a great evening (or whatever time you're living in).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • John R.John R. Posts: 1,376
    edited 2007-01-14 02:57
    Just confirming all of the above. I used a "Prop Plug" to set up my hyperterm on another set of pins (temporary setup), and all works well.

    I'll have to find a way to break the reset connection as required for a more permanent solution.


    Thanks again for the quick help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
Sign In or Register to comment.