Is there any way to turn RTS on? like SetDTR() even with Jumpers?
I am using the sb72ex and data port is 1.
The device I am connecting to requires "no" flow control (@ 9600,7e1) but rts and dtr high at all times I am connected. I need to keep production costs at a minimum, so a custom cable is not desired.
I also need to know an simple/easy way in connect() to get a random tcp local port on my socket because when I connect to a server with a local port of 0, it always starts with same 32??? port, but the server is still established from the last socket and it times out the next boot with a -1. I thought about starting with say 9000 and just a retry with 9000++ every 3 seconds if I timeout. Then say reset to 9000 when I get to 9020.
The custom code needs to be robust enough to recover from lost connections without intervention.
Thanks,
Sean
Is there any way to turn RTS on? like SetDTR() & socket q
Re: Is there any way to turn RTS on? like SetDTR() & socket q
look up, I dont remember what doc this is in, i just pulled this from some code that i had with the same situation.
SerialClose( 1 );
fd1 = OpenSerial( 1, 19200, 1, 8, eParityNone );
SerialEnableHwTxFlow(1,1); // look this up, i believe this is what your after
SerialEnableHwRxFlow(1,1); // look this up, i believe this is what your after
SerialClose( 1 );
fd1 = OpenSerial( 1, 19200, 1, 8, eParityNone );
SerialEnableHwTxFlow(1,1); // look this up, i believe this is what your after
SerialEnableHwRxFlow(1,1); // look this up, i believe this is what your after
Re: Is there any way to turn RTS on? like SetDTR() & socket q
Thanks, Ill try it, but from what i see it does not look like that will keep it high all time. mine is no flow control. but dtr and rts high.seulater wrote:look up, I dont remember what doc this is in, i just pulled this from some code that i had with the same situation.
SerialClose( 1 );
fd1 = OpenSerial( 1, 19200, 1, 8, eParityNone );
SerialEnableHwTxFlow(1,1); // look this up, i believe this is what your after
SerialEnableHwRxFlow(1,1); // look this up, i believe this is what your after
Re: Is there any way to turn RTS on? like SetDTR() & socket q
You might be able to put a wire jumper somewhere inside the the box on the circuit board, but that might be a lot of work and you would probably need to contact NetBurner to figure out where to put it. A cable might be easier. How many devices would you need to modify?
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: Is there any way to turn RTS on? like SetDTR() & socket q
With regard to RTS, I don't think you want to enable HW handshake which would vary the RTS level depending on CTS and buffer states. Instead, since you just want DB9_RTS pin always HI, just write it using the gpio or pin constant interface like any gpio pin. I don't have the sb72ex schematic, but if HW handshake is an option on the board, the uP uart RTS pin should be connected to an RS232 level converter to provide appropriate serial levels on the DB9 pins when (and if) HW handshake is enabled. By default (with the non-flowcontrol, non-HW-handshake serial settings) the RTS uP pin is probably configured as a hi-Z input. It seems to me that you should be able to write the pin to the proper level. I believe that the RTS serial buffer is an inverting buffer, so, to make the DB9 RTS pin hi you will need to write the uP pin low. This should not interfere with the functioning of the default (non-flow-control) serial drivers. (I am not familar with the sb72ex, but I believe you should have those pin class / gpio calls available?
On the 5270, the pins are all configured for GPIO by default, so the call would be
Jy[xx] = 0; //where y is the header reference designator, & xx is the RTS pin, pin 26, 32, or 38 depending on the uart.
If you need to configure the pin function, it would be something like:
Jy[xx].function( PINJy_xx_GPIO );
Once again, the sb72-ex probably has something similar....?
With regard to DTR, this pin is ususally not under software control on most of the NB modules although as rnixon suggests, a hardware sol'n might be possible. Once again, I don't have schematics for the sb72ex, but many of the NB dev boards either leave the DB9 serial port pins 1 and 4 (DTR and DCD) completely unconnected, or optionally connected by installing a jumper to allow loopback connections. Worse case, if you get the RTS pin to the correct level, (and depending on your production volumes) you could jumper the RTS pin to the DTR pin allowing the RS232 buffer to drive both pins...
On the 5270, the pins are all configured for GPIO by default, so the call would be
Jy[xx] = 0; //where y is the header reference designator, & xx is the RTS pin, pin 26, 32, or 38 depending on the uart.
If you need to configure the pin function, it would be something like:
Jy[xx].function( PINJy_xx_GPIO );
Once again, the sb72-ex probably has something similar....?
With regard to DTR, this pin is ususally not under software control on most of the NB modules although as rnixon suggests, a hardware sol'n might be possible. Once again, I don't have schematics for the sb72ex, but many of the NB dev boards either leave the DB9 serial port pins 1 and 4 (DTR and DCD) completely unconnected, or optionally connected by installing a jumper to allow loopback connections. Worse case, if you get the RTS pin to the correct level, (and depending on your production volumes) you could jumper the RTS pin to the DTR pin allowing the RS232 buffer to drive both pins...