[En-Nut-Discussion] Ethernut3.1 RS232 DTR pin
Paul Govers
egnite at paulgovers.com
Wed Dec 16 22:05:30 CET 2009
Hello All,
i have already post a question about the RS232 communication, now i have done some more test and i can explain my problem in more detail. first i have to tell that i thought that the rs232 has to operate in hardware handshake, this is not the case!
setup1 (thats working okay):
PC comport connected(9600baud|no flow control|8bits|parity none|stop bit 1)) to my heating system(with rs232 com port) (only with rs232 pins: RX PC->TX heating system,TX PC->RX heating system , ground, and DTR PC-> DSR heatingsystem)
when i open the comport on the pc, the voltage on pin4(DTR) becomes 14volt, and my heating system is sending data to my computer
setup2:
Ethernut3.1 board comport connected to my heating system(with rs232 com port) (only with rs232 pins: RX Ethernut->TX heating system,TX Ethernut->RX heating system , ground, and DTR PC-> DSR heatingsystem)
when i open the comport (see code below) on the ethernut3.1 board, the voltage on pin4(DTR) is still 0volt (no changes), and receiving no data from the heating system.
it seems that the DTR line becomes not active on the ethernut board, when iam starting reading...
typedef struct {
FILE *cd_rs232;
FILE *cd_tcpip;
char cd_connected;
} CHANNEL;
CHANNEL cd;
u_long baud = 9600;
/*
* Register our devices.
*/
outb(NPL_RSCR, (inb(NPL_RSCR) & ~NPL_RSUS1E) | NPL_RSUS0E);
outb(NPL_RSCR, inb(NPL_RSCR) | NPL_RSDTR);
NutRegisterDevice(&DEV_UART, 0, 0);
/*
* Setup the uart device.
*/
cd.cd_rs232 = fopen(DEV_UART_NAME, "r+b");
_ioctl(_fileno(cd.cd_rs232), UART_SETSPEED, &baud);
//u_long flowcontrol = UART_HS_HALFDUPLEX;
//UART_HS_HALFDUPLEX | UART_HS_SOFT | UART_HS_MODEM | UART_HS_RTSCTS
//_ioctl(_fileno(cd.cd_rs232), UART_SETFLOWCONTROL, &flowcontrol);
_ioctl(_fileno(cd.cd_rs232), UART_SETSTATUS, UART_DTRENABLED);
for (;;) {
fgets(inbuf, sizeof(inbuf), cd.cd_rs232);
}
any one any idea what i do wrong
greetings
Paul Govers
More information about the En-Nut-Discussion
mailing list