AW: [En-Nut-Discussion] usartavr driver problem/bug FIX

Matthias Ringwald mringwal at inf.ethz.ch
Thu Nov 11 10:32:28 CET 2004


Hi oliver

just had a deep look at the sources, and the reported problem and its 
'fix'
make sense. the rbf_cnt must not be decremented if no data is sent 
(obvious).

I'd like to propose to move the decrement operation after the cts stuff 
to
avoid having first -- then ++ in the code.


if (rbf->rbf_cnt) {	<<<<<<<<<<<<< CHANGED

#ifdef UART_CTS_BIT
         /*
          * If CTS has been disabled, we disable the transmit interrupts
          * and return without sending anything.
          */
         if (cts_sense && bit_is_set(UART_CTS_PIN, UART_CTS_BIT)) {
             cbi(UCSRnB, UDRIE);
             sbi(EIMSK, UART_CTS_BIT);
             return;
         }
#endif
         rbf->rbf_cnt--;  // <<<<<<<<<<<<<<<<<<<<<<<<<<<<< ADDED


anyway, I'm currently struggling with the usart and probably the time
spend in critical sections as I'm gettting buffer overruns (IRQ not
called in time) on 115200 baud on an 7.28 Mhz ATmega128.
If I'm not mistaken the Atmel uart complains only after he has already 
3 bytes
waiting which to me translates to 300 uS or 2000 instructions. I'm 
still wondering..
I'll probably add my blocking read proposed earlier this year, to avoid 
at least
some thread switches.

regards,
matthias


On 11.11.2004, at 09:16, Oliver Schulz wrote:

> Hi,
>
> sorry, but I didn't follow that discussion.
> But, when I saw "bug FIX" in the subject line, I waked up :-)
>
> Question: Is the fix provided by Greg wokring and should be commited 
> to the
> CVS?
>
> Regards,
> Oliver.
>
> -----Ursprüngliche Nachricht-----
> Von: en-nut-discussion-bounces at egnite.de
> [mailto:en-nut-discussion-bounces at egnite.de]Im Auftrag von Jean Pierre
> Gauthier
> Gesendet: Mittwoch, 10. November 2004 15:26
> An: 'Ethernut User Chat (English)'
> Betreff: RE: [En-Nut-Discussion] usartavr driver problem/bug FIX
>
>
> Yes, that well works until now (without UART_SETWRITETIMEOUT)...
> May be THE solution.
> JP
>
> -----Message d'origine-----
> De : en-nut-discussion-bounces at egnite.de
> [mailto:en-nut-discussion-bounces at egnite.de] De la part de Grzegorz 
> Plonski
> Envoyé : mercredi 10 novembre 2004 13:10
> À : 'Ethernut User Chat (English)'
> Objet : RE: [En-Nut-Discussion] usartavr driver problem/bug FIX
>
> Hi,
>
>
>
> Make this in usartavr.c :
>
> if (rbf->rbf_cnt--) {
>
> #ifdef UART_CTS_BIT
>         /*
>          * If CTS has been disabled, we disable the transmit interrupts
>          * and return without sending anything.
>          */
>         if (cts_sense && bit_is_set(UART_CTS_PIN, UART_CTS_BIT)) {
>             cbi(UCSRnB, UDRIE);
>             sbi(EIMSK, UART_CTS_BIT);
>
>
>             rbf->rbf_cnt++;  // <<<<<<<<<<<<<<<<<<<<<<<<<<<<< ADDED
>
>
>             return;
>         }
> #endif
>
>
> Greg Plonski,
>
>




More information about the En-Nut-Discussion mailing list