M
Mark Fortune
- Jan 1, 1970
- 0
Hi All,
Sorry in advance if this turns out to be double-posted, it seemed to
bounce from one group the first time and im not sure if that means it
bounces from all.
This might be a little OT on some groups, but I am having a little
trouble getting my computer to read output from a pic microprocessor
over a serial connection and i'm hoping its one of those "ah you just
need to this" solutions an expert could tell me in seconds which would
probably take me a couple of weeks to work out on my own.
I have an 18F1320 pic, which i've programmed to periodically send data
out to a small radio transmitter (easyradio433TS) about once a second.
It's about 10 bytes of assorted data, sending at aproximately 19200 baud
(or there abouts) using the PIC's onboard usart.
the data out pin is connected to a small radio transmitter. So far so
good, I can see data flowing out of the pic on my scope.
At the other end is a matched radio reciever, again, I can see that it
is recieving what appears to be the same data that goes into the
transmitter on my scope (ie all the bits in the same place, not inverted
etc)
The reciever is supposed to handle logic level CTS/RTS RX/TX etc. The
reciever is connected to a MAX232CPE RS232 interface chip which does all
the voltage conversions required for logic/rs232 interfacing, which in
turn is connected to my computers serial port by a cable.
Again all seems fine to this point, if I connect my scope up to the
RS232 side, I see data pulsing down the line, and I can see the varying
digitalness of each character representation.
On the PC I am using linux (debian, kernel version 2.6.8 (customised
kernel) / gcc 3.3.5 (debian 1:3.3.5-13) for those that need to know)
Platform is i386, SiS chipset (not sure of the exact chipset but its got
a 651 AGP host bridge, and SiS 962 ISA bridge, and it's the standard
9-pin onboard serial port i'm using (only has one) i/o range 03f8-03ff).
UART is a standard 16550A So any windows/dos suggestions will probably
be wasted on me.
so anyway, I decide to try and read the data coming into my PC's serial port
cat /dev/ttyS0
which in theory should give me a nice display of the incomming data.
only it doesnt, it just sits there doing not much more than an ice cube.
As a test to make sure the hardware was working (as best I can) I hooked
the _logic side_ (ie the bit the radio is directly wired to) RX to TX,
CTS to RTS and in another console did echo "hello" > /dev/ttyS0
Lo and behold, I recieved a big hello in the window that I did cat
/dev/ttyS0. I also get a load of linefeeds (0x0A) which i'm not sure
about, but it certainly appears to me that data is going both ways
through the RS232 chip.
To note, I have also done cat /dev/ttyS0 | hexdump in an attempt to get
hex data just in case it's garbaging the data somewhere along the line
and sending non-printable characters. but still I get an integer less
than 1.
now i've checked my wiring, i've double checked my wiring, i've tripple
checked my wiring, and hooked LED's up here there and everywhere to see
when data pulses through, and I can, the led's pulse as I would expect.
I have removed the radio transmitter/receiver pair and tried to run the
RS232 chip direct from the pic. nothing, zilch, nada, nil, 0.
Yet data is being send down the serial cable, to my pc's serial port, at
19200 baud. my pc just will not pick it up.
I have tried using the setserial utility to set the serial port to 19200
baud, again the output I got was the square root of 0.
I can think of only 4 possible causes for this problem:
1. The reciever is sending out data with hardware flow control
(RTS/CTS), yet my serial port is probably set to software flow control
(Xon/Xoff). or any other number of serial port perameters are not met,
such as start bits, stop bits, parity, number of mars bars etc. I can
just about set the baud rate, but I have no idea how to set all these
other parameters since i've not had to do anything like this since the
early 90's, and back then I was using Dos. and so far i've not been able
to find anyone that can give me a straight answer (resorting to the
default rtfm reply - which manual? all setserial seems to do is set the
baud rate and a number of seemingly unrelated things). Any advice or
pointer to a really good info. resource on this would be greatly
appreciated.
2. As above, but may be easier to set the PIC to manage software flow
control, parity etc. if so, how do I find out how my serial port is set
up in terms of parity, start/stop bits etc?
3. The receiver (an Easyradio 433RS) mentions something in the datasheet
about the output being inverted? so it can be directly interfaced with a
pic. ie logical high = 0v, logical low = 5v. Apparently the MAX232CPE
deals with this, but is this true? do I need to put an inverting buffer
between the reciever pins and the max232?
3. I am slowly going insane and everything is working perfectly, my
brain is making me believe a problem exists where in reality I havent
even got a computer.
Thanks for any tidbits of advice,
Mark
Sorry in advance if this turns out to be double-posted, it seemed to
bounce from one group the first time and im not sure if that means it
bounces from all.
This might be a little OT on some groups, but I am having a little
trouble getting my computer to read output from a pic microprocessor
over a serial connection and i'm hoping its one of those "ah you just
need to this" solutions an expert could tell me in seconds which would
probably take me a couple of weeks to work out on my own.
I have an 18F1320 pic, which i've programmed to periodically send data
out to a small radio transmitter (easyradio433TS) about once a second.
It's about 10 bytes of assorted data, sending at aproximately 19200 baud
(or there abouts) using the PIC's onboard usart.
the data out pin is connected to a small radio transmitter. So far so
good, I can see data flowing out of the pic on my scope.
At the other end is a matched radio reciever, again, I can see that it
is recieving what appears to be the same data that goes into the
transmitter on my scope (ie all the bits in the same place, not inverted
etc)
The reciever is supposed to handle logic level CTS/RTS RX/TX etc. The
reciever is connected to a MAX232CPE RS232 interface chip which does all
the voltage conversions required for logic/rs232 interfacing, which in
turn is connected to my computers serial port by a cable.
Again all seems fine to this point, if I connect my scope up to the
RS232 side, I see data pulsing down the line, and I can see the varying
digitalness of each character representation.
On the PC I am using linux (debian, kernel version 2.6.8 (customised
kernel) / gcc 3.3.5 (debian 1:3.3.5-13) for those that need to know)
Platform is i386, SiS chipset (not sure of the exact chipset but its got
a 651 AGP host bridge, and SiS 962 ISA bridge, and it's the standard
9-pin onboard serial port i'm using (only has one) i/o range 03f8-03ff).
UART is a standard 16550A So any windows/dos suggestions will probably
be wasted on me.
so anyway, I decide to try and read the data coming into my PC's serial port
cat /dev/ttyS0
which in theory should give me a nice display of the incomming data.
only it doesnt, it just sits there doing not much more than an ice cube.
As a test to make sure the hardware was working (as best I can) I hooked
the _logic side_ (ie the bit the radio is directly wired to) RX to TX,
CTS to RTS and in another console did echo "hello" > /dev/ttyS0
Lo and behold, I recieved a big hello in the window that I did cat
/dev/ttyS0. I also get a load of linefeeds (0x0A) which i'm not sure
about, but it certainly appears to me that data is going both ways
through the RS232 chip.
To note, I have also done cat /dev/ttyS0 | hexdump in an attempt to get
hex data just in case it's garbaging the data somewhere along the line
and sending non-printable characters. but still I get an integer less
than 1.
now i've checked my wiring, i've double checked my wiring, i've tripple
checked my wiring, and hooked LED's up here there and everywhere to see
when data pulses through, and I can, the led's pulse as I would expect.
I have removed the radio transmitter/receiver pair and tried to run the
RS232 chip direct from the pic. nothing, zilch, nada, nil, 0.
Yet data is being send down the serial cable, to my pc's serial port, at
19200 baud. my pc just will not pick it up.
I have tried using the setserial utility to set the serial port to 19200
baud, again the output I got was the square root of 0.
I can think of only 4 possible causes for this problem:
1. The reciever is sending out data with hardware flow control
(RTS/CTS), yet my serial port is probably set to software flow control
(Xon/Xoff). or any other number of serial port perameters are not met,
such as start bits, stop bits, parity, number of mars bars etc. I can
just about set the baud rate, but I have no idea how to set all these
other parameters since i've not had to do anything like this since the
early 90's, and back then I was using Dos. and so far i've not been able
to find anyone that can give me a straight answer (resorting to the
default rtfm reply - which manual? all setserial seems to do is set the
baud rate and a number of seemingly unrelated things). Any advice or
pointer to a really good info. resource on this would be greatly
appreciated.
2. As above, but may be easier to set the PIC to manage software flow
control, parity etc. if so, how do I find out how my serial port is set
up in terms of parity, start/stop bits etc?
3. The receiver (an Easyradio 433RS) mentions something in the datasheet
about the output being inverted? so it can be directly interfaced with a
pic. ie logical high = 0v, logical low = 5v. Apparently the MAX232CPE
deals with this, but is this true? do I need to put an inverting buffer
between the reciever pins and the max232?
3. I am slowly going insane and everything is working perfectly, my
brain is making me believe a problem exists where in reality I havent
even got a computer.
Thanks for any tidbits of advice,
Mark