PLCBUS 1141 ACK bug

Forum about PLCBUS devices & software.

Moderator: Digit

Post Reply
dubuscyr
Starting Member
Starting Member
Posts: 5
Joined: Thu Sep 24, 2009 11:45 am
Location: France

PLCBUS 1141 ACK bug

Post by dubuscyr »

Hi everyone,

I'm new in the PLCBUS world, and I'm trying to adding PLCBUS support in a software I wrote myself in C++ earlier, but I have a problem with the ACK.

Let me describe the bug, and how to reproduce it.

When I send a message to a non existant PLCBUS module, I expect to receive a message from the 1141 and not an ACK. It works, but, after that, the 1141 seems respond wrong message to almost any command. Indeed, a lot of messages from the 1141 start with the LENGHT bit (06) instead of STX (02). Is that a bug, or my 1141 is defective ?

I'll give you an example, I have a module adressed in A1, with user code 00 and nothing else (no A2)

First step, I turn A1 ON with ACK :

Code: Select all

Message sent : 02 05 00 00 22 00 00 03 <12.5ms> 02 05 00 00 22 00 00 03 
Sleep 1 sec 
Bytes read : 18 
Message received : 02 06 00 00 22 64 00 1e 03 02 06 00 00 22 64 00 20 03 
It works (expect that I have a 64 in my data1 response and I really wonder why)

Second step, I turn A2 ON with ACK

Code: Select all

Message sent : 02 05 00 01 22 00 00 03 <12.5ms> 02 05 00 01 22 00 00 03 
Sleep 1 sec 
Bytes read : 9 
Message received : 02 06 00 01 22 64 00 1e 03
It works, I did not received ACK because there is no A2 ! (always 64 in data1 response ... still wonder why)

Third step, I turn A1 OFF with ACK :

Code: Select all

Message sent : 	02 05 00 00 23 00 00 03 <12.5ms> 02 05 00 00 23 00 00 03 
Sleep 1 sec 
Bytes read : 17 
Message received : 06 00 00 23 00 00 1e 03 02 06 00 00 23 00 00 20 03 
Bug ... The 1141 did not send the 02 first ! It starts with Length bit (06) and send only 17 bytes !

The bug happens when I did not receive an ACK. Immediately after, the 1141 start sending incorrect messages ... totally randomly. Sometimes messages are good, sometimes messages are wrong. The only one way I have to stop this bug is to unplug the 1141 and re-plug it.

Can anyone tell me where I'm wrong ? Or is this a real bug ? Or my hardware is defective ?

Thank you very much, I'm totally lost !

Cyril
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

PLCBUS 1141 ACK bug

Post by Digit »

Strange... both the behavior you describe and also that i've never noticed this.
It's quite hard for me to send commands to the PLC1141 for non-existing modules, but removing a plugin module from the powerline would result in the same situation. So the chance this has never happened at my place is rather small. But not receiving STX (02) should have triggered enough alarm bells to be noticed... strange.

I'll try to reproduce this here at my place.

<hr noshade size="1"><font size="1">Robert
http://www.hekkers.net <i>Digit's Online Home.</i></font id="size1">
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

PLCBUS 1141 ACK bug

Post by Digit »

BTW, that $64 = 100 decimal and means the module is on. It is meant for dimmer value IIRC but for switches you can get 00 or 64 in data1 as response.
Why data1 is also $64 in response to non existing device i don't know... 00 would seem more logical.

<hr noshade size="1"><font size="1">Robert
http://www.hekkers.net <i>Digit's Online Home.</i></font id="size1">
dubuscyr
Starting Member
Starting Member
Posts: 5
Joined: Thu Sep 24, 2009 11:45 am
Location: France

PLCBUS 1141 ACK bug

Post by dubuscyr »

Hi,

I figure it out !

It came from the prolific driver installed on Mac OS X 10.6. It cost to me hours of sniffing my serial port to find it !

I tested on PC, it works like a charm...

Cyril
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

PLCBUS 1141 ACK bug

Post by Digit »

Ok, thanks for sharing that. Saves me some time :-)

<hr noshade size="1"><font size="1">Robert
http://www.hekkers.net <i>Digit's Online Home.</i></font id="size1">
User avatar
Willem4ever
Global Moderator
Global Moderator
Posts: 805
Joined: Mon Oct 30, 2006 3:48 pm
Location: Uithoorn / Netherlands

PLCBUS 1141 ACK bug

Post by Willem4ever »

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by dubuscyr</i>
<br />
It came from the prolific driver installed on Mac OS X 10.6. It cost to me hours of sniffing my serial port to find it !
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

How did you configure your serial port, there is quiet a few options !
GilbertBen
Starting Member
Starting Member
Posts: 1
Joined: Tue Oct 20, 2009 11:39 am
Location: France

PLCBUS 1141 ACK bug

Post by GilbertBen »

Hi !
Did you solve your problem with the USB-RS232 adapter ?
I'm also interested in PLCBus on macos x and I'd like to develop my own application for this. But I just need to check if it's feasable before buying the hardware.

