My question is about a problem communicating a rabbit 3720 zigbee
application kit with a Wimax router.
I have a static public IP address assigned to the router, I use this
one to access the rabbit web server and open a tcp socket to port 23
from a PC (but I'm not using telnet, just a tcp socket).
The problem is: after several hours running ok, I stop to receive
bytes through the port 23, I make a ping to the static IP address of
my router but I receive a time out message. So my rabbit has lost
communication with the router.
I tried to shut down and restart the hold system but it keeps without=20
response.
The only way I found to fix the problem temporaly, is to connect a PC
to the wimax router using the RJ45 cable, the PC detects the
connection to the Internet and after that, I connect again the router
to the rabbit board and it is accessible again from the internet.
Please, could you give me your concept about the possible root of the
problem and where I cand find documentation concerning this behaviour.
Following you will find the source code of my application, based on
the DCRABBIT_9.21\Samples\tcpip\rabbitweb\ethernet_to_serial.c
Thank you.
#class auto
#define TCPCONFIG 1
const char ports_config =3D { 'D' };
#define E2S_BUFFER_SIZE 1024
/*
* Only one server is really needed for the HTTP server as long as
* tcp_reserveport() is called on port 80.
*/
#define HTTP_MAXSERVERS 1
/*
* Define the number of TCP socket buffers to the number of sockets=20
needed for
* the HTTP server (HTTP_MAXSERVERS) + the number of serial ports=20
configured
* (sizeof(ports_config)).
*/
#define MAX_TCP_SOCKET_BUFFERS (HTTP_MAXSERVERS + sizeof
(ports_config))
#define NO_MODBUS 0
#define SI_MODBUS 1
#define MODO_COM NO_MODBUS
#define WRITE 2
#define READ 3
#define CLEAR 0
#define SET 1
#define OK 1
#define NOK 0
#define TRUE 1
#define FALSE 0
#define SIZE_BUFFER_TX 50
#define SIZE_BUFFER_RX 50
#define SIZE_CONF_ARRAY 3
#define SIZE_STATUS_ARRAY 6
#define SIZE_HIST_ARRAY 100
#define SIZE_INPUT_REG 2
#define NUM_NODOS 5
#define cof_serXwrite cof_serDwrite
#define R_CONFIG 8
#define W_CONFIG 7
#define U_CONFIG 6
#define W_SINC 5
#define R_DATA 4
#define STAND_BY 3
#define NO_SINC 2
#define SINC 1
#define NO_ERROR 0
#define CRC_ERROR 1
#define ADD_ERROR 2
#define NO_RESP_ERROR 3
#define ON_OFF 2
#define ON 1
#define OFF 0
#define ASCII 1
#define HEX 0
#define T_OUT1_5 5
#define T_OUT_INI 100
#define DINBUFSIZE 63
#define DOUTBUFSIZE 63
#define CONV_IPANEL 0.03222//I panel
#define CONV_IBAT 0.03222//I Bater=EDa
#define CONV_TEMP 1//Temp
#define CONV_VPANEL 8.8623//V. Panel
#define CONV_VBAT 1.611//V. Bater=EDa
#memmap xmem
/*
* This is needed to be able to use the RabbitWeb HTTP enhancements=20
and the
* ZHTML scripting language.
*/
#define USE_RABBITWEB 1
#use "dcrtcp.lib"
#use "http.lib"
#ximport "TesterPUJ_v2/Pages/Tester_monitor_v4.zhtml" monitor_zhtml
#ximport "TesterPUJ_v2/Pages/Tester_admin_v5.zhtml" admin_zhtml
SSPEC_MIMETABLE_START
SSPEC_MIME_FUNC(".zhtml", "text/html", zhtml_handler),
SSPEC_MIME(".html", "text/html")
SSPEC_MIMETABLE_END
SSPEC_RESOURCETABLE_START
SSPEC_RESOURCE_XMEMFILE("/index.zhtml", monitor_zhtml),
SSPEC_RESOURCE_XMEMFILE("/admin/index.zhtml", admin_zhtml)
SSPEC_RESOURCETABLE_END
//Prototipos de las funciones
void RequestConfigNodos(void);
int ProcesarTramaModbus(int);
int ResponseAck(void);
void CrearTrama(int, int);
void ReceiveAck(void);
void ReceiveTable(void);
void e2s_init(void);
void e2s_tick(void);
unsigned int CalcCRCModbus(char *,int);
void IncIndex(int *, int);
void ProcesarInformacion(int);
int FillE2sBuffer(void);
CoData master_modbus, constru_tramas;
#web_groups admin
int j, A, B;
#web j
#web A
#web B
int val0;
#web val0 groups=3Dall(ro)
//valor en primera posicion
int execute;
#web execute
//valor en primera posicion
int request_admin;
#web request_admin select("Solicitar Configuraci=F3n" =3D R_CONFIG, "Ver=20
Configuraci=F3n recibida" =3D U_CONFIG, "Modificar Configuraci=F3n" =3D=20
W_CONFIG, "Iniciar Monitoreo" =3D R_DATA,"Detener Monitoreo" =3D STAND_BY)
#web_update request_admin RequestConfigNodos
int address;
#web address select
("0"=3D0,"1","2","3","4","5","6","7","8","9","10","11","12","13","14","1
5","16","17","18","19","20","21","22","23","24","25","26","27","28","2
9","30","31")
//((0 <=3D $address) && ($address <=3D 31)) groups=3Dall(ro),admin
//posicion para configuracion
int value;
#web value ((0 <=3D $value) && ($value <=3D 32000)) groups=3Dall(ro),admin
/*Esta funcion se ejecuta cuando hay un cambio en las variables
value, address o read luego de un submit valido*/
// int tabla[32];
// #web tabla
//variables utilizadas en administrador
/*
struct nodos{int node[10];}par[5];
#web par[@].node[@] ((0 <=3D $par[@].node[@]) && ($par[@].node[@] <=3D=20
123))//declara matriz como estructura
int nodepar[5][10];
#web nodepar[@][@] ((0 <=3D $nodepar[@][@]) && ($nodepar[@][@] <=3D=20
123))//declara matriz como array
*/
unsigned int historic_nodo[SIZE_HIST_ARRAY][NUM_NODOS];
#web historic_nodo[@][@]
int nombre_par_config;
#web nombre_par_config select("INTERROGAR (SI=3D1)" =3D 0, "CONTROL DE=20
APAGADO POR PANEL (ON=3D1)", "PAR. 3")
int nombre_status_var;
#web nombre_status_var select("I. PANEL (mA)" =3D 0, "I. BATER=CDA=20
(mA)","TEMP. (C)" , "V. PANEL (V)", "V. BATER=CDA (V)")
int nombre_nodo;
#web nombre_nodo select(" A", " B"," C", " D", " E")
//las sig declaraciones presentan la matriz como arreglos=20
independientes de n nodos
int par_1_config[NUM_NODOS];
int par_2_config[NUM_NODOS];
int par_3_config[NUM_NODOS];
int fpar_1_config[NUM_NODOS];
#web fpar_1_config[@]// ((0 <=3D $par_1_config[@]) && ($par_1_config[@]=20
< 10))
int fpar_2_config[NUM_NODOS];
#web fpar_2_config[@]// ((10 <=3D $par_2_config[@]) && ($par_2_config
[@] < 20))
int fpar_3_config[NUM_NODOS];
#web fpar_3_config[@]// ((0 <=3D $par_3_config[@]) && ($par_3_config[@]=20
<=3D 1))
float fstatus_var_1[NUM_NODOS];
#web fstatus_var_1
float fstatus_var_2[NUM_NODOS];
#web fstatus_var_2
float fstatus_var_3[NUM_NODOS];
#web fstatus_var_3
float fstatus_var_4[NUM_NODOS];
#web fstatus_var_4
float fstatus_var_5[NUM_NODOS];
#web fstatus_var_5
float fstatus_var_6[NUM_NODOS];
#web fstatus_var_6
int fstatus_var_7[NUM_NODOS];
#web fstatus_var_7
int periodo_inter;
#web periodo_inter
int modo_tx_eth;
#web modo_tx_eth
int waiting_ack;
int waiting_table;
char flresp_ack;
char request_status;
//char flcrc_modbus;
unsigned char buffer_tx[SIZE_BUFFER_TX];
unsigned char buffer_rx[SIZE_BUFFER_RX];
unsigned int config_nodo[SIZE_STATUS_ARRAY][NUM_NODOS];
char cant_sen_nodo[6];
int nb_to_tx;
int nb_to_rx;
int tout1_5;
int t_outini;
int n_nodo;
int estatus_nodo[NUM_NODOS];
int last_empty_add_config[NUM_NODOS];
int last_empty_add_hist[NUM_NODOS];
int pnext_tx_mes;
unsigned char flnvo_request_admin;
int nvo_request_admin;
int cont_medidas_rx;
int cont_medidas_enviadas;
int fin_tx_eth, fin_int, int_comp;
//#GLOBAL_INIT {request_status=3DSTAND_BY;}
// The following symbols represent different states in the Ethernet-
to-serial
// state machine
enum {
E2S_INIT,
E2S_LISTEN,
E2S_PROCESS
};
/*
* This structure contains the configuration information for each=20
serial port /
* TCP port pair.
*/
struct SerialPort {
word tcp_port;
struct {
char port;
long baud;
int databits;
int parity;
int stopbits;
} ser;
};
/*
* This stores the configuration information on the serial ports.=20=20
The members
* will be registered with the #web statement so that the HTTP=20
enhancements can
* be used.
*/
struct SerialPort serial_ports;
// This is the core of the Ethernet-to-serial state machine.
struct {
int state; // Current state of the the state machine
tcp_Socket sock; // Socket associated with this serial port
// The following members are function pointers for accessing this=20
serial
// port
int (*open)();
int (*close)();
int (*read)();
int (*write)();
int (*setdatabits)();
int (*setparity)();
} e2s_state;
// A temporary buffer for copying data between the serial ports and=20
TCP ports.
char e2s_buffer[E2S_BUFFER_SIZE];
#define CRC_VERSION "1.15"
#define FALSE 0
#define TRUE 1
unsigned short update_crc_16( unsigned short crc, char=20
c );
/*****************************************************************
**\
=20=20=20=20
* *
* Library :=20
lib_crc *
* File :=20
lib_crc.c *
* Author : Lammert Bies 1999-
2007 *
* E-mail :=20
i...@lammertbies.nl *
* Language : ANSI=20
C *
=20=20=20=20
* *
=20=20=20=20
* *
*=20=20=20
Description *
*=20=20=20

(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )
davidmagin wrote:
> My question is about a problem communicating a rabbit 3720 zigbee
> application kit with a Wimax router.
> I have a static public IP address assigned to the router, I use this
> one to access the rabbit web server and open a tcp socket to port 23
> from a PC (but I'm not using telnet, just a tcp socket).
> The problem is: after several hours running ok, I stop to receive
> bytes through the port 23, I make a ping to the static IP address of
> my router but I receive a time out message. So my rabbit has lost
> communication with the router.
> I tried to shut down and restart the hold system but it keeps without
> response.
> The only way I found to fix the problem temporaly, is to connect a PC
> to the wimax router using the RJ45 cable, the PC detects the
> connection to the Internet and after that, I connect again the router
> to the rabbit board and it is accessible again from the internet.
>
> Please, could you give me your concept about the possible root of the
> problem and where I cand find documentation concerning this behaviour.
> Following you will find the source code of my application, based on
> the DCRABBIT_9.21\Samples\tcpip\rabbitweb\ethernet_to_serial.c
>
> Thank you.
>
Sounds like the router is set to connect on demand. After a timeout with
no date it brings down the WAN interface.
Check the router WAN setup page for "connect timeout", often setting it
to 0 will disable the feature.
--
------------------------------------------
| Scott G. Henion| s...@shdesigns.org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesigns.org |
------------------------------------------
Rabbit libs: http://www.shdesigns.org/rabbit/
today's fortune
Lois Griffin: Excuse me?
Gloria Ironbox: I can't imagine how screwed up your kids must be.
Lois Griffin: You... bitch!
------------------------------------

(You need to be a member of rabbit-semi -- send a blank email to rabbit-semi-subscribe@yahoogroups.com )