View unanswered posts | View active topics It is currently Thu Apr 17, 2014 12:43 pm






Reply to topic  [ 6 posts ] 
Using NrLink with PF Remote 
Author Message
Rookie

Joined: Mon Jul 06, 2009 2:59 pm
Posts: 13
Location: Baia Mare, Romania
Post Using NrLink with PF Remote
Hello,
I am currently working on a project where, for debugging reasons (nxtOSEK has no debugger :( ) I have to tell the robot to go in "look what's happening" phase from a distance. I have the NrLink and I am struggling to use the PF Remote as a state switch for the robot. But in this direction I didn't found a lot of info. So I looked in the specification PDF for NrLink and I am currently trying to identify the Remote commands from the Rx Buffer. From what I read there, it looks like the buffer begins at 0x42 and has the max length of 32 bytes (the counter from address 0x40 goes up till 0x20(32 dec) ). So i started to printf the first 10 bytes from the buffer and nothing looks like something readable (I found on internet the PF code, 16 bytes for each command).

Now the specification pdf says that 0x42 is just a pseudoregister pointing to the FIFO register (i tried to read at address given in 0x42 but same, weird results).
Also I am not sure if the buffer holds the values identifying the beginning of the burst or it just makes a pushback for each bit?
If the code is 16 bytes, i have to find the paired 2 bytes that have the given value?

I hope someone can make me understand what I am doing wrong or provide better details about the sensor and what (and how) does it identify.

Best Regards,
George Todoran


Mon Apr 23, 2012 8:21 am
Profile
Moderator
Moderator
User avatar

Joined: Thu Dec 22, 2011 7:42 am
Posts: 43
Post Re: Using NrLink with PF Remote
Hi todorangrg,
todorangrg wrote:
...nxtOSEK has no debugger :( ...
While it's not a nxtOSEK forum, you may get some help from RobotC users if you add more details about your communication issue. The protocol and hardware layers of an IR communication can interest some of them.
I suggest that you insert, in your demand,
  • url links to (or copy/paste of) your documentation,
  • source code where you see issues,
  • datalog showing what's happen (and what you expected)

The only fact to explain with a lot of clarity your issue will bring light upon your work :-)
best regards.
Miki.

_________________
Visit my project RainBot v0.11 on source forge, a 6 wheels robot featuring A* & Dijkstra's path finding, motors & sensors emulation, small font, fifo & sorted list libraries, using Xander's drivers for HT Compass, and documented with doxygen.


Mon Apr 23, 2012 2:19 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3105
Location: Rotterdam, The Netherlands
Post Re: Using NrLink with PF Remote
This is one of the few NXT sensors I actually don't own. Did you take a look at some of the NXC and ROBOTC code that you can download from here: [LINK]?

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Apr 24, 2012 5:44 am
Profile WWW
Rookie

Joined: Mon Jul 06, 2009 2:59 pm
Posts: 13
Location: Baia Mare, Romania
Post Re: Using NrLink with PF Remote
So the best documentation I found so far is http://www.tau.ac.il/~stoledo/lego/AVR-ir/ and the user guide, http://www.mindsensors.com/index.php?module=documents&JAS_DocumentManager_op=viewDocument&JAS_Document_id=11. The first link is actually what I am trying to do. I downloaded the code but that is a bit too complicated and lowlevel for me to understand. Other than those, all I can find doesn't relate with the sensor to receive, but to send data. I did spend a lot of time understanding the registers from the user guide, but I feel the given information of how each register works is limited.

What I want to know is how does the sensor receive the signal (in 1 byte chunks with auto-packets? or I have to make a search to find the first bit of the transmission? is the 2 byte transmitted signal continuous?).
Also from the user guide I can see that there are read and write registers at the same address (that means there are 2 registers or each byte is half-read, half-write (that would mean that for 2 byte chunks I should read 4 bytes from the register?))

If someone (mostly referring to mightor :) ) could take a look at the user guide and see if my presumptions about the registers are good I will be very grateful.
So far my attempts were:
1.
-look how many bytes (len) are stored in Rx buffer (atr adress 0x40)
-look at 0x42 for the first len bytes and look what values are stored in that vector;-> this leads to some pretty much random values that have nothing to do with the data I collected from the first reference site and that are constantly changing while I keep the remote pressed
2.
-look how many bytes (len) are stored in Rx buffer (atr adress 0x40)
-look at 0x42 for the first byte and look for the first len bytes at adress stored at 0x42 for what values are stored in that vector;-> this leads to some pretty much random values that have nothing to do with the data I collected from the first reference site and that are constantly changing while I keep the remote pressed
(i did this seeing from the user guide that the register at 0x42 is pseudo and POINTS to the FIFO position)

code extracts:
Code:
//attempt no 1.
//this works in a task
U8 dat[2]={0};
Remote.receive(0x40,dat,1);
if(dat[0]>=10){
   Remote.receive(0x42,REMVAL,10);
   dat[0]=0x46;
   //Remote.send(0x41,dat,1);//if i want to flush the buffer
}
/////////////////////////////////////////////////////////////////////////////////
//this in main task
lcd.putf("sx","val0=",REMVAL[0],0);lcd.putf("sxn","  val1=",REMVAL[1],0);
lcd.putf("sx","val2=",REMVAL[2],0);lcd.putf("sxn","  val3=",REMVAL[3],0);
lcd.putf("sx","val4=",REMVAL[4],0);lcd.putf("sxn","  val5=",REMVAL[5],0);
lcd.putf("sx","val6=",REMVAL[6],0);lcd.putf("sxn","  val7=",REMVAL[7],0);
lcd.putf("sx","val8=",REMVAL[8],0);lcd.putf("sxn","  val9=",REMVAL[9],0);



Running this will give random numbers for the 10 bytes and also randomly many of them become 0xFF. when i stop pressing the remote, everything is still, again pretty random values inside.

Best Regards,
George Todoran


Tue Apr 24, 2012 6:41 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3105
Location: Rotterdam, The Netherlands
Post Re: Using NrLink with PF Remote
I have no experience with this sensor but I have used the HiTechnic IRLink in this manner. I tried using it with the remote control and it turned out to be a complete pain in the behind (trying to be polite here). I found that even if I polled continuously and read the buffer, I still ended up not reading it fast enough or ending up with partial packets, etc.
The thing is, when you press a button on the remote, it constantly resends the packet, non-stop. It is up to you to find the start (pre-amble) and work from there.
The HT IRLink does not have the overflow thing that this sensor of yours has, so that's quite nice. Did you check the ROBOTC, NXC and Lejos code that is on the page that I pasted earlier? If the guide is too low level to understand than I am not really sure how you'll be able to write a driver for it. You need to fully understand how the RCX protocol works, how it's transmitted from the remote and how your sensor processes it, without that, I'm afraid you'll have a very hard time working with it.
If you have an RCX IR Tower, which I assume you do, you can use Putty or something to listen to the specific COM port and "spy" to see what the remote is sending. That's how I played with it.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Apr 24, 2012 12:41 pm
Profile WWW
Expert

Joined: Thu Sep 29, 2011 11:09 pm
Posts: 184
Location: Michigan USA
Post Re: Using NrLink with PF Remote
The PF communication protocol is significantly different from the UART the NrLink uses. The 2 protocols have practically nothing in common, other than using IR and the same carrier frequency. Without FW specifically designed to support the PF protocol, it is impossible to make it work as I understand you want it to.

If you want the PF communication protocol specs of all levels, you can read this PDF. It's a Power Functions communication protocol specification guide released by TLG, and I found it very easy to read and understand.

_________________
Matt


Wed May 02, 2012 2:04 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.