RamonCardona 0 Posted April 17, 2014 Share Posted April 17, 2014 I did, I connected everything in both tivas the same way, and just modified the three ports used. Here's the code. ?#?include? <Enrf24.h>#include <nRF24L01.h>#include <string.h>#include <SPI.h> Enrf24 radio(PE_1, PE_2, PE_3);const uint8_t rxaddr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x01 }; const char *str_on = "ON";const char *str_off = "OFF"; void dump_radio_status_to_serialport(uint8_t); void setup() {Serial.begin(9600); SPI.begin();SPI.setDataMode(SPI_MODE0);SPI.setBitOrder(MSBFIRST); radio.begin(); // Defaults 1Mbps, channel 0, max TX powerdump_radio_status_to_serialport(radio.radioState()); radio.setRXaddress((void*)rxaddr); pinMode(BLUE_LED, OUTPUT);//digitalWrite(BLUE_LED, LOW); radio.enableRX(); // Start listening} void loop() {char inbuf[100]; dump_radio_status_to_serialport(radio.radioState()); // Should show Receive Mode while (!radio.available(true));if (radio.read(inbuf)) {Serial.print("Received packet: ");Serial.println(inbuf); if (!strcmp(inbuf, str_on))digitalWrite(BLUE_LED, HIGH);if (!strcmp(inbuf, str_off))digitalWrite(BLUE_LED, LOW);}} void dump_radio_status_to_serialport(uint8_t status){Serial.print("Enrf24 radio transceiver status: ");switch (status) {case ENRF24_STATE_NOTPRESENT:Serial.println("NO TRANSCEIVER PRESENT");break; case ENRF24_STATE_DEEPSLEEP:Serial.println("DEEP SLEEP <1uA power consumption");break; case ENRF24_STATE_IDLE:Serial.println("IDLE module powered up w/ oscillators running");break; case ENRF24_STATE_PTX:Serial.println("Actively Transmitting");break; case ENRF24_STATE_PRX:Serial.println("Receive Mode");break; default:Serial.println("UNKNOWN STATUS CODE");}} Quote Link to post Share on other sites
RamonCardona 0 Posted April 17, 2014 Share Posted April 17, 2014 So, I modified the order of the ports... Instead of Enrf24 radio(PE_1, PE_2, PE_3); I am using Enrf24 radio(PE_3, PE_2, PE_1); And what it does is just print "NO TRANSRECEIVER PRESENT" Quote Link to post Share on other sites
spirilis 1,265 Posted April 17, 2014 Author Share Posted April 17, 2014 Yeah they need to be in the order of CE, CSN, IRQ. Edit: err actually that wouldn't matter there so long as PE_2 is CSN. Sent from my Galaxy Note II with Tapatalk 4 Quote Link to post Share on other sites
RamonCardona 0 Posted April 17, 2014 Share Posted April 17, 2014 But I don't get any lecture/response from the transreceiver (RX). Quote Link to post Share on other sites
Maddox675 0 Posted May 9, 2014 Share Posted May 9, 2014 This seems like it must be a simple "problem," but I can't figure it out. I have a Stellaris launchpad, the NRF24L01+ boosterpack board that I have added the radios to, I only have the single row of headers on the boosterpack (like the original 430G2 launchpad), and have downloaded the energia Enrf24 library. The stellaris passes all the blink tests with energia, so I loaded up the txdemo, imported the Enrf24 library, and hit upload and got the following: Enrf24_TXdemo.ino:9:14: error: 'P2_0' was not declared in this scope Enrf24_TXdemo.ino:9:20: error: 'P2_1' was not declared in this scope Enrf24_TXdemo.ino:9:26: error: 'P2_2' was not declared in this scope Must be this line that is bombing: Enrf24 radio(P2_0, P2_1, P2_2); // P2.0=CE, P2.1=CSN, P2.2=IRQ I'm guessing I somehow need to define the Stellaris pins...any hints? Apologies if this is not the right thread to post to. Thanks in advance. Quote Link to post Share on other sites
Maddox675 0 Posted May 10, 2014 Share Posted May 10, 2014 With some schematic tracing and launchpad pin correlation, here is what I found: nrf24l01 nrf24l01 430G2 Stellaris boosterpack Signal Launchpad Launchpad Pin 7 SCLK P1.5 SCK(2) Pin 8 CE P2.0 PA_5 Pin 9 CSN P2.1 PA_6 Pin 10 IRQ P2.2 PA_7 Pin 14 MISO P1.6 MISO(2) Pin 15 MOSI P1.7 MOSI(2) SPI(2) is the default SPI on the Stellaris so I modified the sketch to add the following: // Add Stellaris Pin mapping #define P2_0 PA_5 // CE #define P2_1 PA_6 // CSN #define P2_2 PA_7 // IRG Now the Sketch compiles...next, see if it all works! Quote Link to post Share on other sites
spirilis 1,265 Posted May 10, 2014 Author Share Posted May 10, 2014 Ah yes, actually I shouldn't be using Px_y notation anyhow cause the boosterpack pins are meant to be referenced by number. Sent from my Galaxy Note II with Tapatalk 4 Quote Link to post Share on other sites
spirilis 1,265 Posted May 29, 2014 Author Share Posted May 29, 2014 Fwiw, finally got off my ass and tested one of the SI24R1 modules I bought recently. Got a 20pk of them from China... these are "enhanced" clones of the nRF24L01+ made by a Taiwanese company supposedly, they're available for a similarly dirt-cheap price as the nRF24L01+ modules with the same look, pinout & PCB trace antenna, but one fancy feature is a new +7dBm TX mode. My Enrf24 library has supported this for a while now, but I hadn't tested it with live hardware 'til now. I'm pleased to say it seems to work. I made a simple test node with a LaunchPad, Nordic boosterpack and SI24R1 module, then tried at -6dBm, 0dBm and 7dBm with the node behind the concrete foundation wall where I had noticed packet loss start to occur at 0dBm. Indeed at 0dBm it was losing ~50-75% of the frames, -6dBm a bit more, but at 7dBm it was only losing <25% on average. Crude test, but seems to validate it. I didn't test it side-by-side with an authentic nRF24L01+ @ 0dBm though ... perhaps another day. Also, everything I read about it indicated the need to do some funky stuff with the CE pin and waiting longer for it to wake up (due to some sort of silicon bug). I don't do that in my library, but my wakeup delay is already a bit conservative/long, and it seems to work fine. bluehash 1 Quote Link to post Share on other sites
spirilis 1,265 Posted June 24, 2014 Author Share Posted June 24, 2014 So it occurred to me that I might have made a small change or 2 in the last ~1 year since I posted a release zipfile of this code, and since energia.nu now has a link to this thread I'm going to post the latest code up here & change the first post to point here. Enrf24_v1_8.zip sinhtran03 and reaper7 2 Quote Link to post Share on other sites
bobnova 59 Posted August 5, 2014 Share Posted August 5, 2014 Just thought I'd check in here and say THANK YOU! Excellent library, easy to use, easy to set up, etc. I have it working now, sending packets from a g2553 to a Tiva-C, works perfectly. I used the pin map chart Maddox675 posted, as I bought the modules alone rather than with a boosterpack. spirilis 1 Quote Link to post Share on other sites
bobnova 59 Posted September 2, 2014 Share Posted September 2, 2014 I've been working with this library some more, and I've run into an issue. It only seems to work correctly if Serial.begin() is called. I can remove the dump_radio_status bits and everything that actually uses serial and it still works just fine, but if I take out Serial.begin the radio does not function. It compiles just fine, but nothing comes out of the radio. I looked at the library a little bit but didn't see anything obvious, no huge shock there as it compiles. My guess is that it's something in the serial/i2c/spi hardware, but I haven't tested this. It came up as I'm trying to convince the radio to run on a 2452 and am using the timer for other things, so timerserial is out. Compiled and ran it, but nothing came out of the radio. Changed boards in Energia, stuck a 2553 into the launchpad, recompiled/uploaded, and it didn't work either. Added Serial.begin() and nothing else, and it works great. I'm happy to do more testing, but I'm short on directions to investigate. Quote Link to post Share on other sites
spirilis 1,265 Posted September 2, 2014 Author Share Posted September 2, 2014 I've been working with this library some more, and I've run into an issue. It only seems to work correctly if Serial.begin() is called. I can remove the dump_radio_status bits and everything that actually uses serial and it still works just fine, but if I take out Serial.begin the radio does not function. It compiles just fine, but nothing comes out of the radio. I looked at the library a little bit but didn't see anything obvious, no huge shock there as it compiles. My guess is that it's something in the serial/i2c/spi hardware, but I haven't tested this. It came up as I'm trying to convince the radio to run on a 2452 and am using the timer for other things, so timerserial is out. Compiled and ran it, but nothing came out of the radio. Changed boards in Energia, stuck a 2553 into the launchpad, recompiled/uploaded, and it didn't work either. Added Serial.begin() and nothing else, and it works great. I'm happy to do more testing, but I'm short on directions to investigate. Wow weird, will have to test that later. I do know SPI.begin() needs to be called beforehand but I'm not sure what Serial.begin() would do for it. Sent from my Galaxy Note II with Tapatalk 4 bobnova 1 Quote Link to post Share on other sites
bobnova 59 Posted September 2, 2014 Share Posted September 2, 2014 OK Now I'm really confused. I sat down to work with this some more, and the code that did not work earlier this evening without Serial.begin now works without it. I have absolutely no idea why, or what changed. I'm confused now. This is what I get for posting I guess! The especially confusing part is that I've run into this twice, the first time I put off more testing and posting about it, then forgot about it and didn't remember till earlier today. I'll keep poking it and see if I can figure out what the deal is/was. EDIT: I'm a doofus. I think it was a combination of things not actually Serial.begin() related. I have a 500ms delay after I call serial.begin to give the serial window time to open after uploading. That delay was inadvertently solving a completely unrelated bootup problem where the MCU and the radio would come alive at different times on powerup on the specific (non-launchpad) PCB I was using earlier. It has a very intelligent, inrush limiting, boost converter. I think the MSP was kicking off before the NRF24 and was zipping past / crashing in the nrf initialization process. The delay gave the boost converter time to get vcc up to >2v so the radio was happy. An additional factor may have been my swapping between 2553 and 2452, it turns out that Energia is totally happy to compile for a 2452 and upload it to a 2553. Whether that kills things or not I don't know, but I don't see it helping. So yeah, false alarm on the Serial.begin front, sorry about that! spirilis 1 Quote Link to post Share on other sites
dpcinci 0 Posted October 24, 2014 Share Posted October 24, 2014 Brand new to using the msp430...Spirilis, when I try to run the TX example code, I get an error reading "fatal error: avr/pgmspace.h: No such file or directory". It seems the SPI library is attempting to call this file but isn't finding anything. In fact, any time I try to use SPI.h, even outside of this example, nothing runs...Do you know a way around this? Thanks! Quote Link to post Share on other sites
roadrunner84 466 Posted October 24, 2014 Share Posted October 24, 2014 Brand new to using the msp430...Spirilis, when I try to run the TX example code, I get an error reading "fatal error: avr/pgmspace.h: No such file or directory". It seems the SPI library is attempting to call this file but isn't finding anything. In fact, any time I try to use SPI.h, even outside of this example, nothing runs...Do you know a way around this? Thanks! Since the error mentions "avr" I think you have set your target device to some AVR chip instead of the correct msp430 target board. 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.