Serial communication problem

I am trying to interface my arm9 based single board comp to the PICAXE 28X1 (starter kit board). The idea is to interface the single board computer running Linux to my PICAXE over serial and try to send commands to it over the serial line. I wrote code for my PICAXE that can listen on the serial line and transmit the same characters back. The arm board recives characters sent by the PICAXE but for some reason characters sent by the arm board are not recieved by the PICAXE.

I have tried both the programming serial port - serrxd/sertxd combination and the general i/o pins - serin/serout combination. In both cases the characters sent by PICAXE are visible at the arm9 minicom terminal but the reverse always fails. The output (serial Tx) is run through a 330 Ohms resistor on output pin 0.

I have observed that if i short the V and one of the input pins the serin is able to read some garbage character from the input pin. The program is pretty simple

using programming serial port

ptr = 1 `Reset scratchpad pointer to 1
`Read just 1 byte command to scatchpad address 1
serrxd @ptr
wait 1
sertxd (@ptr)

using the general i/o pins

serin 7, N4800, b1
serout 0, N4800, (b1)

 

I cannot follow all you

I cannot follow all you write, but my experience in having different parts do serial with each other tells me that sometimes it is a good idea to go T instead of N, so that is example:

serin 7, T4800, b1

instead of

serin 7, N4800, b1

APart from this I HATE to debug serial, it is impossible to pick up where it goes wrong :slight_smile: Sometimes an LCD hooked up on the line gives clues…

i tried that without any
i tried that without any luck. I was wondering if this could be because of the signal strength of the arm9 board’s Tx. Any idea?

yes it can be something like

yes it can be something like that, there are two different levels for serial communications called sometimes RS-232 and TTY. One is 3 and the other 5 or 5.5 (i don’t remember which is which tho). You can use a level converter like the MAX3238E (example board).

 

Other cause could be that the serial port configuration on the arm9 side is wrong…

Serial levels

Yes, there are two different conventions for serial voltage levels, but it’s TTL, not TTY (Transistor-Transistor Logic). TTL levels are 5V and 0V, while RS-232 is +12V and -12V. The serial level converter chips (Maxim MAX232 and so on) convert between them.

But, there’s also an inversion between TTL and RS-232. 5V TTL becomes -12V RS-232, and 0V becomes +12V. Are you connecting both boards at TTL levels directly, or do you send the data through level convertors?

ops so many inaccuracies,
ops so many inaccuracies, sorry! :frowning:

thanks a lot for the
thanks a lot for the information, it really makes things much clearer for me. There is no level converter on the PICAXE board but i am not sure about the arm9 one. It could have a level converter, next thing i guess i need to do is to measure the signal voltage levels and see how i can covert them.

MAX3221
Ok i checked the arm9 board schematics and looks like it has a level converter - MAX3221 is one of them right? would by-passing the level converter and connecting the boards at TTL level work?

I’ve been playing around

I’ve been playing around with some serial communication between 2 picaxes and never thought it would be such a pita…but it was. My goal is to use the picaxes (3 total) to communicate with a bs2, through serial com. So far I’ve gotten the picaxes to communicate, next is trying it with the bs2.

What I found out so far with the picaxe.

Try using slower speeds like 1200 or 2400 initally. Also, if you use the setfreq command, it’ll affect the baud rate.

If communicating between to pics, use true levels, T2400 as opposed to N(inverted).

A neat trick is to set the picaxe (serin) pin low(should be by default) and have the arm9 send a high signal first, then send the serial data. Use the interupt on the picaxe to pick up this signal then throw it to a sub procedure to start the serin. Since you’re using a 28, you also have the serin timeout which might be helpful. I’ve used this trick with the 2 08m’s and it works like a charm. There is a sit(happy hippy? that goes through intercommunication between picaxes )

One very annoying thing I found was that when I used seperate power sources for each picaxe, the serial communication would not work, even with true levels, I’d get all sorts of weird noise. I had the com pins tied low as well. both power sources used a 5volt reg(same model) but still had issues

Try using the same power source or tie both to a common ground(haven’t tried that, but that might work).

hook up a led to both so that you know when things are happening… (led tied to the send pin directly, this hasn’t affected the com signal from my testing so far)

btw, this might help, it’s related to a basic stamp and picaxe communicating, but could be usful in this case

http://www.phanderson.com/picaxe/pwm_stamp.html

Hope the info helps.

Wot’s in a serial?
…and that’s just RS-232 serial. Anyone want to talk about RS-422, or I2C, or USB, or any of the other multitude of serial hardware?

Connect those grounds!

You will definitely need to connect the grounds on the two devices, if they have separate power supplies.

Is there no way to cause an interrupt on a PICAXE when a serial byte is received? I’ve never used one, but I did program the PIC a few years ago, and I think it has a “receive buffer full” interrupt.

some breakthrough

Yes both the boards are running on different power supplies and i have connected the ground pin. I rigged up the arm9 board to get the TTL pins for serial Rx and Tx. With this i am able to see some garbage characters received at the PICAXE now.

I think now its just a matter of configuring the serial port right to read the characters. Will update you guys soon.

Garbage
Seems like a fair indication of one of three problems: baud rate or the number of stop bits or parity is incorrectly set. One option would be to find out what the defaults are for your PICAXE and change the PC (or whatever terminal you’re using) end as it’s probably easier to change the settings there.

When you refer to the
When you refer to the resistor on the output pin are you referring to the output pin on the PICAXE or the arm9?

T vs N
What’s the significance of the T and the N? Is that the difference in your language between parity and non-parity? If so, of course, boths ends needs to be set with the same parameters.