Please login or register.

Login with username, password and session length

Author Topic: 1132B always responds with NAK  (Read 12076 times)

stickfigure

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 3
1132B always responds with NAK
« on: September 29, 2010, 08:33:24 PM »

Hi there, I'm having trouble with a brand-new 1132B PowerLinc Serial device.  I am writing some opensource python code to manage it here:

http://code.google.com/p/meatography/source/browse/client/trunk/src/x10/powerlinc.py

The problem is that every time I send the START byte (0x02) I always get back the NAK byte (0x15).  What is it that makes the 1132B respond with ready or unready?  It's plugged into the wall.

BTW I had a different problem when I plugged the 1132B into a USB-to-Serial adapter; every time I wrote START I got back 0x75, which makes no sense.  It may be some oddity of the adapter so I tried running this on a different box with a normal serial port, now I'm getting the continual NAK issue.

Thanks in advance,
Jeff
Logged

Brian H

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 305
  • Posts: 13295
Re: 1132B always responds with NAK
« Reply #1 on: September 30, 2010, 08:36:28 AM »

I looked at your code page.
You may want to look at the 1132Bs programmers manual page three for examples and page four for the hex coded.
Like A is not 06 the far right two columns indicate A=46 hex or F ASCII

I tried using Docklight Evaluation program [one Smartlabs uses for their SDK examples]

I modified the example code on page 3 to send an A4 for my chime module.
Sent 0x02
got back 0x06 0x0D
Then sent 0x63 0x46 0x54 0x45 0x41.
The chime did sound.
The evaluation mode does not allow me to print out the result codes. So I didn't post the reply from the 1132B after the string was sent.

One thing I did see. The 0x02 had to be sent and then the 0x06 0x0D had to be received back. Before the remaining code was sent. If the 0x02 was in the same string as the remaining code. All I got was 0x15 NAKs back.

If you are just testing by sending an 0x02. You should get back the 0x06 0x0D everytime the 0x02 is sent.
Mine did.

You may also want to try a post in the Smarthome Forums Computer Interface Section.
http://www.smarthome.com/forum/forum.asp?FORUM_ID=17
« Last Edit: September 30, 2010, 08:52:19 AM by Brian H »
Logged

stickfigure

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 3
Re: 1132B always responds with NAK
« Reply #2 on: September 30, 2010, 12:27:10 PM »

I looked at your code page.
You may want to look at the 1132Bs programmers manual page three for examples and page four for the hex coded.
Like A is not 06 the far right two columns indicate A=46 hex or F ASCII

Thanks - I was going off the WISH code and didn't notice that they logical-OR'd the bits with 0x40 before sending.  And I misread that part of the 1132B manual.

But unfortunately that's not the problem I'm having because my code isn't even getting that far.  I made a very simple example:

Code: [Select]
def test(tty):
port = serial.Serial(tty, 9600, timeout=10)
port.write(bytes(0x02))

result = port.read()
if len(result) == 0:
raise Exception, "Timeout reading from serial"
else:
return hex(ord(result[0]))

This always returns '0x15' no matter how many times I try it.  I wonder if my device is broken.

I'll try the smarthome forums - thanks.

Jeff
Logged

Brian H

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 305
  • Posts: 13295
Re: 1132B always responds with NAK
« Reply #3 on: September 30, 2010, 04:51:42 PM »

You maybe correct. It maybe defective.
An 0x02 should return an 0x06 0x0D

I saw your post in the Smarthome Forums. Maybe someone there may have added information.
Logged

stickfigure

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 3
Re: 1132B always responds with NAK
« Reply #4 on: September 30, 2010, 09:20:59 PM »

It looks like the problem was somewhere between me and whoever designed the python string/byte array code... I have it working.

Unfortunately it doesn't work when I run the same code through a USB-to-serial adapter.  Still investigating that.

Jeff
Logged

pconroy

  • Hero Member
  • *****
  • Helpful Post Rating: 9
  • Posts: 294
Re: 1132B always responds with NAK
« Reply #5 on: September 30, 2010, 10:31:28 PM »

Jeff,

I have an older Powerlinc Serial and it fills my returns stream with NAKs, but accepts commands and executes them.
If you don't have a serial line sniffer enabled, it helps.

Try just sending it a complete command: eg A1 ON and see if the module pops on.
That's what convinced me to write some code in my read() to just ignore NAKs and keep reading bytes until I got the checksum.
Logged

Brian H

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 305
  • Posts: 13295
Re: 1132B always responds with NAK
« Reply #6 on: October 01, 2010, 06:01:41 AM »

Yes I read you findings in the Smarthome Forums.
Glad you are starting to make progress.
Logged
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.