[En-Nut-Discussion] Global variables and threads

Matthias Ringwald mringwal at inf.ethz.ch
Tue Sep 20 12:16:02 CEST 2005


Hi Anton

which of your uart open code produces the character?

On 19.09.2005, at 16:10, Anton Veldhuizen wrote:

> NutRegisterDevice(&devUsartAvr0, 0, 0)
> Usart0FilePtr = fopen("uart0", "w+");
> _ioctl(_fileno(Usart0FilePtr), UART_SETSPEED, &commsBaud);
> _ioctl(_fileno(Usart0FilePtr), UART_SETCOOKEDMODE, &cookedMode);

I guess its the very first. Before the Uart is initialized the
tx pin is configured as input, so its floating for any receiver  
connected.
by opening the device tx goes to a stable 1.

one way to solve this could be a pull-up resistor to VCC, so the  
receiver
sees a constant 1 before you system starts up.

There was an issue when changing the baudrate would also bring tx to  
tri-state
mode but I fixed it a while ago in CVS (check the ChangeLog for details)


Another comment one large global variables. Did you allocate them  
with malloc/
NutHeapAlloc? I'm still unsure, if its is safe to use more than 4k for
global structs that are allocated by avr-gcc and I keep telling  
people to dynamically
alloc all global structs to be one the safe side. so if you didn't  
use NutHeapAlloc,
just do so. :)
(Harald, if you are sure about more than 4k working for sure, tell  
me..:)

matthias



More information about the En-Nut-Discussion mailing list