RAKSH 1 Posted January 20, 2014 Share Posted January 20, 2014 You mean to say :- I first start ,say with NRF in RX mode ,on receiving the packet i just issue the following command radio.print(str_on); radio.flush(); So I don't require to set TX address for the NRF which was previously in RX mode to send data ? Quote Link to post Share on other sites
RAKSH 1 Posted January 20, 2014 Share Posted January 20, 2014 And what about the transmitter side ?Suppose I want to receive data on a NRF which was previously assigned as Transmitter ,do i just issue the following commands ? while (!radio.available(true)) ; if (radio.read(inbuf)) {//display inbuf} Quote Link to post Share on other sites
spirilis 1,265 Posted January 20, 2014 Author Share Posted January 20, 2014 Oh, yeah, you do have to set the TX address. That has no effect on the RX address fyi. Sent from my Galaxy Note II with Tapatalk 4 RAKSH 1 Quote Link to post Share on other sites
spirilis 1,265 Posted January 20, 2014 Author Share Posted January 20, 2014 And for the 2nd post, yes that should work. Sent from my Galaxy Note II with Tapatalk 4 RAKSH 1 Quote Link to post Share on other sites
RAKSH 1 Posted January 21, 2014 Share Posted January 21, 2014 Thanks a lot Spirilis .For those who require a"ping" example I have attached two files ,ping_server and ping_client . ping_client.txt ping_server.txt Quote Link to post Share on other sites
chao 0 Posted February 6, 2014 Share Posted February 6, 2014 Good day everyone, my name is Chao. I am a new user to the Nordic nrf24l01, msp430 and energia. I am working on a school project, and I am tying to setup RF communications between two MSP430f5529 launchpad suing Nordic chips. I downloaded the library for the Nordic chip, and changed pins on the TX and RX demo to fit the pin configuration for the MSP430f5529. Then upload and run the demo, but I am having problems. I could not get the text "on" and "off" to show up on my receiver side, and the LED doesn't turn on and off. All I got is the text below: Text on TX: Sending packet: ON Enrf24 radio transceiver status: IDLE module powered up w/ oscillators running Sending packet: OFF Enrf24 radio transceiver status: IDLE module powered up w/ oscillators running Sending packet: ON Enrf24 radio transceiver status: IDLE module powered up w/ oscillators running Sending packet: OFF Enrf24 radio transceiver status: IDLE module powered up w/ oscillators running Sending packet: ON Enrf24 radio transceiver status: IDLE module powered up w/ oscillators running Sending packet: OFF Enrf24 radio transceiver status: IDLE module powered up w/ oscillators running Sending packet: ON Enrf24 radio transceiver status: IDLE module powered up w/ oscillators running Sending packet: OFF Enrf24 radio transceiver status: IDLE module powered up w/ oscillators running Sending packet: ON Enrf24 radio transceiver status: IDLE module powered up w/ oscillators running Sending packet: OFF Enrf24 radio transceiver status: IDLE module powered up w/ oscillators running Sending packet: ON Enrf24 radio transceiver status: IDLE module powered up w/ oscillators running Text on RX: Enrf24 radio transceiver status: DEEP SLEEP <1uA power consumption Enrf24 radio transceiver status: Receive Mode I only change one line on the code which is: Enrf24 radio(P3_5, P3_6, P3_7); // P2.0=CE, P2.1=CSN, P2.2=IRQ The connection on the pins are: Nordic Msp430f5529 luanchpad 1. GND GND 2. VCC 3.3V 3. CE P3_5 ( digitalRead() and dititalWrite()) 4. CS P3_6 ( digitalRead() and dititalWrite()) 5. SCK P3_2 (SCK) 6. MOSI P3_0 (MOSI) 7. MISO P3_1 (MISO) 8. IRQ P3_7 ( digitalRead() and dititalWrite()) I am wondering if anybody here can help me to figure out a way to solve the problems. Thank you very much. Quote Link to post Share on other sites
spirilis 1,265 Posted February 7, 2014 Author Share Posted February 7, 2014 Can you check the voltage level on the IRQ line for the RX side during all this? I have pullups disabled on the IRQ line b/c I didn't think it was needed; always seemed like the Nordic nRF24L01+ provided a pullup on that line, but if that is not the case then I'll have to rethink that. Quote Link to post Share on other sites
chao 0 Posted February 7, 2014 Share Posted February 7, 2014 Thanks for helping, spirilis. I just check the voltage level on the IRQ, it is 0 Volts. Quote Link to post Share on other sites
chao 0 Posted February 9, 2014 Share Posted February 9, 2014 Hi, spirillis. I solved the problem. It was a bad Nordic chip on the receiver side. I changed the Nordic chip and everything works fine. Thanks very much for your help. Quote Link to post Share on other sites
peterloron 0 Posted February 22, 2014 Share Posted February 22, 2014 Hi @@spirilis! Thanks for the library, it is working great out of the box. Is there a way for the receiver to see the source address of the data? Which transmitter sent the data? I'm eventually going to have several nodes sending data back to a central receiver connected to a computer for logging, and I will need to differentiate where the data comes from. I can, of course, embed a node ID in the data being sent, but if that is already part of the overhead sent by the library or the Nordic chip itself... Thanks! -Pete Quote Link to post Share on other sites
spirilis 1,265 Posted February 22, 2014 Author Share Posted February 22, 2014 No not without explicitly including the transmitter's address in the payload as a matter of application protocol. The Nordic hardware physically has no idea who sent it (sort've like I2C if you're familiar). Sent from my Galaxy Note II with Tapatalk 4 Quote Link to post Share on other sites
meet 2 Posted March 14, 2014 Share Posted March 14, 2014 Hi, thanks for the library, it's so useful. I am trying to make sensor nodes with nrf+msp430g2553 pairs. I'm aiming to use interrupts and make all the system low power as possible. I mean sleep both nrf and msp till an external stimulation comes and fire the interrupt flag, is it possible? For example, I have a PIR sensor on node1 and I want to stimulate node2 when there exist motion on node1. I have looked on your first demo code, and make it works for 3 nodes as blinking led every second. But when I m trying to use the example code structure on PIR with LPMs and interrupts it doesn't work. Maybe you can help me ? I'm not sure where to put on LPM and how to call interrupts to work. Here is my arrangement on your code; #include <Enrf24.h> #include <nRF24L01.h> #include <string.h> #include <SPI.h> Enrf24 radio(P2_0, P2_1, P2_2); // P2.0=CE, P2.1=CSN, P2.2=IRQ const uint8_t txaddr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x01 }; const char *str_on = "ON_A"; // send when motion dedected const int SENS = P1_1; // PIR pin, input 3.3V when motion dedected void setup() { SPI.begin(); SPI.setDataMode(SPI_MODE0); SPI.setBitOrder(1); // MSB-first radio.begin(); // Defaults 1Mbps, channel 0, max TX power radio.setTXaddress((void*)txaddr); pinMode(SENS, INPUT_PULLUP); attachInterrupt(SENS, pir, RISING); } void loop() { LPM4; } void pir(){ radio.print(str_on); radio.flush(); // Force transmit (don't wait for any more data) delay(1000); } Quote Link to post Share on other sites
spirilis 1,265 Posted March 14, 2014 Author Share Posted March 14, 2014 My code doesn't use interrupts natively at all, however there's no reason you can't add it yourself. Create a function that wakes the CPU up out of LPM, then make that the interrupt function for the nRF24's IRQ pin. This should only be necessary on the receive-side nodes BTW. Are you having trouble with the transmitter side or receiver side? Quote Link to post Share on other sites
meet 2 Posted March 14, 2014 Share Posted March 14, 2014 The code above was for the transmitter one, and the receiver is ready all the time for any data, there is no need to sleep the receiver node actually. But my code above, doesn't work. While waiting, the mcu is in LPM4, and I defined an interrupt when the PIR sensor stimullate P1_1 pin. So, it should wake up and process the codes inside void pir() I gues but it doesn't. Another question, in the void setup() we have radio.begin(). What exactly do this code? I mean, before radio.begin, is nrf sleeping or something like that? If it's, maybe I should use it inside the void pir() and awake nrf only when interrupt occurs. Quote Link to post Share on other sites
spirilis 1,265 Posted March 14, 2014 Author Share Posted March 14, 2014 The code above was for the transmitter one, and the receiver is ready all the time for any data, there is no need to sleep the receiver node actually. But my code above, doesn't work. While waiting, the mcu is in LPM4, and I defined an interrupt when the PIR sensor stimullate P1_1 pin. So, it should wake up and process the codes inside void pir() I gues but it doesn't. Another question, in the void setup() we have radio.begin(). What exactly do this code? I mean, before radio.begin, is nrf sleeping or something like that? If it's, maybe I should use it inside the void pir() and awake nrf only when interrupt occurs. Before begin() is run, the nRF is uninitialized, in powerdown/sleep mode with a default set of addresses and no radio configured. FIFOs are clear. Other settings might be off (e.g. whether interrupts expose themselves to the IRQ pin, etc). In general, I do not recommend doing any I/O inside an interrupt routine like what you're doing here. However I'm not certain that it shouldn't work, either. But it's generally a better idea to use the interrupt routine to set a volatile global flag and then exit LPM; then in your loop(), check that flag and do the work as needed, then re-enter LPM. Also, sleeping a whole second inside an interrupt service routine is a generally bad idea. Lastly, are you sure your PIR code works at all? Is the PIR sensor actually triggering the interrupt routine (e.g. have you tried just blinking an LED on the node1 board in response to the PIR sensor?) 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.