Best regards
dubuscyr
Starting Member
Starting Member
Posts: 5
Joined: Thu Sep 24, 2009 11:45 am
Location: France

Re: PLCBUS 1141 ACK bug

Post by dubuscyr »

Hi everyone,

So, after months of using PLCBUS, I'm still very disapointed.

I think it could come from the termios options, I'll share mine with you and tell me what you think.

Code: Select all


		struct termios toptions;
		int fd = open('/dev/plcbus', O_RDWR | O_NOCTTY | O_NONBLOCK);
		if (fd == -1) {printf("Error port connection");}
		fcntl(fd, F_SETFL, 0);
		tcgetattr(fd, &toptions);

		toptions.c_cflag &= ~PARENB;
		toptions.c_cflag &= ~CSTOPB;
		toptions.c_cflag &= ~CSIZE;
		toptions.c_cflag = B9600 | CS8 | CREAD | CLOCAL;
		toptions.c_cflag &= ~CRTSCTS;
		toptions.c_iflag &= ~(IXON | IXOFF | IXANY);
		toptions.c_lflag = ~ICANON;// | ECHO | ECHOE | ISIG);
		toptions.c_iflag = ICRNL;
		toptions.c_oflag &= ~OPOST;
		toptions.c_cc[VMIN]  = 1;
		toptions.c_cc[VTIME] = 20;
		tcsetattr(fd, TCSANOW, &toptions);


Is there something wrong, something I'm missing ? Because I'm really not a specialist and this is a piece of code I stole from another software.

Thank you

Cyril
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: PLCBUS 1141 ACK bug

Post by Digit »

Well i'm sorry, can't help you with that very much...
My Serial PLC1141 is connected to a Serial to Ethernet device so no serial port settings done from my app.
Tomorrow i have to do a complete shutdown of my Domotica system due to rearranging my LAN, so then I'll have the chance to have a look at the serial settings on the device to which the PLC1141 is connected.
In the meantime, maybe you could tell more about what is the reason for your disappointment. Bad communication with the interface like still wrong packets being received, or what?
dubuscyr
Starting Member
Starting Member
Posts: 5
Joined: Thu Sep 24, 2009 11:45 am
Location: France

Re: PLCBUS 1141 ACK bug

Post by dubuscyr »

Hi digit,

Thank you for your quick answer.

I'm disappointed because I have already bought 2 PLCBUS 1141 and for the both of them, I do not have a good reliability. Overall on the response from the modules.
Sometimes I don't receive ACK for hours, and tadamm it's working again. Sometimes they simply don't answer to any request or it works fine for hours.

But ... they work allmost all the time. Modules are working fine, this is just responses ... so ... random.

I'm using the modules in a very special case. I have 9 2268H (2 addresses by module) and I'm sending and order each minute. So I'm expecting 18 responses in less than a minute.

I have 2 ideas.

1) The way I connect to the USB-Serial thing is bad and I'm using wrong options. Given that the 1141 is pretty buggy (trust me, it is) the behaviour is erratic (sometimes esoteric ;) )

2) The PLCBUS is not designed for my need. It's working fine to turn on / off a light but not to be used in a more industrial way.

If you have any ideas, let's share !

By the way, very nice website, honestly, you should have spent months to equip your house like that !

Cyril
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: PLCBUS 1141 ACK bug

Post by Digit »

Hi Cyril,
Thanks for the compliments :)
I've taken a look at the serial settings i use: 9600, 8, N, 1, no flow control.

Regarding your problems: Those modules you use are using are the heavy duty type and you mention you are using them in an industrial way. To me that sounds like switching heavy machinery with the modules? Maybe the environment is to noisy? Because PLCBUS has problems with noise just as X10 does, although i do believe it's less sensitive to it then X10. I have 17 modules, all work without any problem.

Have you seen this: http://www.plcbus.com.cn/Html/edu/1450.html
I don't have it, never worked with it, i don't know the price, but it looks like the kind of device you could use to analyze your powerline?
dubuscyr
Starting Member
Starting Member
Posts: 5
Joined: Thu Sep 24, 2009 11:45 am
Location: France

Re: PLCBUS 1141 ACK bug

Post by dubuscyr »

Hi digit,

The PLCBUS modules are connected to contactors, and they are directly linked to the 1141 (in the same electrical board), so I don't think I have a noise problem, but I can't tell I don't.

Thank you for the details, but do you know the meanings of theses parameters ?

9600 => bauds, ok I get it ;)
8 => 8 bits ?
N => no parity ?
1 => 1 stop bit ?
no flow control => ok

Thank's

Cyril
User avatar
Rene
Global Moderator
Global Moderator
Posts: 1689
Joined: Wed Oct 08, 2008 3:54 pm
Location: Netherlands

Re: PLCBUS 1141 ACK bug

Post by Rene »

Your right with your meaning of the parameters, this is the standard notation form for these kind of parameters.
Rene.
Post Reply

Return to “PLCBUS Forum”