[En-Nut-Discussion] How to read from DEV_DEBUG (uart) on AT91SAM7x?

Ulrich Prinz uprinz2 at netscape.net
Fri Feb 4 00:03:18 CET 2011



Am 31.01.2011 20:10, schrieb Bernd Walter:
>
> In short: DEV_DEBUG is write only.
> DEV_DEBUG is just a simplified polling device driver for debug outputs.
> It won't add much code.
>
> If you want to read from the DBGU device you need another driver,
> which you can use it via DEV_UARTD/DEV_UARTD_NAME.
>
That was true in the past.

In actual trunk AT91SAMxxx handles DBGU as a real USART ( in fact it is 
one with some missing features) and you can use it with read an write 
like any other usart too.

For me it worked like this:

     NutRegisterDevice(&DEV_UARTD, 0, 0);
     freopen(DEV_UARTD_NAME, "w+", stdout);
     stdin = stderr = stdout;

but it should work in separate fopen / freopen calls for stdin and 
stdout too.

Best regards
Ulrich



More information about the En-Nut-Discussion mailing list