public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Serial and AT91
@ 2005-06-13 11:23 Edgar Grimberg
  2005-06-13 12:16 ` Andrew Lunn
  0 siblings, 1 reply; 7+ messages in thread
From: Edgar Grimberg @ 2005-06-13 11:23 UTC (permalink / raw)
  To: ecos-discuss

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.

Regards,
Edgar.


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Serial and AT91
  2005-06-13 11:23 [ECOS] Serial and AT91 Edgar Grimberg
@ 2005-06-13 12:16 ` Andrew Lunn
  2005-06-13 14:08   ` Edgar Grimberg
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Lunn @ 2005-06-13 12:16 UTC (permalink / raw)
  To: Edgar Grimberg; +Cc: ecos-discuss

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Serial and AT91
  2005-06-13 12:16 ` Andrew Lunn
@ 2005-06-13 14:08   ` Edgar Grimberg
  2005-06-16 17:47     ` Edgar Grimberg
  0 siblings, 1 reply; 7+ messages in thread
From: Edgar Grimberg @ 2005-06-13 14:08 UTC (permalink / raw)
  To: ecos-discuss

Hello Andrew,
Thanks for the quick reply.

>When i have problems with serial ports i generaly first check if the
>flow control setup is correct.
>  
>
I have disabled the flow control because I have to "talk" to a machine 
that is a black box to me. I have only RX, TX and GND and a list of 
commands that I can send and receive.
In io_serial.cdl file I have:

cdl_component CYGPKG_IO_SERIAL_FLOW_CONTROL {
............
        default_value     0
        cdl_component CYGOPT_IO_SERIAL_FLOW_CONTROL_SOFTWARE {
                display       "Software flow control"
                default_value 0
.............

Regards,
Edgar


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Serial and AT91
  2005-06-13 14:08   ` Edgar Grimberg
@ 2005-06-16 17:47     ` Edgar Grimberg
  2005-06-17  8:49       ` [ECOS] porting ecos to at91sam7 Jokke Ramberg
  0 siblings, 1 reply; 7+ messages in thread
From: Edgar Grimberg @ 2005-06-16 17:47 UTC (permalink / raw)
  To: ecos-discuss

Hello again,

Just for the curious, the problem was that I messed up with interrupts 
in a way that I managed to mask the interrupt for the serial port... 
Learning is just so hard. :)

Best regards,
Edgar


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ECOS] porting ecos to at91sam7
  2005-06-16 17:47     ` Edgar Grimberg
@ 2005-06-17  8:49       ` Jokke Ramberg
  2005-06-17 11:31         ` Andrew Lunn
  0 siblings, 1 reply; 7+ messages in thread
From: Jokke Ramberg @ 2005-06-17  8:49 UTC (permalink / raw)
  To: ecos-discuss

I am trying to port ecos to Atmels AT91sam7s64. I start out from
AT91EB55 (from CVS 050504).

Following the instructions in "embedded software development with ecos"
and some debugging, have got to a stage where the I can build an example
application from the two-threads example in ecos. I can load it and
start.

The two threads are started, I get the start messages from them, with
the correct baudrate, on the serial port, the threads calls
"cyg_thread_delay(20);", but this function never returns!

I get the timer interrupts, the function "void Cyg_Counter::tick
( cyg_uint32 ticks )" is called regularly (I did not measure how often).

What is more required for delay to return? Any defines or cdl stuff??

Jokke


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] porting ecos to at91sam7
  2005-06-17  8:49       ` [ECOS] porting ecos to at91sam7 Jokke Ramberg
@ 2005-06-17 11:31         ` Andrew Lunn
  2005-06-20  7:06           ` Jokke Ramberg
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Lunn @ 2005-06-17 11:31 UTC (permalink / raw)
  To: Jokke Ramberg; +Cc: ecos-discuss

On Fri, Jun 17, 2005 at 10:49:08AM +0200, Jokke Ramberg wrote:
> I am trying to port ecos to Atmels AT91sam7s64. I start out from
> AT91EB55 (from CVS 050504).
> 
> Following the instructions in "embedded software development with ecos"
> and some debugging, have got to a stage where the I can build an example
> application from the two-threads example in ecos. I can load it and
> start.
> 
> The two threads are started, I get the start messages from them, with
> the correct baudrate, on the serial port, the threads calls
> "cyg_thread_delay(20);", but this function never returns!
> 
> I get the timer interrupts, the function "void Cyg_Counter::tick
> ( cyg_uint32 ticks )" is called regularly (I did not measure how often).
> 
> What is more required for delay to return? Any defines or cdl stuff??

I suggest you run the standard tests and see what passes
fails. clocktruth can be used to make sure the clock is ticking at the
right rate 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] porting ecos to at91sam7
  2005-06-17 11:31         ` Andrew Lunn
@ 2005-06-20  7:06           ` Jokke Ramberg
  0 siblings, 0 replies; 7+ messages in thread
From: Jokke Ramberg @ 2005-06-20  7:06 UTC (permalink / raw)
  To: ecos-discuss

fre 2005-06-17 klockan 13:30 +0200 skrev Andrew Lunn:
> On Fri, Jun 17, 2005 at 10:49:08AM +0200, Jokke Ramberg wrote:
> > I am trying to port ecos to Atmels AT91sam7s64. I start out from
> > AT91EB55 (from CVS 050504).
> > 
> > Following the instructions in "embedded software development with ecos"
> > and some debugging, have got to a stage where the I can build an example
> > application from the two-threads example in ecos. I can load it and
> > start.
> > 
> > The two threads are started, I get the start messages from them, with
> > the correct baudrate, on the serial port, the threads calls
> > "cyg_thread_delay(20);", but this function never returns!
> > 
> > I get the timer interrupts, the function "void Cyg_Counter::tick
> > ( cyg_uint32 ticks )" is called regularly (I did not measure how often).
> > 
> > What is more required for delay to return? Any defines or cdl stuff??
> 
> I suggest you run the standard tests and see what passes
> fails. clocktruth can be used to make sure the clock is ticking at the
> right rate etc.
> 
>         Andrew
> 
I can try, but I have very little memory on my device, so the tests can
be hard to build.

The clock speed is one thing, but even it is not correct, the delay
should return ( I set it to only 20, and I can see the tick rate is at
least > 1 Hz).

Jokke



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-06-20  7:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-13 11:23 [ECOS] Serial and AT91 Edgar Grimberg
2005-06-13 12:16 ` Andrew Lunn
2005-06-13 14:08   ` Edgar Grimberg
2005-06-16 17:47     ` Edgar Grimberg
2005-06-17  8:49       ` [ECOS] porting ecos to at91sam7 Jokke Ramberg
2005-06-17 11:31         ` Andrew Lunn
2005-06-20  7:06           ` Jokke Ramberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).