I have recently bought a CM11G (RS232) and i've got this problem: when
trying (with my own software) to send commands following the protocol,
i only get a 0xA5 (CM11 asking for the time to be resent, as far as i'm
concerned). Well, following the protocol, i send the time, but once it
gets the 0x9b value, it seems to get locked and it doesn't listen nor
send anything else, i have to unplug and plug again. What i am supposed
to send the CM11 in such situation? I have read in many places that
people have the same problem, but don't tell how to fix it properly!
THank you all in advance.
Jose Juan Martinez
Try sending just 0x9B. That will satisfy the CM11A. Of course, the CM11G
might have different firmware.
If it will help I can post some VB code that works.
This is the code i have, in java:
//data available in serial port
if( entrada.available() > 0 )
{
int nBytes = entrada.read( bufferLectura );
for(int i=0;nBytes>i;i++)
System.out.println("Got byte " + i + "="+
(bufferLectura[i]&0xff));
puertoSerie.close();
if(nBytes==1)
{
Resultado=bufferLectura[0];
if((Resultado&0xff)==0xA5)
{
byte tiempo[]=new byte[7];
tiempo[0]=(byte)(0x9b);
tiempo[1]=(byte)(0x13);
tiempo[2]=(byte)(0x40);
tiempo[3]=(byte)(0x0A);
tiempo[4]=(byte)(0x48);
tiempo[5]=(byte)(0x82);
tiempo[6]=(byte)(0x60);
for(int i=0;i<6 ;i++)
WriteByteSerialPort(tiempo[i]);
}
}
}
Dave Houston ha escrito:
I'm sorry but I'm not very literate in Java and my college Spanish has
mostly been forgotten but it looks like you're just sending dummy bytes
which should be OK unless the CM11G finds one of the values upsetting.
Here's a REALbasic code snippet that works with my CM11As.
Dim s As String
Dim chkSum As Integer 'RB integers are 32 bits
Dim i As Integer
s=chr(&H9B)
s=s+chr(d.second)
s=s+chr(d.minute+((d.hour MOD 2)*60))
s=s+chr(d.hour\2)
s=s+chr(d.dayofyear MOD 256)
s=s+chr(((d.dayofyear\256)*&H80)+Pow(2,d.dayofweek-1))
s=s+chr(monitored*&H10)
For i=2 to len(s)
chkSum=chkSum+asc(mid(s,i,1))
Next
chkSum=chkSum MOD 256
serial1.write(s)
'CM11A will return the checksum if all is well
'for less than 7 bytes it will not return a checksum
'but will stop sending the A5 poll
The protocol documentation is at...
http://software.x10.com/pub/manuals/cm11a_protocol.txt
but it seems like you already have it.
Have you tried setting the interface time with ActiveHome? If ActiveHome
locks it up then it's probably a defective unit. If not, try watching what
it sends with serial port sniffer software.
I no longer have a web page so you cannot download it but I have a REALbasic
example application for the CM11A which demonstrates most of its features
(no macros). Unforunately, RB makes monstrous executables (this one is ~3MB)
so it's not practical to email it unless you have an email account that you
know will accept it.
When the CM11A needs the time reset all it sends is 0xA5. I think your code
is failing before you ever get to the point where you send the 7 bytes.
I was testing it in my lab, and the problem was that the CM11 was
connected to the outlet with a router and a switch, and these made
noise on it... even ActiveHome couldn't set the time! So i switched off
all them and left CM11, and ActiveHome worked, and time set is no
longer needed.
Thank you for your help!