PDA

View Full Version : ARRRRGH. A request for prehead-through-wall help with serial communications



BigWaveDave
01-17-2007, 11:37 AM
Alright, I give.ˇ The darn thing has me beat.ˇ I've got a board set up to send out a simple little serial communication using the simplest of serial commands using the default serial pin.ˇ I get exactly the response I need with the debug screen, but connect it to my PC com port and hyperterminal or the target device and I get nothing.ˇ Connect the target device directly to the computer and they talk.ˇ Anyone have anyˇsuggestions why the debug screen would show communication but hyperterminal would not?

Stamp = BS2, baud = 19.2k Hyperterminal on Com1, TTY 19.2k


'program starts here
SerialOutPin CON 16
Baud CON 32
'activeButton a byte number 0 - 7 defined by the button command
SEROUT SerialOutPin, Baud, ["play00",DEC activeButton, CR]

Roger Pierson
01-17-2007, 11:50 AM
my experiance has been that Hyperterminal is not useful for Stamp communications. Being a Microsoft product, it tries to out-think you and therefore seems unable to handle simple, basic terminal communications through the comm port.

I use a product called RS232 Hex Com Tool and it works perfectly for me. Sends exactly what I tell it to, no more no less. You can download a fully functional trial here: www.download.com/RS232-Hex-Com-Tool/3000-2383_4-10064973.html (http://www.download.com/RS232-Hex-Com-Tool/3000-2383_4-10064973.html )

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Roger Pierson
Senior Electronics Technicain
DTI Assoicates

Unsoundcode
01-17-2007, 11:57 AM
Hi BigWaveDave, try the same using a lower baud, eg: Baud CON 16468 (9600).

Jeff T.

Paul Sr.
01-17-2007, 08:35 PM
Roger Pierson said...
my experiance has been that Hyperterminal is not useful for Stamp communications. Being a Microsoft product, it tries to out-think you and therefore seems unable to handle simple, basic terminal communications through the comm port.

I use a product called RS232 Hex Com Tool and it works perfectly for me. Sends exactly what I tell it to, no more no less. You can download a fully functional trial here: www.download.com/RS232-Hex-Com-Tool/3000-2383_4-10064973.html (http://www.download.com/RS232-Hex-Com-Tool/3000-2383_4-10064973.html )


I have a similar issue - and I thought someone had mentioned a FREE terminal program that works/behaves just like the Debug (i.e. responds to the same screen commands). Unfortunately, I have not been able to find this program.

Does anyone know where to find such an emulator?

stamptrol
01-17-2007, 09:23 PM
Notwithstanding preference for one terminal program over another, Hyperterminal will work with Stamps.

However, many Hyperterminal/computer combinations require a jumper on pins CTS-RTS at the computer end to let the computer know it should be listening.

I use Hyperterminal in real-time data logging systems, which with the file capture feature gives a simple, cheap logger that is available on nearly every laptop and desk box. It also works well in 132 char wide format.

Cheers,

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk

http://www.siskconsult.com
ˇ

Paul Sr.
01-17-2007, 09:32 PM
stamptrol said...
Notwithstanding preference for one terminal program over another, Hyperterminal will work with Stamps.

However, many Hyperterminal/computer combinations require a jumper on pins CTS-RTS at the computer end to let the computer know it should be listening.

I use Hyperterminal in real-time data logging systems, which with the file capture feature gives a simple, cheap logger that is available on nearly every laptop and desk box. It also works well in 132 char wide format.

Cheers,


Tom,

Thanks for the response.

I would love to be able to use Hyperterminal in this application because it's free and there! My problem is the fact that the screen formatting doesn't work the same as the DEBUG screen. For example, one of the routines for setting default parameters uses DCA - but in Hyperterminal, it's just a stream of data - looks terrible! SO, I am looking for something [free] that will correctly respond to the DEBUG commands.

Paul

BigWaveDave
01-18-2007, 02:36 AM
Thanks for the help guys. I've used the RS232 program and discovered the following:

Hyperterminal will talk to my target device, a Brookshire RAPU with or without the jumper
Hyperterminal will not talk to my basic stamp with or without the CTS/RTS jumper (pins 7 and 8 which I understand are the two center ones on the four pin side)

RS232 program will talk to my basic stamp
RS232 will not talk to my Brookshire RAPU

The stamp editor Debug window will talk to both
They will not talk to each other

All items/programs are set up with the same baud, parity, etc and have been checked (as much as is possible) at different speeds. I am, in the end, limited to 19.2k because of RAPU requirements.

What magic (read background format/processing) do Debug or hyperterminal do to do what they do?

Is this something stupid like a null modem cable or a combination of null modem and jumpering CTS/RTS that debug automatically takes care of?

allanlane5
01-18-2007, 03:25 AM
Neat! Let's see:

1. The PC is a "DTE" device (Data Terminal Equipment). This means it 'talks' on the TX pin, and 'listens' on the RX pin.

2. The BS2 board is a "DCE" device (Data Communication Equipment). This means it 'listens' on the TX pin, and 'talks' on the RX pin (it assumes there's going to be a DTE device on the other end, you see).

3. The BS2 uses the "DTR" pin as a 'reset' pin for the BS2. There are a couple of capacitors to 'decouple' this signal (like when Hyperterm holds DTR 'active') so that you only get one reset when DTR is pulled high (Active).

4. The BS2 only 'listens' when it's actually in a SERIN instruction. Thus it can easily lose data if you don't program for this.

5. If you've left out the two capacitors on the DTR line, then Hyperterminal will hold the BS2 in 'reset', and your program won't run. Most other serial devices don't care about the DTR line.

6. If you try to connect two DCE devices together, then yes, you'll need a "null modem" cable, who's purpose in life is to swap TX to RX, RX to TX, and the handshake signals.

7. However, the BS2's programming port uses the "TX" signal coming in to power the "RX" signal going out. This means the hardware echo's everything sent to it. Hopefully you can program around this. If not, you can add a MAX232 chip to the BS2 to get true RS-232 levels on some other I/O pins (ie NOT the programming port).

8. Oh, yes, and the DEBUG terminal KNOWS about the DTR line, and will only 'blip' it to reset the BS2 when you connect. This is one big difference between Hyperterminal and the DEBUG window.

BigWaveDave
01-18-2007, 08:42 AM
Allan you're brilliant!

Alright - I slimmed down the cable to three lines to take care of the DTR line and everybody will talk to Hyperterminal now. Since the computer will talk to either unit I figure they are both DCE devices and have a null modemish cable that runs TX to RX and vice versa, but still can't seem to get the two units to talk. I'm generally sending from the stamp to the other unit so the receive on the stamp isn't used much so the echo shouldn't be a problem.

Does the programming port do a full RS-232 emulation (with positive and negative voltage)? I'm hoping to avoid the MAX32 and reprogram around another pin.

Thanks

allanlane5
01-18-2007, 10:10 PM
Good on ya! I assume you ran pin 5 to 5, as well as 2 to 3 and 3 to 2, since pin 5 is ground and you need a ground reference.

And no, the programming port doesn't talk "real" RS-232. It uses the negative 'idle' voltage coming in the TX line, and 'bounces' that to +5 volts when it wants to send a bit. But this is usually a pretty good RS-232 voltage emulation.

Note several people make $10 or so small adapter boards which hold a MAX232 and the needed capacitors -- check out KronosRobotics for one.

You probably want to use an "Inverted" baud mode on the programming port. In any event, it sounds like you're really close to getting this to work.

Unsoundcode
01-19-2007, 01:34 AM
Hi guys, Allan maybe you can answer this for me, I suggested a lower baud earlier in the thread because I can connect to hyper terminal quite easily atˇ9600 baud on pin 16 but have never been able to connect any faster. I assumed because the Pbasic help file says there could be trouble synchronizing at rates higher than 9600 that that was the BS2's limit. After seeing what you had to say I tried it with a MAX233 on P6 (I bought the MAX for a SX and have never tried it on the BS2)ˇand was surprised/pleased to be able to communicate with hyperteminal at 19200. Do you know the reason for this, is it always better/more reliableˇto use a MAX over the default P16. The cable I useˇis a straight 2-2 3-3 5-5, its.molded so I dont know what else is connected in there without ohming through. As a note to connect I have to use Inverted on P16 and True on the MAX.

Jeff T.

allanlane5
01-19-2007, 03:57 AM
It's not always better, as many people don't try to go very far or very fast. Thus paying extra for a MAX233 wouldn't buy them anything.

Having said that, since the MAX233 chip does meet the RS-232 specification, and signals at +-10 volt levels, probably you will get better results if you want faster data or longer distances with it.

But as I say, most people would not benefit from this.

FORD
01-19-2007, 02:34 PM
You may be able to transmit at 9600 no problems, but receiving data can get a bit tricky over 4800, especially if you want to do a few things between bytes in.

Using a bs2p and the SPSTR function is the most efficient way to receive data in packets,

Cheers,
Chris

John Bond
01-19-2007, 07:45 PM
Hi Guys

You know, I battled with RS232 comms until I made a cable with a breakout board. This breakout board enables me to quickly make up any configuration of the 9 pin cable. I just plug jumpers between the appropriate pins.

Recipe for RS232 Breakout cable:
1. Take a 16 pin IC holder and solder it onto a piece of Vero Board (punchboard whatever)
2. Solder pins 2 to 9 of a female D9F connector and cable to the left pins 1 to 8
3. and solder pins 2 to 9 of a male D9M connector to the right pins 16 to 9 of the IC holder
The Vero board, mustard and tomato sauce are optional, you can use wire wrap if you prefer.

I didn't bother with pin 1 because it is seldom used

You can now use jumper on your RS232 the same way you do with a protoboard. For example, you need a simple cross-over cable. You put a jumper from IC holder socket 1 to socket 15, this links pin 2F to pin 3M. You put another from socket 2 to socket 16 and this links pin 3F to pin 2M. You put a third from socket 4 to socket 13 to connect Ground Pins 5F and 5M. You place a final jumper between socket 6 and socket 7 to bridge out F7 to F8 at the computer and thus connect CTS to RTS. Oh sh@# it's not a crossover, no problem, just move the two jumpers. Now you find CTS/RTS are not needed, remove the jumper.

I've soldered another cable on IC holder pins 16 to 9 with a female D9F because I've needed to connect two DTE's (computers) together. This cable lives in my junk box but it gets used surprisingly often. I have also made a number of them for my friends.

Another tip. As you know, the pin that transmits the data (in normal mode) is high when idle. Is the device a DTE or a DCE? You can find out by using a multimeter. Just disconnect the cable and check the voltage between pins 2 and 5 (ground) and again between pins 3 and 5. When you get a reading approaching 12 volts, you’ve found the pin that transmits the data.

If all else fails, I find Aspirin helps with the headache.

Kind Regards from Darkest Africa. Ever wondered why it is called Darkest Africa. Well, a typical example is our Electricity Supply Commission forgot to build power stations when the new government came to power. Their solution, they’ll just turn off electricity supply to large areas of the country during periods of peak demand, between 6pm and 8:30 pm each evening…. Hey, that almost beats South Africa Minister of Health’s claim that eating Garlic and Beetroot cures Aids!!!

John Bond

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Unsoundcode
01-20-2007, 01:46 AM
So far everything I'v wanted to do I'v been able to do at 9600 quite comfortably so will stick with it for a while it just surprised me a little when the MAX chip was able to do 19200,thanks for the reply allan and thanks for the tips guys. Sorry if I interupted your original post Dave, the answers to the questions you raised helped me understand a great deal, it seems your almost there with your project hope to see you post saying its complete.

Jeff T.