[En-Nut-Discussion] RS485 on NutOS
Hugo Simon
hugo.simon at gmx.de
Tue Oct 23 20:37:10 CEST 2007
How can I use RS485 halfduplex on NutOS on Ethernut 2.1?
I set the RS485 setting as described in the turtorial and can receive
characters via
fread(&buffer, 1, 1, RS485));
But I cannot send via
fputc(((char *)packet)[i], RS485);
fflush(RS485);
I initialized Uart as follows:
u_long flow_485 = USART_MF_HALFDUPLEX;
/*
* Setup the uart1 device.
*/
NutRegisterDevice(&DEV_UART1, 0, 0);
RS485 = fopen(DEV_UART1_NAME, "r+b");
if (RS485==NULL)
{
puts_P(PSTR("ERROR: cannot initialize RS485 interface"));
return;
}
_ioctl(_fileno(RS485), UART_SETSPEED, &baud);
_ioctl(_fileno(RS485), UART_SETFLOWCONTROL, &flow_485);
If I send a character as shown, Simply nothing happens. Do I have to enable
the transmitter somehow?
I have some routines running on a naked AVR system without NutOS. Can I
implement them on NutOS, directly using the Uarts, Ports and Interrupts I
need or does that interfere with NutOS?
I think this would be a better solution, because my routines detect bus
collisions and other errors.
Any help would be nice
Thank you
Bluescreen
More information about the En-Nut-Discussion
mailing list