Shop OBEX P1 Docs P2 Docs Learn Events
PSC Communication issue — Parallax Forums

PSC Communication issue

StephenGStephenG Posts: 25
edited 2008-04-02 05:22 in BASIC Stamp
Some days you just wake up and your stupid gene has been activated. I have a couple or Parallax Servo Controlers that don't want to communicate with either my BS2 of my BS2p24. One of the PSC's has communicated before. When using the code snippet from the PSC's manual:

'{$PBASIC 2.5}

Sdat PIN 15 ' Serial Data I/O pin
Baud CON 396 ' Constant for 2400 baud
buff VAR Byte(3) ' temporary variable

FindPSC: ' Find and get the version
DEBUG "Finding PSC", CR ' number of the PSC.
SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SCVER?",CR]
SERIN Sdat, Baud, 500, FindPSC, [noparse][[/noparse]STR buff\3]
DEBUG "PSC ver: ", buff(0), buff(1), buff(2), CR
STOP

communication with the PSC does not take place. I am wondering if this could be a baud problem. I am attempting to communicate with only one of the ctwo PSC's at a time. I have tried using both a BOE and a Super Carerier Board. The PSC manual states:

. If you wished to set the Parallax, Inc. • Parallax Servo Controller – Rev B ver2.4 (#28023) • 1/2005 5
baudrate back to 2400, you must either reset the controller or send it a SBR, $0 command at 38K4

How do you do either or both and do you think different baud rates are the problem? I am relatively confident that the hardware connections are correct. All I get is the repeating message "Finding PSC" over and over in the DEBUG window.

Stephen G
«1

Comments

  • skatjskatj Posts: 88
    edited 2008-03-05 07:56
    Hi Stephen,

    Try using 1021 for your baud constant.

    (I think this will fix your problem with your BS2P, not sure about your BS2, but the PSC documentation was written for the BS2 not the BS2P so I think that baud rate will work)
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-03-05 15:21
    When you run the program is the green LED blinking on the PSC? Is the Red LED on solid? Which BASIC Stamp are you using with this code? As skatj pointed out with the BS2p the baud rate constant would be incorrect. You mention trying to communicate with one of two at a time which makes it confusing as to whether they’re both plugged in or not. If so, try disconnecting one. Also, there is a jumped block that can short or be open on 2 pins. It should be open.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • StephenGStephenG Posts: 25
    edited 2008-03-05 17:52
    Chris,

    I have tried both STAMPS in both the BOE and the Super Carrier Board attempting to communicate with just one PSC at a time. I'm pretty sure its NOT a bad hardware issue, as I have done some other simple I/O stuff and equipment functions as expected(except the PSC, of course).The jumper is open to address servos 0-15. There are red and a green LED's illuminated one of which is flashing (don't remember which[noparse][[/noparse]I think the green one], I am responding to your post from what I remember - I am not at the location with the hardware - but will be later today.

    Steve G
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-03-05 20:20
    Steve,

    What is the power source going to the PSC logic? Are you trying to power the servos and the PSC from the same supply? You mention one worked before. How long have you had both units?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • StephenGStephenG Posts: 25
    edited 2008-03-06 02:32
    Chris,

    Let me take a step back and fill you in on my projects. The first parallax product I encountered was your Earth Measurements text with a Board of Education (probably the stone age version [noparse][[/noparse]actually it was a Revision B BOE - sorry about the lame attempt at humor]) The first robot I built (Bob) was pretty much a straight out of the box BOE Bot. I found that the original BOE Bot platform rapidly ran out of physical space for sensors, so I crafted my own acrylic base for a BOE based robot (B-Bob - the second in the series). I soon found myself cramped for space again and built a 12" by 12" drive unit, made of 3/16" birch plywood, to house wheel servos with the top cover on the drive unit providing space to mount various electronic components. Rather than immediately start cannibalizing B-Bob for parts, I decided to initially use a Super Carrier Board and upgrade the microprocessor to a BS2p24 for a little more programming space. I used a second PSC that I got as a bonus with some other stuff I bought (don't remember the date, but I'm sure sales could give you that info if you need it) Both servo controllers are revision B. The purpose of my bots is to play around with remote sensor systems. My last project (the environmentAL EXplorer [noparse][[/noparse]ALEX]was cruising along until this last PSC snaffu. For power sources I decided to use RC rechargeable batteries because they would be a nice clean source of power with a little more (ok - a lot more) capacity. For powering the BOE I am using an unregulated 7.2 V 1500ma Ni-Cad RC cell that actually provides between 7-8.2 volts depending on its mood. For the PSC and a few other insignificant things (i.e. LED's and the like - non-inductive SMALL loads) I am using a 7.2 V 3300ma Nickel Metal Hydride (so I don't have to worry about it developing memory and I can keep it as fully charged as I want) RC battery that provides slightly less in voltage than the Ni Cad, BUT I use a 1 amp 5V power regulator - which ever one Radio Shack carries - to provide power to yhe PSC.

    When I encountered this baud issue, I took the revision B BOE that I have, powered it with a Radio Shack solid state variable power supply (0-24V 1A), put in a BS2 microcontroller, connected it via a servo cable to one of the PSC's with a AAA batt pack as its separate servo power source for bench testing until I understand the different baud rate issues. Once I get a BS2 to communicate again with the PSC I will move on to the BS2p24 for bench testing, then go back to my new drive unit.

    So, my first goal is to AGAIN get a BS2 on a BOE rev B board to communicate with a PSC AND UNDERSTAND EXACTLY WHAT IT IS DOING AND WHY. I'll move on from there.

    When I run the previously mentioned code snippet with the last mentioned hardware setup I still get the endless "Finding PSC" message. The PSC documentation seems vague and non-specific (at least on HOW to do it) with regard to how to resolve this issue. I'm sure it's baud related but it sure is hostile.

    Steve G
  • StephenGStephenG Posts: 25
    edited 2008-03-06 02:38
    Chris,

    When I run the code snippet in the last hardware configuration mentioned, the LED's (red and green) on the PSC are both on continuously.

    Steve G
  • StephenGStephenG Posts: 25
    edited 2008-03-06 02:59
    Chris,

    One more question. Is'nt there a way to set the PSC back to some default state? If so,how? OK two more questions.

    Steve G
  • skatjskatj Posts: 88
    edited 2008-03-06 05:48
    If your green LED is on continously, that may mean trouble. On your BOE, what is the plastic jumper set to? This is located in the middle of the four servo ports. It is set to either 'Vdd' or 'Vin'.
  • StephenGStephenG Posts: 25
    edited 2008-03-06 13:25
    Chris,

    When I run the following code snippet:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    Sdat PIN 15 ' Serial Data I/O pin
    Baud CON 396 ' Constant for 2400 baud
    buff VAR Byte(3) ' temporary variable
    SetBaud:
    DEBUG "Setting Baudrate", CR
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SCSBR",0,CR]
    SERIN Sdat, 6,500, SetBaud, [noparse][[/noparse]STR buff\3]
    DEBUG "Baud reply: ", buff(0), buff(1), DEC1 buff(2), CR
    STOP

    the red LED is on solidly and the green LED flashes. The BOE revision B does not have a jumper between the servo ports. I get the "Setting Baudrate" message repeatedly.

    Steve G
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-03-06 13:51
    Steve -

    You may want to change the BAUDMODE below from what it is now to something more appropriate:

    SERIN Sdat, 6,500, SetBaud, [noparse][[/noparse]STR buff\3]

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Programming can't be all that difficult, it's nothing but 1's and 0's
  • StephenGStephenG Posts: 25
    edited 2008-03-07 00:52
    Chris,

    I did not get a reply to my last post

    Steve G
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-03-07 18:55
    Steve,

    The last couple of days have been busy. To expedite helping you I asked the questions I needed to in order to best help you. When I read your reply you backed up and covered way more than I had a chance to read at that time so I didn’t get a chance to reply at that time. Starting a new thread is like starting over and I would’ve started asking questions from the beginning again. Each time we start over we get further behind in helping you with your problem. The other thread has been deleted so we can focus on this one.

    To answer your other question there is no master reset. When powered properly the device is in an uninitialized state with all servos received 1.5 ms pulses and the PSC is ready to receive commands. After re-reading your message it seems you have an older BOE which did not have a selection for the Servo Header voltage. As covered in the documentation for the PSC, you cannot use the servo headers in that case because the PSC would get more than 5V. You may have damaged the PSC.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • StephenGStephenG Posts: 25
    edited 2008-03-08 07:35
    Chris,

    A valid point on the new thread. Let's not do that - it sounds like a waste of time for everyone involved. It was unclear to me from the servo docs that the X4 & X5 jumper blocks on the older revision B BOE's was passing the source rather than the regulated voltage through the red wire. Knowing that, there are some interesting applications. In addition, taking that into consideration, the PSC's had 7.2-8.4 volts passed along to their logic circuits. I guess at this point I have a couple of questions and a comment. First, the question one. How tough are the PSC's and could they have tolerated the 7.2-8.4 volts and still be used with a revision C board - which I have - or do I have $80 worth of junk and how can I tell. Secondly, the comment. I realize to people writing documentation about products they have an in depth knowledge of, it would never cross your mind to warn owners of older BOE's that X4 and X5 don't pass regulated voltage. To me, a lowly biologist, it would have seemed logical that they did pass the regulated 5V in a situation without a jumper where only one configuration is available -until you mentioned it and I measured the voltage. A warning about the older boards would be nice.

    Lastly, question 2. When power is applied to the logic circuits of the PSC, does it power up at a default baud rate or the last baud rate it was set to by software during previous operation?

    Steve G
  • StephenGStephenG Posts: 25
    edited 2008-03-09 06:01
    Chris,

    Ever have one of those feelings when working with hardware that you just don't quite believe it? Anyway, On my bench I set up a BOE revision C with a BS2, both of the PSC's - one at a time - and all of the appropriate power connections, ran the version code snippet and got back a ver 1.4 instantly from both PSC,s - one at a time of course. Then I swapped out the BS2 for a BS2p, changed the directive in the code to look for the correct stamp, applied the correct baud rate for the BS2p at 2400 baud and immediately got back a ver 1.4. Apparently the higher voltage being supplied to the PSC's from the BOE revision B was enough to confuse the PSC's but not damage them. Tomorrow I will check out the Super Carrier Board circuit with the BS2p, but I am confident it will work. By the way, when I swapped out the BS2 for the BS2p, when the BOE revision C was first powered up both the red and green LED's came on and stayed on. The green LED returned to normal operation after the revised code snippet was run for the first time. When the PSC is has power removed from it and is re-powered up, does it revert to 2400 baud by default?

    In an unrelated matter, as I was swapping BS2's, the bottom of one of the corner pins must have undergone fatigue and broke off. I can do a semi-permanent repair using the old BOE's socket, but wondered if Parallax has the ability to solder a new pin on. Let me know.

    Steve G
  • StephenGStephenG Posts: 25
    edited 2008-03-09 18:29
    Chris,

    So what do I know. Is the Super Carrier Board (#27130) wired for run-time serial communication? I am aware that the BS2 Carrier Board (#27120) is not. If 27130 is not, I am assuming that is why I cannot communicate with the PSC when using it. Is that correct or not?

    Steve G
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-03-09 19:01
    It's not clear what you mean by "wired for runtime serial communication". All BASIC Stamps can communicate serially at runtime and don't need any special "wiring" to do so. One big difference between the Super- and BS2- Carrier Boards is that the Super version has an oboard 5V regulator which can power external circuitry, like the PSC. Moreover, the Vss, Vdd, and signal pads are laid out in such a way that simply soldering a three-pin header onto them will provide the correct pinout for connection to many Parallax serial devices.
  • StephenGStephenG Posts: 25
    edited 2008-03-10 05:43
    Phil,

    That's what I thought. When I connect P15,Vss and Vdd I can't get any of the stamps to talk to the PSC when I use the Super Carrier Board. No sweat with the BOE revision C.

    Steve G
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-03-11 16:53
    On the I/O pin you can tack solder a wire onto the pin coming out of a socket…Use the socket as a carrier for that module. We don’t have a way to repair the pins, however we can offer a reduced cost for a replacement module.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • StephenGStephenG Posts: 25
    edited 2008-03-12 05:40
    Chris,

    I wll deal with the broken pin, for now.

    I still don't understand why the Super Carrier Board will not excommunicate with the PSC. It seemed straight forward to me. Using a BS2 I selected pin 15. I soldered a 16 pin header to the first row of solder points on pins 0-15. On the second solder point I connected a 1/W 1K current limiting resistor out to where a three pin header could be soldered. This gave me a three pin header with a P15 signal line, Vss and Vdd. I connected a three wire cable to a breadboard and flashed an LED using both P15 and Vdd and Vss (separately of course) and all worked as expected. And When I connect the servo controller, I get no response. Using a BS2 and a BOE revision C, connecting to bloc X4 utalizing pin 15 it works perfectly.

    What is the reduced replacement cost on the BS2 for future reference?

    Steve G
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-03-12 05:51
    The 1K resistor is where things went awry for you. Replace the resistor with a wire, and everything should work fine. The reason this is a problem is that the input to the PSC has an LED pulled up to Vdd with a 220-ohm resistor. Driving the pin low through a 1K resistor will not pull it low enough to register as a logic "0".

    -Phil
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-03-12 15:30
    Steve, when did the 1K resistor come into the circuit? If I had know you had that from the beginning that would have saved so many replies. It helps to be clear and complete about your connections. Phil is, of course, correct...If you have an in-line resistor like that you will get no communication do to the way the signal line is connected to the activity LED. Let us know how it works after the resistor has been removed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • StephenGStephenG Posts: 25
    edited 2008-03-12 22:14
    Chris,

    The reason I had not mentioned the resistor before is because I had the same thought and jumpered the resistor. But, for the sake of clarity, let me set up the board again and use a non-resistored pin. Perhaps the hardware was left in some other confused state, because I don't see why it should not work as wired. I will get back to you and let you know. I use the 1k resistors in TTL circuits to limit the current to 5ma in a 5V circuit (so as not to exceed the 40ma limitation on sourcing current for 8 pins). I tend to use microprocessors to process, not source or sink current.By using the resistor, I attempt to prevent an error in programming that would make an unfortunate connection to voltage or ground, so as not to blow the microprocessor. Realizing the ~20 ma draw of many LED's and assuming that parallaxes own circuit design would not exceed the current capabilities of the STAMP. I jumpered the resistor. I will set up the bench test again and let you know what happens.Out of frustration, I istalled a BOE revision C on my latest bot. If we figure out what is going on with the Super Carrier Board issue, I have some interesting multiple microprocessor robot ideas in mind.

    Steve G
  • StephenGStephenG Posts: 25
    edited 2008-03-13 01:56
    Chris,

    On pin 13 I soldered in a jumper INSTEAD of a 1k 1/8W resistor, replaced the BS2p in its socket, fed the Super Carrier Board 7.5V. The green LED's on both the SCB and the PSC initially both came on and stayed on as did the red LED on the PSC. I ran the following code snippet:

    ' {$STAMP BS2p}
    '{$PBASIC 2.5}

    Sdat PIN 13 ' Serial Data I/O pin
    Baud CON 1021 ' Constant for 2400 baud for the BS2p (396 for the BS2)
    buff VAR Byte(3) ' temporary variable
    FindPSC: ' Find and get the version

    DEBUG "Finding PSC", CR ' number of the PSC.
    SEROUT Sdat, Baud+$8000, [noparse][[/noparse]"!SCVER?",CR]
    SERIN Sdat, Baud, 500, FindPSC, [noparse][[/noparse]STR buff\3]
    DEBUG "PSC ver: ", buff(0), buff(1), buff(2), CR

    The green LED on the PSC begins flashing and I get the repeated message "Finding PSC" in the debug terminal, as before. This same PSC responds "ver 1.4" to a BS2 on a BOE revision C. Interesting, but still not the expected result.

    Steve G
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-03-13 14:50
    The part that sounds like a problem even before you started communication is that you said the green LED was on for the PSC. It should not be on unless data is being sent back and forth. If it is on at power up with no communication something else is wrong.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • StephenGStephenG Posts: 25
    edited 2008-03-14 05:26
    What I don't understand, is why it works as expected with the BOE revision C. When you say "there must be something else wrong" that covers a lot of ground. Are you suspect of the Super Carrier Board? If so, I can carry out some other bench tests on it. However, it has functioned properly with the other things I have tried with it so far. Weird.

    Steve G
  • StephenGStephenG Posts: 25
    edited 2008-03-14 05:33
    Chris,

    I posted a reply to your last message, but I don't know where it posted! Couldn't a residual program in the Stamp account for the initial state of the green LED on the PSC since it seems to function correctly with a BOE?

    Steve G
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-03-14 14:43
    Without testing the board myself I could not be sure. As I said, the green LED should not be on unless there is communication or the I/O pin is being held low somehow. The PSC could be damaged or there could be a short. Without testing it I cannot give a better indication. If you would like to send it in for testing we can do that. You would need to obtain and RMA to send the unit in. You can contact us directly in tech Support for this.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • StephenGStephenG Posts: 25
    edited 2008-03-14 16:05
    Chris,

    At this point in time I think I will just use them with a BOE revision C which both PSC's seem to work perfectly with - and not worry about it. I'll just use the Super Carrier Board for other stuff. Do you know where I can get a 24 pin IC socket? I tried Radio Shack, but they only carry 40 pin. Thanks for all your help.

    Steve G
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-03-14 16:26
    Steve,

    I must admit, I am a little bit confused as I didn’t know (perhaps I missed something) that these worked fine on another board. This really means the issue was with the connections on the board then.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • StephenGStephenG Posts: 25
    edited 2008-03-15 05:16
    Chris,

    You might at first think so. However, I tested other pins with other tasks (as well as the 2 PSC's that I have) and everything else (except the 2 PSC's) functioned as expected.

    Steve G
Sign In or Register to comment.