EmbeddedRelated.com
Forums

PC104 Serial Port Programming

Started by starman November 8, 2005
I am working with a SBC1390 and I am attempting to write a program
which will read and write data out of COM1, COM2, COM3, and COM4.  I
have COM3 and COM4 working as they should however I cannot get COM1 and
COM2 to work for the life of me.  I am writing the program in C and
like I have said the code works just fine on my PC and for COM3 and
COM4.  I will say that COM1 and COM2 are independant of COM3 and COM4.
Is there anyone out there who might be able to shed some light on this
issue.  Thanks

starman wrote:
> I am working with a SBC1390 and I am attempting to write a program > which will read and write data out of COM1, COM2, COM3, and COM4. I > have COM3 and COM4 working as they should however I cannot get COM1 > and COM2 to work for the life of me. I am writing the program in C > and like I have said the code works just fine on my PC and for COM3 > and COM4. I will say that COM1 and COM2 are independant of COM3 and > COM4. Is there anyone out there who might be able to shed some light > on this issue. Thanks
You haven't really given enough information. In what way doesn't it work? Can you see the hardware? Does transmit work? Does receive work? Are you using interrupts? Andrew
starman wrote:
> I am working with a SBC1390 and I am attempting to write a program > which will read and write data out of COM1, COM2, COM3, and COM4. I > have COM3 and COM4 working as they should however I cannot get COM1 and > COM2 to work for the life of me. I am writing the program in C and > like I have said the code works just fine on my PC and for COM3 and > COM4. I will say that COM1 and COM2 are independant of COM3 and COM4. > Is there anyone out there who might be able to shed some light on this > issue. Thanks
COM1 and COM3 share an interrupt, as also COM2 and COM4. Your drivers have to be able to handle the situation, and there is some special programming needed to avoid losing interrupt requests with an edge-sensitive PIC set-up (as the PC is using due to the timer). If you can get an IBM PC Technical Manual, the handling is described there. HTH -- Tauno Voipio tauno voipio (at) iki fi
Thanks for asking...

Let me first give you some background information on what I am
attempting to do.  I am using the PC104 board serial ports to... read
in GPS position coordinates from a GPS on one serial port, read in
measurements from a temperature sensor on another serial port, take
these two data strings and combine them, and then via another serial
send them to an amateur radio modem for transmission.  Now as I said
before I can get COM3 (temp sensor) and COM4 (GPS) to read in correctly
however when I attempt to use COM1 or COM2 nothing happens.  I would
also like to add that my temp sensor is powered by the serial port and
when it is connected to COM3 or COM4 the power LED illuminates (thus
showing that at least something is happening).  I have noticed that the
difference between the serial ports on my PC and on the PC104 is that
on the PC104 when I connect my temp sensor the led light automatically
comes on without running my code.  However, on my PC, the power light
is off until my code is executed.  When my code finishes the light goes
back off.  This ofcourse is not the case with the PC104 board.  The
power LED is ON constantly when the temp sensor is pluged into COM3 and
COM4 and always off when I connect it to COM1 and COM2 (thus showing it
is receiving no power.  I have tried to connect COM2 to my PC and
transmit some characters however this does not work, nor does the
receive.  I am not using interupts, and to be completely honest all I
know about interupts is the word "interupts" itself.  Perhaps this is
my problem, could you possibly elaborate on this or atleast direct me
to something that would easily explain this topic.  I do not have a
computer science background, I am just stuborn and like to learn things
I know nothing about.  I hope this helps, just let me know if you have
any more questions.

> Let me first give you some background information on what I am > attempting to do. I am using the PC104 board serial ports to... read > in GPS position coordinates from a GPS on one serial port, read in > measurements from a temperature sensor on another serial port, take > these two data strings and combine them, and then via another serial > send them to an amateur radio modem for transmission. Now as I said > before I can get COM3 (temp sensor) and COM4 (GPS) to read in > correctly however when I attempt to use COM1 or COM2 nothing happens. > I would also like to add that my temp sensor is powered by the serial > port and when it is connected to COM3 or COM4 the power LED > illuminates (thus showing that at least something is happening). I > have noticed that the difference between the serial ports on my PC > and on the PC104 is that on the PC104 when I connect my temp sensor > the led light automatically comes on without running my code. > However, on my PC, the power light is off until my code is executed. > When my code finishes the light goes back off. This ofcourse is not > the case with the PC104 board. The power LED is ON constantly when > the temp sensor is pluged into COM3 and COM4 and always off when I > connect it to COM1 and COM2 (thus showing it is receiving no power. > I have tried to connect COM2 to my PC and transmit some characters > however this does not work, nor does the receive. I am not using > interupts, and to be completely honest all I know about interupts is > the word "interupts" itself. Perhaps this is my problem, could you > possibly elaborate on this or atleast direct me to something that > would easily explain this topic. I do not have a computer science > background, I am just stuborn and like to learn things I know nothing > about. I hope this helps, just let me know if you have any more > questions.
It sounds as if you are not setting modem control lines correctly. If you haven't read them, these two web pages are a useful guide as to how to use and program serial ports on the PC: http://www.beyondlogic.org/serial/serial.htm http://www.beyondlogic.org/serial/serial1.htm If you read through those, and the code samples, then that may shed light on your problem. Perhaps if you read those and then "report back"? Andrew
"starman" <sdoan003@odu.edu> wrote in message
news:1131557547.944922.296750@z14g2000cwz.googlegroups.com...
> Thanks for asking... > > Let me first give you some background information on what I am > attempting to do. I am using the PC104 board serial ports to... read > in GPS position coordinates from a GPS on one serial port, read in > measurements from a temperature sensor on another serial port, take > these two data strings and combine them, and then via another serial > send them to an amateur radio modem for transmission. Now as I said > before I can get COM3 (temp sensor) and COM4 (GPS) to read in correctly > however when I attempt to use COM1 or COM2 nothing happens. I would > also like to add that my temp sensor is powered by the serial port and > when it is connected to COM3 or COM4 the power LED illuminates (thus > showing that at least something is happening). I have noticed that the > difference between the serial ports on my PC and on the PC104 is that > on the PC104 when I connect my temp sensor the led light automatically > comes on without running my code. However, on my PC, the power light > is off until my code is executed. When my code finishes the light goes > back off. This ofcourse is not the case with the PC104 board. The > power LED is ON constantly when the temp sensor is pluged into COM3 and > COM4 and always off when I connect it to COM1 and COM2 (thus showing it > is receiving no power. I have tried to connect COM2 to my PC and > transmit some characters however this does not work, nor does the > receive. I am not using interupts, and to be completely honest all I > know about interupts is the word "interupts" itself. Perhaps this is > my problem, could you possibly elaborate on this or atleast direct me > to something that would easily explain this topic. I do not have a > computer science background, I am just stuborn and like to learn things > I know nothing about. I hope this helps, just let me know if you have > any more questions. >
Is your application reading and writing directly to the UART registers? IIRC, the built-in UART I/O ports are not at the same addresses as they are in a PC. -- James T. White
On 8 Nov 2005 08:10:53 -0800, "starman" <sdoan003@odu.edu> wrote:
>I am working with a SBC1390 and I am attempting to write a program >which will read and write data out of COM1, COM2, COM3, and COM4. I >have COM3 and COM4 working as they should however I cannot get COM1 and >COM2 to work for the life of me. I am writing the program in C and >like I have said the code works just fine on my PC and for COM3 and >COM4. I will say that COM1 and COM2 are independant of COM3 and COM4. >Is there anyone out there who might be able to shed some light on this >issue. Thanks
What operating system are you using on the PC104 platform and is this a different operating system than the one used on your PC and when you tried to connect COM2 to my PC and transmit some characters, did you use a null modem cable. Also, have you used known good software to rule out the hardware as the problem. #Example of QNX Neutrino serial port setup /sbin/devc-ser8250 -u1 3f8,4 -u2 2f8,3 -u3 280,5 -u4 288,5
"starman" <sdoan003@odu.edu> wrote in message 
news:1131466253.534932.166080@g43g2000cwa.googlegroups.com...
>I am working with a SBC1390 and I am attempting to write a program > which will read and write data out of COM1, COM2, COM3, and COM4. I > have COM3 and COM4 working as they should however I cannot get COM1 and > COM2 to work for the life of me. I am writing the program in C and > like I have said the code works just fine on my PC and for COM3 and > COM4. I will say that COM1 and COM2 are independant of COM3 and COM4. > Is there anyone out there who might be able to shed some light on this > issue. Thanks >
Look in the BIOS. You can't share an IRQ between ports. Your IRQs should look something like this example from my project. COM1, Port 3f8-3ff, IRQ 4 COM2, Port 2f8-2ff, IRQ 3 COM3, Port 3e8-3ef, IRQ 10 COM4, Port 2e8-2ef, IRQ 11 Peter