[En-Nut-Discussion] Problems with uart

Hugo Simon hugo.simon at gmx.de
Sun Jun 13 13:34:34 CEST 2004


Hi,

since I upgraded to the actual Nut/OS I have problems with the uart. It
sends out garbage or nothing. Looks a bit like the baudrate is wrong. But
the supplied applications like uart.c work fine. I don't see what I am doing
wrong. Please look at my code snipped below. Maybe you see whats wrong. I am
now using an Ethernut 1.3 on my old Ethernut 1.0 the code works fine.
Do I have anything to do in the makefile or so, so that Nut/OS knows the new
clock frequency? But the general makefiles seem to be allright because only
my application dont work, all the samples work fine.

Hope you can help.

Thanks
Thorsten


Code snippet:

int main(void)
{
 char i;
 char line[200];
  u_long baud = 115200;

  /*
   * Register the UART device, open it, assign stdout to it and set
   * the baudrate.
   */
  NutRegisterDevice(&devUart0, 0, 0);

  freopen("uart0", "w", stdout);
  freopen("uart0", "r", stdin);
  _ioctl(_fileno(stdout), UART_SETSPEED, &baud);
  NutSleep(200);
  printf_P(vbanner_P, Version, NutVersionString());

  puts("Initialize LED Panel...");
  NutSleep(2000);

  LEDInit();
  NutSleep(2000);
  LEDClear();
  sprintf(line,"LED Matrix Display - FW %s",Version);
  message(YELLOW,line);





More information about the En-Nut-Discussion mailing list