[En-Nut-Discussion] Problem with UART init.

basil.thomas at bluewin.ch basil.thomas at bluewin.ch
Mon Jul 24 21:59:30 CEST 2006


Hello to all members

Im trying to init. the RS232 port 0 on my xnut-105 so that i can us 
the standart  C comands. But some how it wont print anithing out. It 
can`t be something big, but i am not realy understanding how this 
works with the device register function. Wath mens the "w" or the 
"r+"?  I found something in the API description but did not got it.

this is the code: 

#include <string.h>
#include <stdio.h>
#include <io.h>
#include <stdlib.h>
#include <dev/board.h>
#include <fcntl.h>
#include <sys/heap.h>
#include <sys/thread.h>
#include <sys/timer.h>
#include <sys/socket.h>
//#include <dev/debug.h>
#include <dev/nicrtl.h>
#include <dev/uartavr.h>
#include <arpa/inet.h>
#include <pro/dhcp.h>
#include <net/errno.h>
#include <dev/atcan.h>



/***************************************************************************
 * Devine
 
***************************************************************************/

//RS232
//	static char inbuf[128];


/***************************************************************************
 * Main
 
***************************************************************************/

int main(void)
{
//INIT RS232
   	u_long baud = 38400;
	NutRegisterDevice(&DEV_UART0, 0, 0);
	freopen(DEV_UART_NAME, "w", stdout);
	_ioctl(_fileno(stdout), UART_SETSPEED, &baud);

	printf("Starting up...\n");

	return 1;
}



More information about the En-Nut-Discussion mailing list