[En-Nut-Discussion] Ethernut3.1 RS232 DTR pin

Paul Govers egnite at paulgovers.com
Thu Dec 17 09:56:01 CET 2009


Hello Thiago,

The ethernut board (http://www.ethernut.de/en/hardware/enut3/index.html) iam 
using has a fully wired RS232 connector. i checked the schematics and the 
DTR pin is connected. i have also tried to connect DTR to the DSR on the 
RS232 side of my heating system but this does not help. i think that the 
heating system has not implement the DSR pin/functionality :-(

your other suggestion to set the DTR pin, with code that would looks 
like(where UART_DTR can be a other name)
unsigned long on = 1;
_ioctl(_fileno(cd.cd_rs232), UART_DTR, &on);
is maby the solution, i will try this piece of code

Greetings
Paul

----- Original Message ----- 
From: "Thiago A. Corrêa" <thiago.correa at gmail.com>
To: "Ethernut User Chat (English)" <en-nut-discussion at egnite.de>
Sent: Wednesday, December 16, 2009 11:14 PM
Subject: Re: [En-Nut-Discussion] Ethernut3.1 RS232 DTR pin


Hi Paul,

   I haven't used the ethernut 3.1 board yet, but as far as I know,
most ethernut boards don't have anything connected to the DTR pin. I
have implemented on the AVR (atmega) USART driver a way to control the
DTR pin (if available at the board) using ioctrl. The driver doesn't
actually control it as RS232 would demand, but allows the app to
toggle it on without having to know which pin it is actually (that
information is encapsulated in the .conf from the board). In my
projects I usually tie the DTR to a network connection, so if the TCP
connection is lost, I signal it to the device using the DTR.

   You could check the ethernut 3.1 schematics to see if there is
anything connected to the DTR. If there is nothing there, one easy way
to overcome your problem would be to jump the DTR from the DSR on the
same connector making a loopback and fooling your device to
comunicate.

   Hope this helps.


Kind Regards,
    Thiago A. Correa

On Wed, Dec 16, 2009 at 7:05 PM, Paul Govers <egnite at paulgovers.com> wrote:
> 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
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion 




More information about the En-Nut-Discussion mailing list