-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Troubles getting comms between rbpi & arduino #1
Comments
Hi Nathan, In an attempt to provide you with some more information on my current scenario, i've flashed again and started from scratch. I loaded the arduino with the irq ping sample(learn something new every day). Also rewired the rbpi according to this link: (https://gist.github.com/natevw/5789019) Results are closer it seems, below the feedback from the 2 units: on the arduino(ping) on the rbpi(pong) Then switched roles around with the following result on the arduino:(pong) on the rbpi(ping) This time I was actually able to see an error begin thrown: Here's where i'm currently stuck. Think i'm very close - but obviously still missing something. Any ideas? Kind Regards, |
Thanks for the detailed report! Could you paste in the result of a One thing, if you've also been using the C++ version, it handles the chip select pin wrong in a way that messes up correct usage. Every time after you run any of the code in https://github.com/stanleyseow/RF24 you will need to:
…before the node version will work. This basically "reboots" the SPI kernel driver without needing to reboot the whole Pi. See this thread for a longer explanation. You may or may not (i.e., probably do) need sudo, I usually DO run with that because I've taken no steps to allow other users access, but seems to occasionally work without it — it all depends on the permissions of the underlying /dev entries which I haven't really watched closely yet. |
Also you say:
This looks like things are not working properly on the Arduino either: everything is reading back as |
Hi Nathan, So i rewired and tested the arduino connections and code by setting two of them up with the one grounded via the role pin on pin 7. My wiring for the arduinos are as follows:
And here's my result: Sender:
Receiver:
The comms between the two arduinos seems to be working correctly. So next i'm on to the rbpi... I've made the connections as mentioned on the gist here: [https://gist.github.com/natevw/5789019] like so:
First i tried the Arduino as the sender and rbpi as receiver: Ardruino output:
Rbpi output:
Nothing was traced on the rbpi for this setup, so swopped roles around with the Arduino as the receiver: Ardruino output:
Rbpi output:
This time a little more descriptive. The result of .printDetails() like you asked is the following:
From what i could gather it seems like the code for the arduino is only refering to one pipe to do all comms, whereas the node app has got one for tx and one for rx - my absolute noobness is telling me that this might also cause and issue? Thanks again |
Hi again, You're going to hate me for this one, but my "noob-sense" was correct it seems. I was loading the incorrect sketch on the arduino. After correcting this it seems to work fine, with only one catch. When you're trying to transmit - the receiver has to be ready, otherwise it raises that exception from node's side (same as above). Is this expected behaviour? Example below node is transmitting, until i power down the arduino - and then the exception occurs.
Armand. |
Awesome, looks like you've got it working! The "unhandled error event" is just that — the current test.js code does not detect the error and reconnect the pipes, so I just let it crash. In a real app you'd want to handle pipe errors. |
Closing this since it looks like you've got it working. Let me know if you have any further questions! |
Hi Nathan,
First off, thank you for the time and effort you put into these projects - really appreciated by somebody as inexperienced as me. I'm extremely new to the world of programming for hardware and still learning, so please bear with me.
In short: I'm trying to get comms from a rbpi to an arduino via a node restfull service. I'm currently testing using express with node 0.10.2. I have confirmed that the rbpi can indeed communicate with the arduino by running stanleyseow's pingtest - so as far as I know the actual hardware seems to function as expected. In all the tests stanleyseow's ping app is loaded on the arduino.
I've tried using this repo (node-nrf) in order to get things going, but with no luck thus far. I installed all the dependencies via sudo npm install. The app seems to runs fine, but with either option (ping/pong) when running node test.js there seems to be no comms sent or received from the arduino when I look at the serial monitor on the arduino. I know this is a bit vague, but i'm not sure how one would go about debugging a problem like this? My first thought was that perhaps it's got something to do with permissions, or perhaps that for this project the nrf module needs to be hooked up differently?
I've also tried using your other project (node-rf24) where you created a node wrapper for stanleyseow's implementation. I fixed the compile error for node 0.10.x by adding the needed type cast 'uv_after_work_cb' to the 'uv_queue_work' methods where applicable, but unfortunately ran into problems here as well. Everything compiled fine, and node-gyp successfully compiled the node module, but it seems that when I try and do any call, I get a segmentation fault, after-which the service simply stops. I've seen the segmentation fault before when running the RF24 pingtest example without elevated permissions. I have tried running node as root - but this seems to have no effect.
I was hoping you would be able to provide me with some insight or possible solutions for my problems in order to get going - as the project i'm working on only needs really simple comms just to get started with the rest layer in order to do a poc. Hope to hear back from you.
Kind Regards,
Armand.
The text was updated successfully, but these errors were encountered: