This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
RE: Serial port problem
- From: "Ubhay" <ubhay dot kumar at induslogic dot com>
- To: <ecos-discuss at ecos dot sourceware dot org>
- Date: Fri, 12 May 2006 18:35:32 +0530
- Subject: RE: [ECOS] Serial port problem
Hi Andrew,
Thanks for your reply.
I have checked my printer's configuration. It does not work in flow control
RTSCTS_OUT (i.e. Flow control for outgoing packets) for all other flow
control it works. I have cheked this using my java code and javax.comm
library.
I tried followings:
1. In the ecos image I checked the flow control setting which was set to
software control. I changed that to hardware and the mode to "NONE".
2. In redboot I don't see any flow control option in serial device driver
package. So my question is how do I set the option to "hardware/NONE" in
redboot image? I have built redboot by following ecos eBook.
One more observation
********************
When I change the serail port baud rate to 19200
(cygnum_hal_virtual_vector_console_channel_baud and
cygnum_hal_virtual_vector_debug_channel_baud in redboot image) my ethernet
connection became very slow and I was not able to load my applications on
target device (I have explained my hardware setup in my previous mail,
basically I use tcp/ip to connect to target device using hyperterm). I could
not quite relate this as I changed the baud rate of serial port and how this
should effect the network speed etc. Once I changed this back to 38400
(default) I was able to load apps again.
I was trying 19200 (as this is the baud required by the printer).
Thanks,
Ubhay Kumar
Jr. Architect
Induslogic Inc.
The Leader in Software Product Engineering
B-34/1, Sector 59
Noida, India 201301
Phone + 91.120.434.2302
Mobile +91.981.120.4901
ubhay.kumar@induslogic.com
www.induslogic.com
-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Andrew Lunn
Sent: Friday, May 12, 2006 2:15 AM
To: Ubhay
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Serial port problem
On Fri, May 12, 2006 at 12:35:08AM +0530, Ubhay wrote:
> Hi,
>
> Problem statement:
> *******************
>
> I am having problem getting the printer device work which is connected
> on serial port 0 (COM1).
>
> Configuration:
> **************
>
> I have successfully loaded and run "hello world" and "serial" program
> using i386 arch configurations on my target machine. To load the hello
> world program i use hyperterminal and connect to target using tcp/ip
> (not using serial port, as I do not have the null modem cable).
>
> My target machine is a usual pentium 4 based PC.
>
> My Code:
> ********
> static void simple_prog(CYG_ADDRESS data)
> {
> cyg_io_handle_t handle;
> cyg_io_handle_t handle1;
> cyg_uint32 i;
> cyg_serial_info_t si;
> Cyg_ErrNo err,err1;
> const char test_string[] = {(char)0x7E,(char)0xB2,(char)0xF0,
> (char)'a',(char)'a',(char)'a',(char)'a',(char)'a',(char)'a',(char)'a',
> (char)
>
'a',(char)'a',(char)'a',(char)'a',(char)'a',(char)'a',(char)'a',(char)'a',(c
>
har)'a',(char)'a',(char)'a',(char)'a',(char)'a',(char)'a',(char)'a',(char)'a
> ',(char)'a',(char)0x04,(char)70};
>
> cyg_uint32 len = strlen(test_string);
>
>
>
> printf("Starting serial example\n");
>
> err = cyg_io_lookup( "/dev/haldiag", &handle );
> err1 = cyg_io_lookup( "/dev/ser0", &handle1 );
>
>
> si.baud = CYGNUM_SERIAL_BAUD_19200;
> si.word_length = CYGNUM_SERIAL_WORD_LENGTH_8;
> si.stop = CYGNUM_SERIAL_STOP_1;
> si.parity = CYGNUM_SERIAL_PARITY_NONE;
> si.flags = 0;
> i = sizeof(si);
>
> cyg_io_set_config(handle, CYG_IO_SET_CONFIG_SERIAL_INFO, &si, &i);
> cyg_io_set_config(handle1, CYG_IO_SET_CONFIG_SERIAL_INFO, &si, &i);
>
> if (ENOERR == err) {
> printf("Found /dev/haldiag. Writing string....\n");
> err = cyg_io_write( handle, test_string, &len );
> }
>
> if (ENOERR == err1) {
> printf("Found /dev/serial1. Writing string....\n");
> err1 = cyg_io_write( handle1, test_string, &len );
> }
>
> if (ENOERR == err) {
> printf("I think I wrote the string. Did you see it?\n");
> }
>
> if (ENOERR == err1) {
> printf("I think I wrote the string. Did you see it?\n");
> }
>
> printf("Serial example finished\n");
>
> }
>
> END of Code
> ***************************
>
> Behavior of the code:
> ***********************
>
> The code successfully finds and open both the ports (as I don't get
> any err or err1 in the code above). But though I see the text on
> console nothing happens on my printer.
Does it need a \n at the end to make the printer do anything?
> One more problem which I have noticed is following:
>
> When i boot the target PC (with the printer connected on serial port 0
> i.e
> COM1) the led display of printers go red (from the normal green) even
before
> I load or run any program .
>
> Then after I load and run the code (above) the printer's led becomes
> green again (after the program finishes). I could not understand this
> behavior too.
Check the manual for the printer. Does it need any of the handshaking lines
set? DCE, DTE, CTS, RTS etc.....
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss