public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS]  Ethernet traffic causing loss of bytes on UART
@ 2009-09-01  6:24 Alex Lindeijer
  2009-09-01 14:36 ` Alex Lindeijer
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Lindeijer @ 2009-09-01  6:24 UTC (permalink / raw)
  To: ecos-discuss

Hi
We are running a serial port on 38400 baud and are seeing loss of Rx
bytes. When unplugging the ethernet cable we have no problems.
We are using a MPC8541, it has a PC16550D programming model for the
UART. I see that the driver uses the FIFO and reads until the FIFO is
empty.
The Ethernet driver is a tsec driver .
We encountered similar problems when writing to flash. We got some
verification/write errors with Ethernet traffic going. In that case we
masked the interrupts while writing to flash. But we don't want to do
that when receiving bytes on the serial port of course.

Has anybody else encounter such problems? Any hints in were to look? We
have been looking into this now for some time and are getting a bit
desperate.....;-(

Cheers
Alex Lindeijer

--
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] 6+ messages in thread

* RE: [ECOS]  Ethernet traffic causing loss of bytes on UART
  2009-09-01  6:24 [ECOS] Ethernet traffic causing loss of bytes on UART Alex Lindeijer
@ 2009-09-01 14:36 ` Alex Lindeijer
  2009-09-01 15:24   ` Gary Thomas
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Lindeijer @ 2009-09-01 14:36 UTC (permalink / raw)
  To: Alex Lindeijer, ecos-discuss

Hi All
This problem is fixed. The drivers that came with our Python MPC8541
eval board, acknowledged the ethernet interrput in the DSR (after
processing!) and not in the ISR.
It seems to work fine now.
/Alex

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Alex
Lindeijer
Sent: 1. september 2009 08:24
To: ecos-discuss@sourceware.org
Subject: [ECOS] Ethernet traffic causing loss of bytes on UART

Hi
We are running a serial port on 38400 baud and are seeing loss of Rx
bytes. When unplugging the ethernet cable we have no problems.
We are using a MPC8541, it has a PC16550D programming model for the
UART. I see that the driver uses the FIFO and reads until the FIFO is
empty.
The Ethernet driver is a tsec driver .
We encountered similar problems when writing to flash. We got some
verification/write errors with Ethernet traffic going. In that case we
masked the interrupts while writing to flash. But we don't want to do
that when receiving bytes on the serial port of course.

Has anybody else encounter such problems? Any hints in were to look? We
have been looking into this now for some time and are getting a bit
desperate.....;-(

Cheers
Alex Lindeijer

-- 
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

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

* Re: [ECOS]  Ethernet traffic causing loss of bytes on UART
  2009-09-01 14:36 ` Alex Lindeijer
@ 2009-09-01 15:24   ` Gary Thomas
  2009-09-01 16:30     ` SV: " Alex Lindeijer
  0 siblings, 1 reply; 6+ messages in thread
From: Gary Thomas @ 2009-09-01 15:24 UTC (permalink / raw)
  To: Alex Lindeijer; +Cc: ecos-discuss

On 09/01/2009 08:36 AM, Alex Lindeijer wrote:
> Hi All
> This problem is fixed. The drivers that came with our Python MPC8541
> eval board, acknowledged the ethernet interrput in the DSR (after
> processing!) and not in the ISR.
> It seems to work fine now.

How does that have anything to do with losing bytes on the UART?

BTW, IMO it's not safe/proper to acknowledge the interrupt in the ISR.
The ISR masks the interrupt and only after the network stack has fully
processed the data is it acknowledged and unmasked.  Acking the interrupt
in the ISR could lead to missing some interrupts.

> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Alex
> Lindeijer
> Sent: 1. september 2009 08:24
> To: ecos-discuss@sourceware.org
> Subject: [ECOS] Ethernet traffic causing loss of bytes on UART
>
> Hi
> We are running a serial port on 38400 baud and are seeing loss of Rx
> bytes. When unplugging the ethernet cable we have no problems.
> We are using a MPC8541, it has a PC16550D programming model for the
> UART. I see that the driver uses the FIFO and reads until the FIFO is
> empty.
> The Ethernet driver is a tsec driver .
> We encountered similar problems when writing to flash. We got some
> verification/write errors with Ethernet traffic going. In that case we
> masked the interrupts while writing to flash. But we don't want to do
> that when receiving bytes on the serial port of course.
>
> Has anybody else encounter such problems? Any hints in were to look? We
> have been looking into this now for some time and are getting a bit
> desperate.....;-(
>
> Cheers
> Alex Lindeijer
>


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
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] 6+ messages in thread

