nrf24l01+ won't work in enhanced shockburst

Discussion about wireless devices

nrf24l01+ won't work in enhanced shockburst

Postby tsjies » Mon Apr 29, 2013 2:09 pm

Hello,

First of all thanks Brennen for putting up the usefull tutorials, they have helped us alot.
However while following tutorial 2 our RF modules won't send when we enable auto ack in the initialise debug function.
Without it they can send and recieve.

Our code:
Code: Select all
nrf24l01_initialize_debug(false, 1, true);
while(1)
                        {
         nrf24l01_write_tx_payload(&data, 1, true); //transmit received char over RF

         //wait until the packet has been sent or the maximum number of retries has been active
         while(!(nrf24l01_irq_pin_active() && (nrf24l01_irq_tx_ds_active() || nrf24l01_irq_max_rt_active())));

         if(!nrf24l01_irq_max_rt_active())
                            {

            nrf24l01_irq_clear_all(); //clear all interrupts in the 24L01
            nrf24l01_set_as_rx(true); //change the device to an RX to get the character back from the other 24L01

            //wait a while to see if we get the data back (change the loop maximum and the lower if
            //  argument (should be loop maximum - 1) to lengthen or shorten this time frame
            for(count = 0; count < 20000; count++)
            {
               //check to see if the data has been received.  if so, get the data and exit the loop.
               //  if the loop is at its last count, assume the packet has been lost and set the data
               //  to go to the UART to "?".  If neither of these is true, keep looping.
               if((nrf24l01_irq_pin_active() && nrf24l01_irq_rx_dr_active()))
               {

                  nrf24l01_read_rx_payload(&rxdata, 1); //get the payload into data
                                                if (rxdata==data) LATAbits.LATA0=1;
                  break;
               }

               //if loop is on its last iteration, assume packet has been lost.
               if(count == 19999)
                  data = 0xFF;
            }

            nrf24l01_irq_clear_all(); //clear interrupts again

            simpleDelay(130); //wait for receiver to come from standby to RX
                                LATAbits.LATA0=0;
                                //nrf24l01_flush_rx();
            nrf24l01_set_as_tx(); //resume normal operation as a TX
         }
         else
         {
            nrf24l01_flush_tx(); //get the unsent character out of the TX FIFO
                                //nrf24l01_flush_rx();
            nrf24l01_irq_clear_all(); //clear all interrupts
                                LATAbits.LATA0=0;
         }
      }


We connect the RF module to a PIC24f16ka102.
Sometimes we succesfully transmit and recieve some bytes but that is only once every minute tops.

Kind regards
tsjies
 
Posts: 4
Joined: Mon Apr 29, 2013 2:00 pm

Re: nrf24l01+ won't work in enhanced shockburst

Postby brennen » Mon Apr 29, 2013 9:08 pm

So just to verify, you're sometimes seeing the value you send over the serial port, and sometimes you're seeing a question mark? Although it looks like you've modified the code to not have the question mark print out.
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: nrf24l01+ won't work in enhanced shockburst

Postby tsjies » Mon Apr 29, 2013 9:49 pm

In my code the module will always send the same byte (0x2C) and afterwards put the recieving byte in the char rxdata. When the two bytes are the same, a pulse is put on RA0, meaning we correctly got a certain byte. We probe this pin together with the clock to see how good the transmission of bytes is. When we used the debug config with auto ack enabled we got very few bytes that were succesfully transmitted. Like 3-4 per minute.
tsjies
 
Posts: 4
Joined: Mon Apr 29, 2013 2:00 pm

Re: nrf24l01+ won't work in enhanced shockburst

Postby brennen » Mon Apr 29, 2013 10:42 pm

It looks like the code is pretty close to mine, so I'm not really sure what is causing your problem, particularly if you had it working without Enhanced Shockburst working.
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: nrf24l01+ won't work in enhanced shockburst

Postby tsjies » Tue Apr 30, 2013 9:29 am

When i change this: if(!nrf24l01_irq_max_rt_active()) into if(nrf24l01_irq_max_rt_active()), i can receive the packets fine.
So he can accept the packets, just not the ack-packets... strange :p
tsjies
 
Posts: 4
Joined: Mon Apr 29, 2013 2:00 pm

Re: nrf24l01+ won't work in enhanced shockburst

Postby brennen » Tue Apr 30, 2013 2:03 pm

You're not properly transmitting packets if you change that. It means that you're getting a MAX_RT interrupt, but processing it like you got a TX_DS interrupt, which is incorrect. One thing you might try is to increase the delay in your SimpleDelay() calculation some. Or decrease it. See if any combination works (you will want it to be the same value on the remote and local units).
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: nrf24l01+ won't work in enhanced shockburst

Postby tsjies » Fri May 03, 2013 8:04 am

We got it working today. The local main file was programmed on both microcontrollers so there wasn't proper timing between the modules. We did not know the remote file had importance :p
Thanks for the help!!
tsjies
 
Posts: 4
Joined: Mon Apr 29, 2013 2:00 pm


Return to Wireless

Who is online

Users browsing this forum: No registered users and 2 guests

cron