|
From: | Simon |
Subject: | m2bus problem |
Date: | Mon, 13 Oct 2003 08:49:13 +1000 |
I am using gnokii under win32 with 5110 connected
via RTM60301 NKI6210 cable. Opening the cable connector reveals four pins
used so presume that is Fbus/mbus capable.
No problems communicating with the 5110 using
fbus. m2bus times out and quits after, is it 10 retrys?, according to
code.
Looking at the m2bus.c code it has the following
************************************************************ static
bool m2bus_serial_open(struct gn_statemachine *state){ /* Open device. */ if (!device_open(state->config.port_device, true, false, false, GN_CT_Serial, state)) { perror(_("Couldn't open M2BUS device")); return false; } device_changespeed(9600, state); /*
* Need to "toggle" the dtr/rts lines in the right sequence it seems * for the interface to work. Base time value is units of 50ms it * seems. */ device_setdtrrts(0, 1, state); return true;
} ************************************************************
The toggling goes no further... but in other phones
(6150) the toggling was described thus..
************************************************************ /* Need to "toggle" the dtr/rts lines
in the right
sequence it seems for the interface to work. Base time value is units of 50ms it seems */ #define BASE_TIME (50000)
/* Default state
*/
device_setdtrrts(0, 1); sleep(1); /* RTS low for 250ms
*/
device_setdtrrts(0, 0); usleep(5 * BASE_TIME); /* RTS high, DTR high for 50ms
*/
device_setdtrrts(1, 1); usleep(BASE_TIME); /* RTS low, DTR high for 50ms
*/
device_setdtrrts(1, 0); usleep(BASE_TIME); /* RTS high, DTR high for 50ms
*/
device_setdtrrts(1, 1); usleep(BASE_TIME); /* RTS low, DTR high for 50ms
*/
device_setdtrrts(1, 0); usleep(BASE_TIME); /* RTS low, DTR low for 50ms
*/
device_setdtrrts(0, 0); usleep(BASE_TIME); /* RTS low, DTR high for 50ms
*/
device_setdtrrts(1, 0); usleep(BASE_TIME); /* RTS high, DTR high for 50ms
*/
device_setdtrrts(1, 1); usleep(BASE_TIME); /* RTS low, DTR low for 50ms
*/
device_setdtrrts(0, 0); usleep(BASE_TIME); /* leave RTS high, DTR low for duration
of session. */
usleep(BASE_TIME); device_setdtrrts(0, 1); sleep(1);
************************************************************
In wait4idle it lowers rts then raises rts leaving
dtr low.
I read somewhere that the dtr must be held
high during the communications or else the bus will revert to Fbus mode.
And that the rts was used to control the bus, ie you listen i talk, i listen you
talk...
Is it enough to simply raise rts and lower dtr as
the m2bus code does? I guess what I need to know is if it works for just
one 5110. Cheers
Simon |
[Prev in Thread] | Current Thread | [Next in Thread] |