* SV: [ECOS]  Ethernet traffic causing loss of bytes on UART
  2009-09-01 15:24   ` Gary Thomas
@ 2009-09-01 16:30     ` Alex Lindeijer
  2009-09-01 19:01       ` Christophe Coutand
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Lindeijer @ 2009-09-01 16:30 UTC (permalink / raw)
  To: Gary Thomas; +Cc: ecos-discuss

Hi
When we were missing bytes on the serial port and we pulled the ethernet cable out, we received all bytes on the serial port. First we tried increasing the serial port interrupt priority since it actually tolerates less interupt latency than the ethernet port.
I'll have to study the MPC8541 reference guide more later but as we understand it:
The interupt controller in the MPC8541 needs to have the interrupt acknowledge before it handles any new interrupts(like from the UART). So, in the ISR of the ethernet driver we mask the ethernet interrupt and acknowledge the interrupt which allows the interrupt controller to process new interupts /call ISRs. In the DSR of the ethernet driver we service the ethernet interrupt and unmask it when done.
If we acknowledge the interrupt before leaving the DSR, no other interrupt given by the interrupt controller whilst processing the ethernet frames. That is why we lost bytes on the serial port.
At least that is our theory, which I have to confirm by checking the documentation closer.
In pratice we are now receiving/sending traffic on both ethernet and serial port undisturbed. 
This also the we I have seen it done in other drivers (also an alternative tsec driver).
This is we think it works. But I appreciate any comments and tips. Interupt handling and driver software is certainly not my strongest point.
Cheers
Alex

________________________________

Fra: Gary Thomas [mailto:gary@mlbassoc.com]
Sendt: ti 01.09.2009 17:24
Til: Alex Lindeijer
Kopi: ecos-discuss@sourceware.org
Emne: Re: [ECOS] Ethernet traffic causing loss of bytes on UART



On 09/01/2009 08:36 AM, Alex Lindeijer wrote:
> Hi All
> This problem is fixed. The drivers that came with our Python MPC8541
> eval board, acknowledged the ethernet interrput in the DSR (after
> processing!) and not in the ISR.
> It seems to work fine now.

How does that have anything to do with losing bytes on the UART?

BTW, IMO it's not safe/proper to acknowledge the interrupt in the ISR.
The ISR masks the interrupt and only after the network stack has fully
processed the data is it acknowledged and unmasked.  Acking the interrupt
in the ISR could lead to missing some interrupts.

> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Alex
> Lindeijer
> Sent: 1. september 2009 08:24
> To: ecos-discuss@sourceware.org
> Subject: [ECOS] Ethernet traffic causing loss of bytes on UART
>
> Hi
> We are running a serial port on 38400 baud and are seeing loss of Rx
> bytes. When unplugging the ethernet cable we have no problems.
> We are using a MPC8541, it has a PC16550D programming model for the
> UART. I see that the driver uses the FIFO and reads until the FIFO is
> empty.
> The Ethernet driver is a tsec driver .
> We encountered similar problems when writing to flash. We got some
> verification/write errors with Ethernet traffic going. In that case we
> masked the interrupts while writing to flash. But we don't want to do
> that when receiving bytes on the serial port of course.
>
> Has anybody else encounter such problems? Any hints in were to look? We
> have been looking into this now for some time and are getting a bit
> desperate.....;-(
>
> Cheers
> Alex Lindeijer
>


--
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------



--
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] 6+ messages in thread

* RE: [ECOS]  Ethernet traffic causing loss of bytes on UART
  2009-09-01 16:30     ` SV: " Alex Lindeijer
@ 2009-09-01 19:01       ` Christophe Coutand
  2009-09-02  9:01         ` Alex Lindeijer
  0 siblings, 1 reply; 6+ messages in thread
From: Christophe Coutand @ 2009-09-01 19:01 UTC (permalink / raw)
  To: Alex Lindeijer; +Cc: ecos-discuss

Hi Alex,

I'm curious, what does the acknowledge routine do? Is it just writing to
the End Of Interrupt (EOI) register? 

Christophe

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Alex
Lindeijer
Sent: Tuesday, September 01, 2009 6:30 PM
To: Gary Thomas
Cc: ecos-discuss@sourceware.org
Subject: SV: [ECOS] Ethernet traffic causing loss of bytes on UART

Hi
When we were missing bytes on the serial port and we pulled the ethernet
cable out, we received all bytes on the serial port. First we tried
increasing the serial port interrupt priority since it actually
tolerates less interupt latency than the ethernet port.
I'll have to study the MPC8541 reference guide more later but as we
understand it:
The interupt controller in the MPC8541 needs to have the interrupt
acknowledge before it handles any new interrupts(like from the UART).
So, in the ISR of the ethernet driver we mask the ethernet interrupt and
acknowledge the interrupt which allows the interrupt controller to
process new interupts /call ISRs. In the DSR of the ethernet driver we
service the ethernet interrupt and unmask it when done.
If we acknowledge the interrupt before leaving the DSR, no other
interrupt given by the interrupt controller whilst processing the
ethernet frames. That is why we lost bytes on the serial port.
At least that is our theory, which I have to confirm by checking the
documentation closer.
In pratice we are now receiving/sending traffic on both ethernet and
serial port undisturbed. 
This also the we I have seen it done in other drivers (also an
alternative tsec driver).
This is we think it works. But I appreciate any comments and tips.
Interupt handling and driver software is certainly not my strongest
point.
Cheers
Alex

________________________________

Fra: Gary Thomas [mailto:gary@mlbassoc.com]
Sendt: ti 01.09.2009 17:24
Til: Alex Lindeijer
Kopi: ecos-discuss@sourceware.org
Emne: Re: [ECOS] Ethernet traffic causing loss of bytes on UART



On 09/01/2009 08:36 AM, Alex Lindeijer wrote:
> Hi All
> This problem is fixed. The drivers that came with our Python MPC8541
> eval board, acknowledged the ethernet interrput in the DSR (after
> processing!) and not in the ISR.
> It seems to work fine now.

How does that have anything to do with losing bytes on the UART?

BTW, IMO it's not safe/proper to acknowledge the interrupt in the ISR.
The ISR masks the interrupt and only after the network stack has fully
processed the data is it acknowledged and unmasked.  Acking the
interrupt
in the ISR could lead to missing some interrupts.

> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Alex
> Lindeijer
> Sent: 1. september 2009 08:24
> To: ecos-discuss@sourceware.org
> Subject: [ECOS] Ethernet traffic causing loss of bytes on UART
>
> Hi
> We are running a serial port on 38400 baud and are seeing loss of Rx
> bytes. When unplugging the ethernet cable we have no problems.
> We are using a MPC8541, it has a PC16550D programming model for the
> UART. I see that the driver uses the FIFO and reads until the FIFO is
> empty.
> The Ethernet driver is a tsec driver .
> We encountered similar problems when writing to flash. We got some
> verification/write errors with Ethernet traffic going. In that case we
> masked the interrupts while writing to flash. But we don't want to do
> that when receiving bytes on the serial port of course.
>
> Has anybody else encounter such problems? Any hints in were to look?
We
> have been looking into this now for some time and are getting a bit
> desperate.....;-(
>
> Cheers
> Alex Lindeijer
>


--
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------



-- 
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

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

* RE: [ECOS]  Ethernet traffic causing loss of bytes on UART
  2009-09-01 19:01       ` Christophe Coutand
@ 2009-09-02  9:01         ` Alex Lindeijer
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Lindeijer @ 2009-09-02  9:01 UTC (permalink / raw)
  To: Christophe Coutand; +Cc: ecos-discuss

Yes in case og an interrupt from the PIC it doing only that. In case of
a CPM interupt it for acknowledges it in the CPM and then the PIC(EOI)
/Alex

-----Original Message-----
From: Christophe Coutand [mailto:ccoutand@stmi.com] 
Sent: 1. september 2009 21:02
To: Alex Lindeijer
Cc: ecos-discuss@sourceware.org
Subject: RE: [ECOS] Ethernet traffic causing loss of bytes on UART

Hi Alex,

I'm curious, what does the acknowledge routine do? Is it just writing to
the End Of Interrupt (EOI) register? 

Christophe

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Alex
Lindeijer
Sent: Tuesday, September 01, 2009 6:30 PM
To: Gary Thomas
Cc: ecos-discuss@sourceware.org
Subject: SV: [ECOS] Ethernet traffic causing loss of bytes on UART

Hi
When we were missing bytes on the serial port and we pulled the ethernet
cable out, we received all bytes on the serial port. First we tried
increasing the serial port interrupt priority since it actually
tolerates less interupt latency than the ethernet port.
I'll have to study the MPC8541 reference guide more later but as we
understand it:
The interupt controller in the MPC8541 needs to have the interrupt
acknowledge before it handles any new interrupts(like from the UART).
So, in the ISR of the ethernet driver we mask the ethernet interrupt and
acknowledge the interrupt which allows the interrupt controller to
process new interupts /call ISRs. In the DSR of the ethernet driver we
service the ethernet interrupt and unmask it when done.
If we acknowledge the interrupt before leaving the DSR, no other
interrupt given by the interrupt controller whilst processing the
ethernet frames. That is why we lost bytes on the serial port.
At least that is our theory, which I have to confirm by checking the
documentation closer.
In pratice we are now receiving/sending traffic on both ethernet and
serial port undisturbed. 
This also the we I have seen it done in other drivers (also an
alternative tsec driver).
This is we think it works. But I appreciate any comments and tips.
Interupt handling and driver software is certainly not my strongest
point.
Cheers
Alex

________________________________

Fra: Gary Thomas [mailto:gary@mlbassoc.com]
Sendt: ti 01.09.2009 17:24
Til: Alex Lindeijer
Kopi: ecos-discuss@sourceware.org
Emne: Re: [ECOS] Ethernet traffic causing loss of bytes on UART



On 09/01/2009 08:36 AM, Alex Lindeijer wrote:
> Hi All
> This problem is fixed. The drivers that came with our Python MPC8541
> eval board, acknowledged the ethernet interrput in the DSR (after
> processing!) and not in the ISR.
> It seems to work fine now.

How does that have anything to do with losing bytes on the UART?

BTW, IMO it's not safe/proper to acknowledge the interrupt in the ISR.
The ISR masks the interrupt and only after the network stack has fully
processed the data is it acknowledged and unmasked.  Acking the
interrupt
in the ISR could lead to missing some interrupts.

> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Alex
> Lindeijer
> Sent: 1. september 2009 08:24
> To: ecos-discuss@sourceware.org
> Subject: [ECOS] Ethernet traffic causing loss of bytes on UART
>
> Hi
> We are running a serial port on 38400 baud and are seeing loss of Rx
> bytes. When unplugging the ethernet cable we have no problems.
> We are using a MPC8541, it has a PC16550D programming model for the
> UART. I see that the driver uses the FIFO and reads until the FIFO is
> empty.
> The Ethernet driver is a tsec driver .
> We encountered similar problems when writing to flash. We got some
> verification/write errors with Ethernet traffic going. In that case we
> masked the interrupts while writing to flash. But we don't want to do
> that when receiving bytes on the serial port of course.
>
> Has anybody else encounter such problems? Any hints in were to look?
We
> have been looking into this now for some time and are getting a bit
> desperate.....;-(
>
> Cheers
> Alex Lindeijer
>


--
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------



-- 
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

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

end of thread, other threads:[~2009-09-02  9:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-01  6:24 [ECOS] Ethernet traffic causing loss of bytes on UART Alex Lindeijer
2009-09-01 14:36 ` Alex Lindeijer
2009-09-01 15:24   ` Gary Thomas
2009-09-01 16:30     ` SV: " Alex Lindeijer
2009-09-01 19:01       ` Christophe Coutand
2009-09-02  9:01         ` Alex Lindeijer

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).