[En-Nut-Discussion] Help: UART1 problem

Tan Cheng-Lin chenglin.tan at pacific.net.sg
Sun Nov 30 18:28:44 CET 2003


Hi,

I am using the Ethernut 2 board. I tried to configure UART0 as RS232 and
UART1 as RS485. 
Jumpers are set as instructed in the hardware manual.  

The following code for UART0 is ok but not the UART1.  
The TX1(PD3) pin for UART1 is always high, when it 
should send out the serial string "Test String".  

What are the differences with the ways of registration between
UART0 and UART1 as shown below?  Which is the preferred way? 

Any help or sample code to get UART1 working for RS485 is greatly 
appreciated.

I am NOT using the 103 mode, and also tried adding the
void bugfix function as mentioned by Tom Nystrom in Apr 03 
posting. But it is still not working.

............
NUTDEVICE *uart1;

.....
u_long baud = 115200;
u_long rs485baud = 9600;

/* define UART0 */
NutRegisterDevice(&devDebug0, 0, 0);
freopen("uart0", "w", stdout); 
_ioctl(_fileno(stdout), UART_SETSPEED, &baud);

/* define UART1 */
NutRegisterDevice(&devUart1, 1, 0);
uart1 = NutDeviceOpen("uart1");
NutDeviceIOCtl(uart1, UART_SETSPEED, &rs485baud);

// Testprint
NutPrintString_P(uart1, PSTR("Test String"));
NutPrintFlush(uart1);



Regards,
Marcus





More information about the En-Nut-Discussion mailing list