[En-Nut-Discussion] SAM7S128 UART0 / UART1 problem

Tamas Szabo sza2king at freemail.hu
Fri Jul 2 23:03:58 CEST 2010


Hi,

I've a small app based on uart example, which works great on debug 
serial port. However I unable to do it on uart0 or uart1.

I thought that I just change DEV_DEBUG to DEV_UART0 - but seems to be 
not that easy.

What should I do to make it work?

Thanks,

/sza2



My example:

#include <dev/board.h>
#include <stdio.h>
#include <io.h>

int main(void)
{
     unsigned long baud = 115200;
     NutRegisterDevice(&DEV_DEBUG, 0, 0);
//    NutRegisterDevice(&DEV_UART0, 0, 0); <- NOT WORKS

     freopen(DEV_DEBUG_NAME, "w", stdout);
     freopen(DEV_DEBUG_NAME, "r", stdin);
     _ioctl(_fileno(stdout), UART_SETSPEED, &baud);

     for (;;) {
         printf("Hello World!\n");
         NutSleep(500);
     }
     return 0;
}



More information about the En-Nut-Discussion mailing list