[En-Nut-Discussion] how to assign stdout, stdin and sterr to the same uart?

Harald Kipp harald.kipp at egnite.de
Fri Oct 26 10:37:11 CEST 2007

Matthias Ringwald schrieb:
> after years of using nut/os, I've just stumbled about a newbie  
> question/problem.
That would have amused me, but

>    NutRegisterDevice(&devUsartAvr0, 0, 0);
>    freopen(devUsartAvr0.dev_name, "w", stdout);
>    freopen(devUsartAvr0.dev_name, "r", stdin);
is fully correct. It is used for example in app/caltime/caltime.c.

> _freopen first looks for the proper __iob entry and then calls _open  
> for the given device with the given flags.
> the usart on the avr is not written to be opened twice, especially  
> with different mode flags, everything is reset.

Well, I remember that we recently had problems with the caltime sample 
(unable to enter anything). It finally worked, but I can't remember how 
we fixed it. Definitely not by changing the Nut/OS code.



More information about the En-Nut-Discussion mailing list