Shop OBEX P1 Docs P2 Docs Learn Events
propeller USB servo controller HELP — Parallax Forums

propeller USB servo controller HELP

RNRN Posts: 28
edited 2010-08-02 13:34 in Propeller 1
I am using the propeller USB servo controller which can control 32 servos at a time. When i use the PSCI GUI it is working fine and giving the version when asked but when i control it using the USB and send commands serially it is not responding at all. I am sending "SCVER?"$0D from the parallax serial terminal. Please help. Also tell me can i overwrite the code in the propeller USB servo controller and the code provided on their site(FIRMWARE) should be their in the chip...

thanking in advance

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-07-29 12:27
    Remember that the default Baud is 2400 and all commands must start with "!" as shown in the documentation, so you have to send "!SCVER?".

    You can overwrite the existing firmware with your own program using any of the Propeller programming tools (like the Propeller Tool or BST).

    When you receive the Propeller USB Servo Controller, it has already been programmed with the code provided on the Parallax webstore page for the Controller (PSC Propeller Firmware).
  • RNRN Posts: 28
    edited 2010-07-29 12:43
    thanks but even after adding! it is not replying. i am writing exactly "!SCVER?"$0D. i want to know whether "" should also be transmitted and CR is written as $0D.
  • dbpagedbpage Posts: 217
    edited 2010-07-29 15:47
    Do not sent the quotes.· Send the "$0D" as a single byte·with a value of hexadecimal d (decimal value 13).



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dennis B. Page
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-07-29 20:05
    to narrow down the problem use the PST.EXE on your PC and first try to send the string with this software to the board.

    If this does not work you know something with the cable or the board is wrong

    best regards

    Stefan
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2010-07-29 20:23
    RN,

    I think your question has been answered, but just to confirm, can you attach the code that you are currently using? The servo controller works off of an 8-BYTE packet. ... "!SCVER?" counts as 7 BYTES, and "$0D" or decimal 13 counts as the 8th byte.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • RNRN Posts: 28
    edited 2010-07-30 07:35
    actually i am using the pst.exe to send the commands as also suggested by stefan. Now it is replying to !SCVER?. I just sent this from pst and it replied 1.0 but still CR is not clear to me. I didn't send that but still it replied. Also when i am trying to change the baud rate i am sending !SCSBR1 but it is not repling. please clear my doubt that when u are sending bytes they are sent as a string i mean all at a same time as !SCSBR1 or first !SCSBR then 1. i tried this also but it is not working.
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-07-30 08:21
    what's not clear to me (yet) is did you send !SCSBR1 from PST.EXE or from the propeller.

    from pst.exe you got an answer if you send !SCVER?

    did you try to send !SCVER? from the propeller and get an answer back from the board?

    Anyway the forum can help MUCH BETTER if you ARCHIVE your code inside the propellertool, and then ATTACH the zip-archive like shown in the attached picture


    In the obex there is an object Parallax Servo Controller (Serial) driver V2

    Original it is for the serial servo-controller. But the USB-controller works the same way. The only difference between the USB servocontrollerboard and the serial board is,
    that an FTDI USB-to-serial converterchip is inserted between PC and propeller-chip

    Serial board: PC
    MAX2323
    Propellerchip

    USB board: PC
    FTDI
    Propellerchip

    best regards

    Stefan

    Post Edited (StefanL38) : 7/30/2010 8:33:42 AM GMT
  • RNRN Posts: 28
    edited 2010-07-30 10:47
    stefan

    I am using pst.exe and not propeller chip. the commands !SCVER? is getting a response 1.0 and now !SCSBR1 is also changing the baud rate to 38.4kbs. The doubt is that right now i am sending eight bytes(seven infact) as a string. Now suppose i want to change the servo position in that case the command should be !SC<channel><ramp speed><LB><HB> so it will be transmitted as a string like !SC1243....where 12 is the channel and 43 is the ramp speed . I dont think this should be the format because how will it distinguish b/w 12 and 43. So will they be separated by spaces or rather 1 byte should be transmitted at a time. I am resistant to try this because i have hitec servos and i dont want to damage them....
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-07-30 13:01
    quoting from the manual

    Position Command – Set Position of a Servo Channel
    Syntax: “!SC” <channel> <ramp speed> <lowbyte> <highbyte> <CR>
    Reply: None
    To move a servo to a location you must write a position command to the PSCU. Each position command
    is comprised of the preamble, the channel, the ramp speed, lowbyte/highbyte of the pulse width in 2 μs
    increments and a carriage return ($0D). The preamble is “!SC”. The channel is a byte value from 0 – 15
    (16 – 31 if this is the second unit in a network). The ramp speed is a byte value from 0 – 63 that
    controls the speed the servo moves to its new position.

    this means that the set position-command consists of 8 bytes

    byte1: "!"
    byte2: "S"
    byte3: "C"
    byte4: 12 look at the different writing without hyphens!
    byte5: 43 look at the different writing without hyphens!
    byte6: 0 look at the different writing without hyphens!
    byte7: 2 look at the different writing without hyphens!
    byte8: 13 (ASCII-Code of carriage return

    for sending strings with ASCII-codes outside the range of typable characters (space ASCII-code 32 ...) PST.EXE is not very suitable
    for this it is better to use
    the software Brays terminal

    You can define macros with brays terminal

    best regards

    Stefan

    Post Edited (StefanL38) : 7/30/2010 1:07:37 PM GMT
  • RNRN Posts: 28
    edited 2010-07-30 14:51
    stefan

    thanks for the reply but this i know. My doubt is how to send that data. i want to know whether i should transmit 1 byte at a time or i can transmit eight bytes in 1 stretch. in pst.exe should i write all the eight bytes and then press enter or single byte at a time and this for every byte.
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-07-30 20:49
    you can find out if there is a timeout by sending the string in two parts with different time-delays

    If you want exact defined delay you can use the scripting-function of brays-terminal.

    I don't think that servos get damaged when the pulse-length is too short or too long.

    The position is controlled by the pulselength. Usually between one millisecond and two milliseconds.

    Do you have an oscilloscop?
    Then you could measure the minimum and maximum pulse-length

    Do you have a second propeller-board?
    then you could measure the pulselength with that

    best regards

    Stefan
  • RNRN Posts: 28
    edited 2010-08-01 14:19
    still unanswered

    see as soon as i type !SC0 only of the whole command it shows ERR! this means that it is not reading·byte 0 from the 0 we are sending from the keyboard. my qn is how to transmit the command to change the servo position from pst.exe or brays terminal. Please tell me is someone has changed the servo posn from pst.exe what is the syntax.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-01 14:42
    You are sending the wrong information. That's why you're getting the ERR!.

    As StefanL38 showed you from the manual, each of the parameters is a single byte. From a terminal program like PST, you have to type these as control characters. Look at a table of ASCII character codes. You'll see that each character has a numeric value from 0 to 127. The first 32 character codes are used to do things like backspacing and carriage returns. Character codes 32 and above are "printable" and correspond to various characters like letters, digits, etc.

    If a "caret" prefix (^) is used to imply that the control key of your keyboard is held down, the sequence StefanL38 showed ("!", "S", "C", 12, 42, 0, 2, 13) would be typed as ! S C ^L * ^@ ^B ^M

    The ^M could be typed using the RETURN key
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-08-01 14:47
    I don't know how you can send NON-typable ASCII-codes with PST.EXE.

    (edit: thanks Mike for explaining that. Anyway my opinion is that brays terminal is much more comfortable for things like that
    (because you can define macros)

    I have attached a picture that shows how to define a macro in brays terminal to send the servo-controller-commands

    !SC0#012#032#255#000#013

    "!SC" is clear

    "#012" means DECIMAL value 12 to choose channel 12

    "#032" means DECIMAL value 32 to set ramp-speed t0 32

    "#255#000" means DECIMAL lowbyte 255 and highbyte decimal 0 setting pulsewith to value 255 which is estimated middle-position of the servo

    "#013" means decimal 13 = carriage return

    in spin strings are represented as byte-SEQUENCES

    you have to define an array of bytes

    VAR
      byte ServoCommand[noparse][[/noparse] 9 ]
    
    




    then this array can be filled with ASCII-values
      ServoCommand[noparse][[/noparse] 0 ] := "!"
      ServoCommand[noparse][[/noparse] 1 ] := "S"
      ServoCommand[noparse][[/noparse] 2 ] := "C"
      ServoCommand[noparse][[/noparse] 3 ] := "0"   'header
    
      ServoCommand[noparse][[/noparse] 4 ] := 12  'channel
      ServoCommand[noparse][[/noparse] 5 ] := 32  'ramp-value
      ServoCommand[noparse][[/noparse] 6 ] := 255 'lowbyte of servo-position-value (0-500)
      ServoCommand[noparse][[/noparse] 7 ] := 0     'highbyte of servo-position-value (0-500)
      ServoCommand[noparse][[/noparse] 8 ] := 0   ' DEFINITLY required as termination of the string in SPIN
    
       ' then you send this string to the servo-controller by
    
      serial.str(@ServoCommand)  'pay attention to the "@" in front of the variablename !!!
    
    
    



    this is ONE way of two dozens to do that I guess there are more clever ways. That's just what comes first to my mind

    All that I have written here is just theory with no real testing. Just what I conclude from the servo-controller manual

    best regards

    Stefan

    Post Edited (StefanL38) : 8/1/2010 3:21:31 PM GMT
  • dbpagedbpage Posts: 217
    edited 2010-08-02 13:10
    Most terminals let you send non-typable ASCII-codes by using the key combinations Ctrl-K to send CR (return) and Ctrl-J to send LF (line feed). Does this work with pst.exe?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dennis B. Page
  • Mike GreenMike Green Posts: 23,101
    edited 2010-08-02 13:34
    PST should let you send most control characters by using the control key plus another key. The Windows keyboard driver translates most such combinations into the proper byte value before the program (PST) even sees them. The only problem is that PST probably interprets some of them as having special meaning.
Sign In or Register to comment.