This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Serial and AT91
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Edgar Grimberg <edgar dot grimberg at rms dot ro>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Mon, 13 Jun 2005 14:16:42 +0200
- Subject: Re: [ECOS] Serial and AT91
- References: <42AD6CA8.40504@rms.ro>
On Mon, Jun 13, 2005 at 02:23:20PM +0300, Edgar Grimberg wrote:
> Hello,
>
> My application is supposed to send some commands over the serial port to
> an external device, so I created some classes to handle the
> communication. The procedure is as follows:
>
> 1. lookup the device
>
> err = cyg_io_lookup( "/dev/ser1", &handle );
>
> The return value is ENOERR
>
> 2. send some data
>
> err = cyg_io_write(handle, &send_buffer[0], &len);
>
> 3. drain the serial output
>
> cyg_uint32 len = 1;
> err = cyg_io_get_config(handle,
> CYG_IO_GET_CONFIG_SERIAL_OUTPUT_DRAIN, 0, &len);
>
> 4. call 2 & 3 again with different data
>
> I monitor the serial port with a terminal program that shows me the hex
> code of the bytes sent. The first time I call 1, 2 and 3 and I see the
> desired result. The handle variable is global, so the second time, I
> call only 2 and 3. The application sends the data over the serial port
> OK (step 2), but hangs at 3. The size of the data is not big (10-20
> bytes / cycle).
> The first thing to try was to skip step 3. Without it, the first 2
> cycles were OK, at the third one, no data is sent.
> I debugged into the serial driver and found that, in
> at91_serial_start_xmit(serial_channel *chan), the condition
> (at91_chan->flags & SIFLG_XMIT_CONTINUE) == 0 is false. No matter how
> much I wait or how many times I try to send the data, this condition
> remains false.
>
> If you have any hints, I will be very grateful.
When i have problems with serial ports i generaly first check if the
flow control setup is correct.
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