[En-Nut-Discussion] Multiple UART support

Ulrich Prinz uprinz2 at netscape.net
Tue Sep 21 23:20:42 CEST 2010


Don't bother,

that happens if you have digged into something to deep.

Good luck with the rest of the project and feel free to ask anytime you 
need help.

Regards
Ulrich

Am 21.09.2010 22:46, schrieb zonedar:
>
> Okay figured it out.  That load popping sound was my head coming out of my
> butt.
>
> HW eng, in anticipation of wiring this up to another UART pinned it out as a
> null modem (reversed the TX and RX).  That and our level shifter that we use
> for converting to rs232 levels needs a voltage reference.
>
> Again thanks for the help.
>
> RTFS (Schematics)
>
>
>
> zonedar wrote:
>>
>> Thanks for the tips Ulrich.
>>
>> I tried what you said and it wasn't giving me any happiness.
>>
>> I decide to take a step back and comment out the DEV_DEBUG code and assign
>> UART0 to stdout.  I'm still not getting anything out of the that UART.  So
>> either I have something configured wrong in NUTOS or something's wired
>> wrong.
>>
>> Here's what I did:
>>
>> //   nr = NutRegisterDevice(&DEV_DEBUG, 0, 0);
>>   //   freopen(DEV_DEBUG_NAME, "w", stdout);
>>   //   _ioctl(_fileno(stdout), UART_SETSPEED,&baud);
>>
>>      nr = NutRegisterDevice(&DEV_UART0, 0, 0);
>>      freopen(DEV_UART0_NAME, "w", stdout);
>>      _ioctl(_fileno(stdout), UART_SETSPEED,&baud);
>>
>>     printf("here2\n");
>>
>> Still looking at it...
>>
>>
>> uprinz wrote:
>>>
>>> Hi Steve,
>>>
>>> for me it is exactly sa easy as this:
>>>   >       nr = NutRegisterDevice(&DEV_DEBUG, 0, 0);
>>>   >       freopen(DEV_DEBUG_NAME, "w", stdout);
>>>   >       _ioctl(_fileno(stdout), UART_SETSPEED,&baud);
>>>
>>> for another uart just repeat that
>>>
>>> /* don't forget this one:*/
>>> FILE *uart0;
>>> FILE *uart1;
>>>
>>> rc = NutRegisterDevice(&DEV_USART0, 0, 0);
>>> if( rc)
>>>     something failed;
>>> freopen(DEV_UART0.dev_name, "w", uart0);
>>> _ioctl(_fileno(uart0), UART_SETSPEED,&baud);
>>>
>>> rc = NutRegisterDevice(&DEV_USART1, 0, 0);
>>> if( rc)
>>>     something failed;
>>> freopen(DEV_UART1.dev_name, "w", uart1);
>>> _ioctl(_fileno(uart1), UART_SETSPEED,&baud);
>>>
>>> In my stm32 port I use 3 or more UARTs in this way.
>>> I haven't checked, if console is a reserved word by the libc or Nut/OS.
>>>
>>> But you can put it another way:
>>> Assign the debug to stderr and on of the other UARTs to stdout ( and
>>> stdin, if you use "r+" instead of "w"). You can reassign to by just do:
>>> stdout = stdin = uart0;
>>>
>>> Now printf() goes to uart0 while stderr still goes to dbgu and 12 points
>>> go to... ups :)
>>>
>>> Ah, have a look into the uart example code. It just works fine.
>>>
>>> Regards
>>> Ulrich
>>>
>>> Am 21.09.2010 18:15, schrieb zonedar:
>>>>
>>>> Hi,
>>>>
>>>>     We're using a AT91SAM7X256-EK in a product.  Currently we have the
>>>> DEV_DEBUG working and assigned to stdio.  Getting lots of useful debug
>>>> messages out to a terminal.
>>>>
>>>>     We'd like to enable a second UART (UART0) to allow us to communicate
>>>> to an
>>>> internal peripheral.  In the processes of bringing it up I was just
>>>> going to
>>>> try and set it up similar and have it also send stuff to a terminal.  It
>>>> doesn't seem to be that easy.
>>>>
>>> _______________________________________________
>>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>>>
>>>
>>
>>
>



More information about the En-Nut-Discussion mailing list