[En-Nut-Discussion] Possible BUG in ARM usart driver or crt routines

Bernd Walter enut at cicely.de
Thu Sep 3 02:45:59 CEST 2009


On Tue, Sep 01, 2009 at 06:58:58PM +0200, Ole Reinhardt wrote:
> Hi!
> 
> >    With the atmega128 the default buffer size seems fine, but I don't
> > think I ever filled it completely.
> 
> With the default buffer size it seems to work quite well, but now I need
> to send out data without any buffer.
> 
> Detailed problem:
> 
> I need to wait for at least 50ms after sending the buffer before sending
> more data. If I have a large buffer I can not say how much data is still
> in the buffer, so a nutsleep directly after fwrite() I don't know the
> exactly when the last byte was send out (by interrupt driven UART).

I needed something similar, but used direct hardware access on SAM7X256.
Setup DMA to send the data block and interrupt on txdone.
Interrupt routine sets rx-idle interrupt - you also could use a general
purpose timer for that case.
I use it for Modbus/RTU, which also uses rx-idle support for RX,
which is very fine, because I setup RX DMA with max packet size and get
an interrupt once the packet is available.
The interrupt sets an event for the worker thread ans resisssues a
new timer for TX, because there is a defined safety gap to enshure
that everyone sees the packet end.
The rx idle are differently setup, because the packet end rx-idle
is triggered by the first received character and the tx safety
directly starts counting.
SAM7's USART timeout features are quite nice.

-- 
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.



More information about the En-Nut-Discussion mailing list