spirilis 1,265 Posted March 15, 2013 Author Share Posted March 15, 2013 Small addition- A private state variable 'readpending' has been implemented that is set in _maintenanceHook() and not cleared until read(). This allows persistent testing of .available(1) for more freedom in your coding. An example of a scenario this would fix: while ( (millis()-saved_time) < 5000 && !nrf.available(1) ) // Two different tests ; // Ambiguity here--Which condition broke the while() loop? // This will always fail because if nrf.available(1) succeeded up above, the internal // _maintenanceHook() call will have cleared the IRQ and nrf.available(1) checks that. // Can use .available(0) instead. if (nrf.available(1)) { .... read packet and handle ... } Now that scenario could be handled by just testing if the millis() condition was the one that broke it, but what if both conditions occurred simultaneously? It's tricky. Then the user would have to remember to use .available(0) in the 2nd instance instead of .available(1). Adding extra SPI I/O imo. With this "readpending" variable added, the 2nd nrf.available(1) will succeed since _maintenanceHook() from the "!nrf.available(1)" condition in the while() loop will have set readpending=1 once it discovered an IRQ was raised and went to clear it. Further executions of nrf.available(1) will continue to report TRUE until nrf.read() is finally executed. This does not affect the behavior of nrf.available(0) at all. nrf.available(0) goes out over SPI and asks the transceiver if its RX buffers are empty to determine whether there is data pending or not. It's more thorough. Note that if an error packet (size=0 or >32) was found during the _maintenanceHook() execution, readpending is forcibly set to 0 (because a FLUSH_RX command is required to clear the error packet, throwing out everything in the RX queues). Quote Link to post Share on other sites
spirilis 1,265 Posted April 7, 2013 Author Share Posted April 7, 2013 Weird. What else is attached to the receiver launchpad? Quote Link to post Share on other sites
spirilis 1,265 Posted April 7, 2013 Author Share Posted April 7, 2013 The main thing I'd offer is that 2.4GHz is a warzone of noise, and some channels are likely to be noisier than others so you may find some nodes don't work so well. I'd recommend using the 5-byte RF addresses and stick with one channel--my example channel scanner (in the library) could help you find one that's very quiet. Also with long distances, I recommend using 250Kbps data rate as it's substantially more reliable over distance. Only downside is under the hood it won't perform auto-ACK. Quote Link to post Share on other sites
OzGrant 22 Posted April 7, 2013 Share Posted April 7, 2013 Yup, RF address sounds the best. Tks Quote Link to post Share on other sites
huskerfreak 0 Posted April 13, 2013 Share Posted April 13, 2013 I a super green noob and i can do a lot of the basics but I am stuck on how to the following. I want to have a wireless motion trigger the following code is what I use for taking pics with a wired motion trigger but I am not sure how or what would be the next step to making it wireless. Any help would be appreciated I have a set of the nRF24L01 to use for this. I ultimately want use the wireless msp430s but I thought I would try first with this. /********************** * Motion Activated Camera * Dan Bridges 2009 * * For schematics and more documentation see: * http://www.dayofthenewdan.com/projects/motion-camera **********************/ boolean focus = false; int shutterPin = 2; int focusPin = 3; int PIRPin = 4; int shutterPressDelay = 200; int focusPressDelay = 200; int interPictureDelay = 500; void setup(){ pinMode(shutterPin, OUTPUT); pinMode(focusPin, OUTPUT); } void loop(){ if (digitalRead(PIRPin)) { takePicture(); delay(interPictureDelay); } } void takePicture() { //If you want the camera to focus first set //the focus variable to true. if (focus) { digitalWrite(focusPin, HIGH); delay(focusPressDelay); digitalWrite(focusPin, LOW); delay(250); } digitalWrite(shutterPin, HIGH); delay(shutterPressDelay); digitalWrite(shutterPin, LOW); } Quote Link to post Share on other sites
neborkia 0 Posted April 30, 2013 Share Posted April 30, 2013 Ok, hello again... So after rereading this topic, I patched Energia and got the correct resulst in the TX, RX and scan examples [...] So this is really related to the Energia problem, I have to improve my github skills... I will go on and try receive/transmit examples on 2 launchpad soon. Sorry for disturbing you with this. Hi! I'm having the same issues with the TX and RX examples... what i've to do to patch Energia? Thank you, V. EDIT: After few hours of sleep i've successfully patched Energia and now the TX/RX demo is working! Thanks again! Quote Link to post Share on other sites
Pradeepa 1 Posted May 5, 2013 Share Posted May 5, 2013 (edited) good day guys, I'm totally new to Energia. This is my requirement. I have a stellaris launchpad LM4F120 and a MSP430 launchpad for 2553. I need to establish a simple communication link between these two using NRF24L01 transceivers. I downloaded energia. Then I downloaded the files "spirilis" linked in this post. I copied Enrf24.h, Enrf24.cpp and nRF24L01.h to Enrf24_RXdemo folder. Then I opened the .ino file through energia. But when I verify it through energia I got the following error messages. Please help me through. Enrf24.cpp: In member function 'void Enrf24::begin(uint32_t, uint8_t)': Enrf24.cpp:65:27: error: 'BIT2' was not declared in this scope Enrf24.cpp: In member function 'void Enrf24::_maintenanceHook()': Enrf24.cpp:239:41: error: 'BIT1' was not declared in this scope Enrf24.cpp: In member function 'boolean Enrf24::available(boolean)': Enrf24.cpp:277:39: error: 'BIT0' was not declared in this scope Enrf24.cpp: In member function 'size_t Enrf24::read(void*, uint8_t)': Enrf24.cpp:293:37: error: 'BIT0' was not declared in this scope Enrf24.cpp: In member function 'void Enrf24::flush()': Enrf24.cpp:316:13: error: 'BIT5' was not declared in this scope Enrf24.cpp:322:13: error: 'BIT6' was not declared in this scope Enrf24.cpp:337:16: error: 'BIT1' was not declared in this scope Enrf24.cpp:338:49: error: 'BIT3' was not declared in this scope Enrf24.cpp:338:49: error: 'BIT2' was not declared in this scope Enrf24.cpp:341:13: error: 'BIT0' was not declared in this scope Enrf24.cpp:344:49: error: 'BIT3' was not declared in this scope Enrf24.cpp:344:49: error: 'BIT2' was not declared in this scope Enrf24.cpp:344:75: error: 'BIT1' was not declared in this scope Enrf24.cpp: In member function 'uint8_t Enrf24::radioState()': Enrf24.cpp:396:16: error: 'BIT1' was not declared in this scope Enrf24.cpp:400:13: error: 'BIT0' was not declared in this scope Enrf24.cpp:407:36: error: 'BIT4' was not declared in this scope Enrf24.cpp: In member function 'void Enrf24::deepsleep()': Enrf24.cpp:417:14: error: 'BIT1' was not declared in this scope Enrf24.cpp:417:28: error: 'BIT0' was not declared in this scope Enrf24.cpp:418:49: error: 'BIT3' was not declared in this scope Enrf24.cpp:418:49: error: 'BIT2' was not declared in this scope Enrf24.cpp: In member function 'void Enrf24::enableRX()': Enrf24.cpp:428:47: error: 'BIT3' was not declared in this scope Enrf24.cpp:428:47: error: 'BIT2' was not declared in this scope Enrf24.cpp:428:73: error: 'BIT1' was not declared in this scope Enrf24.cpp:428:87: error: 'BIT0' was not declared in this scope Enrf24.cpp: In member function 'void Enrf24::disableRX()': Enrf24.cpp:443:13: error: 'BIT1' was not declared in this scope Enrf24.cpp:446:49: error: 'BIT3' was not declared in this scope Enrf24.cpp:446:49: error: 'BIT2' was not declared in this scope Enrf24.cpp:448:49: error: 'BIT3' was not declared in this scope Enrf24.cpp:448:49: error: 'BIT2' was not declared in this scope Enrf24.cpp: In member function 'void Enrf24::setCRC(boolean, boolean)': Enrf24.cpp:509:16: error: 'BIT3' was not declared in this scope Enrf24.cpp:511:16: error: 'BIT2' was not declared in this scope Thank you in advance. EDIT::: Sorry for the dumb question. I figured it out. Edited May 5, 2013 by Pradeepa Quote Link to post Share on other sites
Pradeepa 1 Posted May 6, 2013 Share Posted May 6, 2013 How to port this over to Stellaris Launchpad? Quote Link to post Share on other sites
dzsombor96 1 Posted May 6, 2013 Share Posted May 6, 2013 Hi. Just red the whole 3 pages but it is not really clear how to patch energia... Can someone explain it as simply as it can be? Another question: What is the range approximetly on the modules (without the amp) on 1Mbps and 250Kbps? Quote Link to post Share on other sites
Pradeepa 1 Posted May 7, 2013 Share Posted May 7, 2013 Good day, I want to connect my Stellaris launchpad and the MSP430 2553 using NRF24L01 transceivers. I found following energia libraries, For MSP430 http://forum.43oh.co...f24l01-library/ For Stelaris launchpad http://forum.stellar...f24l01-library/ After that I connected the pins of the modules like below, MSP430 CE >> P2.0 CSN >> P2.1 SCK >> P1.5 MOSI >> P1.7 MISO >> P1.6 Stellaris launchpad CE >> PA6 CSN >> PA7 SCK >> PB4 MOSI >> PB7 MISO >> PB6 Then i used putty to check whether the transmission is happening. But I think it is not. MSP430 serial interface gives my this result, Enrf24 radio transceiver status: Receive Mode Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: Receive Mode Received packet: Stellaris launchpad gives me following result Timeout on response from server! Finished sending I'm not sure whether I am doing this correctly. Can someone please help me through. Quote Link to post Share on other sites
spirilis 1,265 Posted May 7, 2013 Author Share Posted May 7, 2013 Good day, I want to connect my Stellaris launchpad and the MSP430 2553 using NRF24L01 transceivers. I found following energia libraries, For MSP430 http://forum.43oh.co...f24l01-library/ For Stelaris launchpad http://forum.stellar...f24l01-library/ After that I connected the pins of the modules like below, MSP430 CE >> P2.0 CSN >> P2.1 SCK >> P1.5 MOSI >> P1.7 MISO >> P1.6 Stellaris launchpad CE >> PA6 CSN >> PA7 SCK >> PB4 MOSI >> PB7 MISO >> PB6 Then i used putty to check whether the transmission is happening. But I think it is not. MSP430 serial interface gives my this result, Enrf24 radio transceiver status: Receive Mode Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: NO TRANSCEIVER PRESENT Received packet: Enrf24 radio transceiver status: Receive Mode Received packet: Stellaris launchpad gives me following result Timeout on response from server! Finished sending I'm not sure whether I am doing this correctly. Can someone please help me through. Something sounds awful flaky on the MSP430 side. It shouldn't shift from "Receive Mode" to "NO TRANSCEIVER PRESENT". Maybe check the wires and make sure they're not intermittently disconnecting or frayed? Quote Link to post Share on other sites
spirilis 1,265 Posted May 7, 2013 Author Share Posted May 7, 2013 Hi. Just red the whole 3 pages but it is not really clear how to patch energia... Can someone explain it as simply as it can be? Another question: What is the range approximetly on the modules (without the amp) on 1Mbps and 250Kbps? Geodave in another post mentioned about 40-50ft through 3 walls and I'm pretty sure that's with 250Kbps. 1Mbps is a lot less than that. I get about ~40ft through 3 or 4 walls with possibly some room to work with. That same setup does not work at all with 1Mbps. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.