AW: Re: [En-Nut-Discussion] Problem with UART init.
basil.thomas at bluewin.ch
basil.thomas at bluewin.ch
Mon Jul 24 22:16:30 CEST 2006
Hello Brett
Thanks for your answer. The Samples ar working fine. This code is
an version of the uart sample. I am trying to do the init without the
FILE registering but directli work with the stdout.
Best regards
Basil
----Ursprüngliche Nachricht----
Von: Brett.Abbott at digital-telemetry.com
Datum: 24.07.2006 22:06
An: <basil.thomas at bluewin.ch>, "Ethernut User Chat (English)"<en-
nut-discussion at egnite.de>
Betreff: Re: [En-Nut-Discussion] Problem with UART init.
Basil
I suggest you start with the "uart" and "rs232d" sample programs as
a
base - Once you get that working, add your own bits step by step -
this
way, when it breaks you know which bit is wrong.
With the uart, I think r+ means read and write, and r+b means read
and
write binary (ie. 8 bit) - Worry about this once you get the demo
code
working.
Good luck.
Brett
basil.thomas at bluewin.ch wrote:
> 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;
> }
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
>
>
--
-----------------------------------------------------------------
Brett Abbott, Managing Director, Digital Telemetry Limited
Email: Brett.Abbott at digital-telemetry.com
PO Box 24 036 Manners Street, Wellington, New Zealand
Phone +64 (4) 5666-860 Mobile +64 (21) 656-144
------------------- Commercial in confidence --------------------
More information about the En-Nut-Discussion
mailing list