spirilis 1,265 Posted April 15, 2014 Author Share Posted April 15, 2014 I believe it is genuine nRF24L01+, green board, 10pin connector. Chip markings state NRF 0 24L01+ (1423CC date?). Increasing the delay to any time, or even removing the digitalWrite(_cePin, LOW) does not make a change. Even permanently changing all of the CE writes to HIGH does nothing. So I have investigated further and something strange is going on. Chooring a random pin for CE does not change anything, say PE_2. Setting pin PD_0 to output and HIGH prevents the module to be found. So this part of the problem may have nothing to do with the library as such. Weird. Check the resistance between CE, CSN, the SPI pins, Vcc, etc with a multimeter? Wonder if it's a board issue. But then you said it worked with an MSP430, so I dunno... Quote Link to post Share on other sites
SloMusti 2 Posted April 15, 2014 Share Posted April 15, 2014 I have eliminated the electrical issues with the following method: Used a brand new, fresh Launchpad Tiva C and NRF24L01+ module. Applied the previously posted sketch. Repeated the procedure with two more Tiva C Launchpads and some more nrf modules. Checked nfr modules win MSP430 launchpads, working as they should with the same library. Only remaining thing that comes to my ming is some buffer owerflow, screwing things up like this. This being only a Stellaris issue though. Quote Link to post Share on other sites
spirilis 1,265 Posted April 15, 2014 Author Share Posted April 15, 2014 I have eliminated the electrical issues with the following method: Used a brand new, fresh Launchpad Tiva C and NRF24L01+ module. Applied the previously posted sketch. Repeated the procedure with two more Tiva C Launchpads and some more nrf modules. Checked nfr modules win MSP430 launchpads, working as they should with the same library. Only remaining thing that comes to my ming is some buffer owerflow, screwing things up like this. This being only a Stellaris issue though. Gotcha ... Where did you d/l my library btw? Github, or one of the zipfile links here? Quote Link to post Share on other sites
SloMusti 2 Posted April 15, 2014 Share Posted April 15, 2014 Github, SHA c131089310980a1e6d799858e2700b866e832107, the latest there. Quote Link to post Share on other sites
SloMusti 2 Posted April 15, 2014 Share Posted April 15, 2014 The same setup as described in my previous posts works out-of-the-box with ZIP library http://forum.43oh.com/topic/3237-energia-library-nordic-nrf24l01-library/page-7#entry38488 ZIP version is of an older date then github, so there must have been some bugs introduced in the github version. Quote Link to post Share on other sites
spirilis 1,265 Posted April 15, 2014 Author Share Posted April 15, 2014 The same setup as described in my previous posts works out-of-the-box with ZIP library http://forum.43oh.com/topic/3237-energia-library-nordic-nrf24l01-library/page-7#entry38488 ZIP version is of an older date then github, so there must have been some bugs introduced in the github version. Hmm... diff of those 2: diff Enrf24-works/Enrf24.cpp Enrf24/Enrf24.cpp 25c25 < #include <Energia.h> --- > #include <Arduino.h> 341a342 > //digitalWrite(_cePin, HIGH); // Workaround for SI24R1 knockoff chips 343a345 > //digitalWrite(_cePin, LOW); 353c355 < delayMicroseconds(30); --- > delayMicroseconds(100); 484c486,488 < pwr = 0x03; --- > pwr = 0x06; > if (dBm >= 7) > pwr = 0x07; 486c490 < pwr = 0x02; --- > pwr = 0x04; 488c492 < pwr = 0x01; --- > pwr = 0x02; 491c495 < _writeReg(RF24_RF_SETUP, reg | (pwr << 1)); --- > _writeReg(RF24_RF_SETUP, reg | pwr); diff Enrf24-works/Enrf24.h Enrf24/Enrf24.h 30c30 < #include <Energia.h> --- > #include <Arduino.h> Common subdirectories: Enrf24-works/examples and Enrf24/examples Can't imagine that changing Energia.h to Arduino.h (which just includes Energia.h) did it... the RF_SETUP stuff looks correct, main thing is the change of delayMicroseconds() time. SloMusti 1 Quote Link to post Share on other sites
SloMusti 2 Posted April 15, 2014 Share Posted April 15, 2014 As it turns out, this wild goose chase has been created by a series of problems as follows: - CE on one of the test setups had stray resistance to another pin, due to the error on the PCB - solving this problem led to small changes in the library which broke the system further - I have skipped as step of freshly updating the library at some point Both old and GIT versions work with Tiva C Launchpad. I suggest the following fixes. TX demo suggests radio.print(str_on); radio.flush(); // Force transmit (don't wait for any more data) dump_radio_status_to_serialport(radio.radioState()); // Should report IDLE However the serial output states: Sending packet: ON Enrf24 radio transceiver status: Actively Transmitting Sending packet: OFF Enrf24 radio transceiver status: Actively Transmitting Why the state reported is different from the one suggested in the demo? Following up on this to the library with a possible failure on CE pin will results in TX buffer overflowing and the sketch crashing due to: if (reg & BIT5) { // RF24_TX_FULL #define is BIT0, which is not the correct bit for FIFO_STATUS. return; // Should never happen, but nonetheless a precaution to take. } Before returning this should probably do: txbuf_len = 0; // Reset TX ring buffer preventing the problem like this. Spirilis, thank you very much for your responses, they lead me to finding the problem, hopefully this run helps improve the library as well. Quote Link to post Share on other sites
spirilis 1,265 Posted April 15, 2014 Author Share Posted April 15, 2014 Good stuff @@SloMusti ! I'll probably add a flush on the TX buffer to that segment and perhaps a comment in the example reflecting your battle-earned experience Quote Link to post Share on other sites
spirilis 1,265 Posted April 16, 2014 Author Share Posted April 16, 2014 Updated the flush() method to perform _issueCmd(RF24_FLUSH_TX); txbuf_len = 0; if the FIFO_STATUS TX_FULL bit is found (usually indicates fault in CE pin). Zip file (we'll call this "v1.7")- Enrf24_v1_7.zip Quote Link to post Share on other sites
SloMusti 2 Posted April 16, 2014 Share Posted April 16, 2014 Great job, thanks! Some debugging advice: - if TX demo reports Actively transmitting, check CE pin. - if on the RX side you only see periodic text about received data, but not the castual string, check IRQ pin. - when using the communication with custom data, mind using print and write, the first converts your data into ASCII I have my use case happily running, will prepare an example for sending a packet with various data in a single packet shortly. Quote Link to post Share on other sites
RamonCardona 0 Posted April 17, 2014 Share Posted April 17, 2014 Hi! I've had some trouble trying to configure this. 1) My transreceiver doesn't have an antenna. But the weird thing is that using the "Channel Scanner" from the example of the library when I touch one of the cables it starts receiving information, and when I release it it stops. 2) What's the pin configuration?? I am working on a Quadcopter, and so far I would like to send the GPS coordinates to an LCD using two transreceivers: one flying, the other receiving. Please help!!!!! THANKS! Quote Link to post Share on other sites
RamonCardona 0 Posted April 17, 2014 Share Posted April 17, 2014 So, I followed this tutorial: http://unboxnbeyond.wordpress.com/2013/05/22/connecting-msp430-and-stellaris-launchpad-through-nrf24l01/ I was able to communicate my Tiva Launchpad and MSP430. However, I would like to interface 2 Tiva Launchpads. Any suggestions? Thank you! Quote Link to post Share on other sites
SloMusti 2 Posted April 17, 2014 Share Posted April 17, 2014 Edit: Probably misunderstood your question. You would like to put two transceivers on a single Launchpad? Then read below There are probably two options. Having both transceivers on the same SPI bus and assigning different CSN, CE and IRQ pins to them. To do this, you need to create two radio objects, for example: Enrf24 radio1(CE_1,CSN_1, IRQ_1); Enrf24 radio2(CE_2,CSN_2, IRQ_2); Then you repeat the begin and configuration code for both. I havent tested this yet myseld, but should work in theory. The second option is to use two different SPI buses, for that the Enrf24 library needs to be adapted, to support SPI argument as well. Again, writing this without testing: Enrf24.h must have the constructor fixed and an include added. #include <SPI.h> Enrf24(SPIClass *mySPI, uint8_t cePin, uint8_t csnPin, uint8_t irqPin); SPIClass *_mySPI; Enrf24.cpp must have the constructor fixed and all instances of "SPI." changed by "_mySPI->" /* Constructor */ Enrf24::Enrf24(SPIClass *mySPI,uint8_t cePin, uint8_t csnPin, uint8_t irqPin) { _mySPI = mySPI; _cePin = cePin; _csnPin = csnPin; _irqPin = irqPin; rf_status = 0; rf_addr_width = 5; txbuf_len = 0; readpending = 0; } Then in your main code you call this fixed library by: //radio Enrf24 radio(&SPI, ENRF24L_CE, ENRF24L_CSN, ENRF24L_IRQ); where SPI can be SPI0 for channel 0, SPI1 for channel 1, SPI for channel 2 (default), SPI3 for channel 3. This should work in theory, but needs to be tested. There could be a neater solution though. RamonCardona 1 Quote Link to post Share on other sites
RamonCardona 0 Posted April 17, 2014 Share Posted April 17, 2014 No, I would like to connect two transreceivers in two different Tiva Launchpads. Quote Link to post Share on other sites
SloMusti 2 Posted April 17, 2014 Share Posted April 17, 2014 Follow the tutorial you have posted, just repeat the connections on the second launchpad., Load one with TX demo and the other with RX demo that comes with this library. 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.