To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 473
472  |  474
Subject: 
Bluetooth Comm Problem
Newsgroups: 
lugnet.robotics.nxt
Date: 
Tue, 13 Feb 2007 03:19:53 GMT
Viewed: 
13708 times
  
I have been trying to communicate via BT  from a Perl script on my PC
to/from the NXT. I am not using Fantom. I have no problem receiving data
from the NXT, but the NXT does not appear to be receiving the messages I
send.

I am capturing the serial data using a port monitor. Here is what I am doing
and the resulting bytes being sent/received.

On the NXT:
Call RemoteMessageWrite in NBC to write HI\r on connection 1, queue 0
Bytes received on PC: 08 00 80 09 00 04 48 49 0D 00
08 00 - length of 8 bytes
80 09 - direct command MessageWrite, no response required
00 - Inbox (queue) 0
04 - four bytes of message
48 49 - "HI"
0D - carriage return
00 - Null to end string

On the NXT:
Call ReceiveMessage NBC command on queue 0
Bytes received on PC: 05 00 00 13 0A 00 01
05 00 - length of 5 bytes
00 13 - direct command MessageRead, require response
0A - remote queue 10 (where a NXT slave is supposed to write messages bound
for queue 0 on the master)
00 - local queue 0
01 - clear message from remote queue

On the PC:
When the ReceiveMessage command is received, sends the following:
40 00 02 13 00 00 03 4F 4B 00 ... 00
40 00 - 64 bytes (fixed size - always 64 bytes)
02 13 - MessageRead response
00 - status byte - SUCCESS
00 - local queue 0 (tried 0A as well)
03 - Size of message including single null byte
4F 4B 00 - "OK", null-terminated
.. 00 - enough nulls to make 64 bytes not counting length bytes

On the NXT, I get back a result code of 64 which means the queue is empty.

Any ideas on what I'm doing wrong?

David



Message has 1 Reply:
  RE: Bluetooth Comm Problem
 
(...) A visual review looks like everything is appropriate. The only thing I can think of is whether, on the NXT, you are calling "ReadMessage" more than once. You should have a loop that runs for at least 50 (or better yet 150) milliseconds. (...) (18 years ago, 13-Feb-07, to lugnet.robotics.nxt)

8 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR