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 / 138
137  |  139
Subject: 
Details of the Bluetooth messaging protocol?
Newsgroups: 
lugnet.robotics.nxt
Date: 
Wed, 13 Sep 2006 05:02:54 GMT
Viewed: 
10404 times
  
Can someone clarify the details of the Bluetooth messaging protocol? The
documentation is quite confusing. (There is documentation for this in the
Executable File Specificationn and in the Bluetooth develop kit document, as
well as some in the NXT-G help).

In the executable file specification there are 4 system calls related to BT. One
just checks whether BT is ready. Another, NXTCommBTWrite, seens to send a raw
message to one of the ports (0-4), given a prior pairing. 0 is for responses
from a slave to the master, 1-3 to send a message to one of the slaves. The only
arguments to the system call are the port number and the byte array containing
the message. Two other system calls, NXTMessageRead and NXTMessageWrite, manage
the message queues. These two don't take a port number as argument, only a
mailbox argument. Therefore, there must be some binding mechnism to connect a
mailbox to a port. Or perhaps there isn't, but then it would imply that when the
master issues a NXTMessageRead, it would poll (using command 0x13 in the
protocol) all the connected slaves in an attempt to fill the named mailbox. Is
that the case? Or is there some particular use of NXTCommBTWrite that performs
this binding.

In the NXT-G blocks, when you send a message you specify the destination port
and mailbox. This would correspond to a message carrying command 0x09, sent
using NXTCommBTWrite (since NXTMessageWrite does not have a port number
argument). This blocked worked fine for me: I was able to send messages from the
NXT and receive them at the BT serial port on my PC. But the receive block in
NXT-G does not have a port number argument, only a mailbox number. So it must
correspond to NXTMessageRead. When I used this block in a brick that was serving
as a master, I was able to see the polling messages (command 0x013), but no
matter how I tried to respond, the block did not receive the message.

My confusion is also due to the description in page 4 of the BT Developer Kit
document. It explains the format of the command 0x13 message (polling for
messages, sent from a master to a slave) and shows the format of the response
packet. My understanding was that the slave was only allowed to respond to
messages. But on the bottom of the page, the text says that when the slave has
data to send, it sends it via command 09, just like the master. If that is
allowed, then the communication is pretty symmetric, not exactly master-slave.

I would appreciate any help or clarification. (In my experimentation, I was able
to set up the brick as a master and the PC as a slave and to send messages to
the PC, but all my attemts to send messages or direct or system commands from
the PC to the brick using the BT serial port failed; when I use NextTool, it
works under /BT but not under /COM, which is consistent with my experience with
my own programs.)

Thanks, Sivan



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in NXT programmable brick

 
Verified and Trusted Team of Hackers
11 hours ago
Custom Search

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