Member #10122

Member Since: October 26, 2006

Country: United States

  • mixing nRF24L01+ and nRF24L01

    Hi, I have a TX board with dspic 33FJ and this nRF24L01+ (WRL-00691) and 2 RX board based on DSPF240, one with nRF24L01+ and the other with nRF24L01 when using the RX nRF24L01+ it works well but if I use the RX with the nRF24L01, I got some glitches from time to time and for certain values, it seems that the bytes are not fully received (MSB are not all decoded ???)

    Has anybody worked with mixing nRF24L01+ and nRF24L01 ? both are Sparkfun boards.

    here are my config

    the TXconfig :

    SendOnSPI( 0x20, 0x1C);    // PTX, CRC enabled 16 bit, ISR RX et TX, Power Down, TX config !
    SendOnSPI( 0x21, 0x00);    // disable auto-ack for all channels
    SendOnSPI( 0x23, 0x03);    // address width = 5 bytes
    SendOnSPI( 0x24, 0x00);    // auto retransmit off
    SendOnSPI( 0x25, 0x02);    // set channel 2   
    SendOnSPI( 0x26, 0x0F);    // data rate = 2 Mbps
    __builtin_nop();
    RF_CS = 0;                // activate SPI for nRF24L01+
    // set Address
    uidummy = SPI1BUF; SPI1BUF=0x30;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);
    uidummy = SPI1BUF; SPI1BUF=0xE7;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);
    uidummy = SPI1BUF; SPI1BUF=0xE7;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);
    uidummy = SPI1BUF; SPI1BUF=0xE7;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);
    uidummy = SPI1BUF; SPI1BUF=0xE7;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);
    uidummy = SPI1BUF; SPI1BUF=0xE7;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);
    RF_CS = 1;                // Donnnée envoyée, déselectionne le SPI du nRF24L01+ non actif => en VEILLE
    SendOnSPI( 0x20, 0x1E);    // PTX, CRC enabled 16 bit, ISR RX et TX, Power UP, TX
    

    while sending :

    SendOnSPI( 0x27, 0x7E);    // Clear previous intrrupts
    RF_CS = 0;
    uidummy = SPI1BUF; SPI1BUF=0xE1;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Flush TX Fifo   
    RF_CS = 1;
    RF_CS = 0;
    uidummy = SPI1BUF; SPI1BUF=0xA0;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Write TX-payload   
    uidummy = SPI1BUF; SPI1BUF= TimeStamp  & 0xFF;                while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Send le Hi
    uidummy = SPI1BUF; SPI1BUF=(TimeStamp>> 8) & 0xFF;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Send le low
    uidummy = SPI1BUF; SPI1BUF= AccelX1_RAW  & 0xFF;                while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Send le Hi
    uidummy = SPI1BUF; SPI1BUF=(AccelX1_RAW>> 8) & 0xFF;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Send le low
    uidummy = SPI1BUF; SPI1BUF= AccelY1_RAW  & 0xFF;                while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Send le Hi
    uidummy = SPI1BUF; SPI1BUF=(AccelY1_RAW>> 8) & 0xFF;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Send le low
    uidummy = SPI1BUF; SPI1BUF= AccelX2_RAW  & 0xFF;                while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Send le Hi
    uidummy = SPI1BUF; SPI1BUF=(AccelX2_RAW>> 8) & 0xFF;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Send le low
    uidummy = SPI1BUF; SPI1BUF= AccelY2_RAW  & 0xFF;                while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Send le Hi
    uidummy = SPI1BUF; SPI1BUF=(AccelY2_RAW>> 8) & 0xFF;    while (SPI1STATbits.SPITBF);    while ( !SPI1STATbits.SPIRBF);        // Send le low
    uidummy = SPI1BUF;                    // Read buffer to avoid overflow
    RF_CS = 1;
    SPI1STAT = 0x0000;    // Disable SPI port
    RF_CE = 1;         //Pulse CE to start transmission
    for (j=0; j<45; j++)        __builtin_nop();        // delay =10. us
    RF_CE = 0;        // Set RF24G non actif => en VEILLE
    

    On the other hand in the RX board (it is a TMS 320F240 DSP) : configure RX

    RF_CShi                    // Set nRF24L01 CSN pin à high : donc non actif
    RF_CElow                    // Set nRF24L01 configuration mode (ie il ne reçoit plus)
    SendOnSPI( 0x20, 0x3D);    // PRX, CRC enabled 16 bit, ISR RX only, Power Down
    SendOnSPI( 0x21, 0x00);    // dissable auto-ack for all channels
    SendOnSPI( 0x23, 0x03);    // address width = 5 bytes
    SendOnSPI( 0x25, 0x02);    // set channel 2   
    //    SendOnSPI( 0x26, 0x07);    // data rate = 1MB
    SendOnSPI( 0x26, 0x0F);    // data rate = 2 Mbps max de puissance
    
    
    //-------- special envoie de 1+5 bytes pour configurer l'adresse ---------------------------------------------
    //set address E76B3697B5
    RF_CSlow            // activate SPI for nRF24L01+
    // RX addy
    *SPIBUF=*SPIBUF;    *SPIDAT=0x2A;        while (! (*SPISTS & SETB6)) {}
    *SPIBUF=*SPIBUF;    *SPIDAT=0xE7;        while (! (*SPISTS & SETB6)) {}
    *SPIBUF=*SPIBUF;    *SPIDAT=0xE7;        while (! (*SPISTS & SETB6)) {}
    *SPIBUF=*SPIBUF;    *SPIDAT=0xE7;        while (! (*SPISTS & SETB6)) {}
    *SPIBUF=*SPIBUF;    *SPIDAT=0xE7;        while (! (*SPISTS & SETB6)) {}
    *SPIBUF=*SPIBUF;    *SPIDAT=0xE7;        while (! (*SPISTS & SETB6)) {}
    RF_CShi                // Donnnée envoyée, déselectionne le SPI du nRF24L01 non actif => en VEILLE
    //------------------------------------------------------------------------------------------------------------
    SendOnSPI( 0x31, 0x0A);    // 10 bytes payload    in RX_PW_P0 to enable it
    SendOnSPI( 0x20, 0x3F); //// PRX, CRC enabled 16 bit, ISR RX, Power UP
    RF_CEhi        // Set nRF24L01 en mode réception
    

    reading, within an interrupt service routine

    if ( RF_ISR==0)    // alors données prête à être lu
        {
        RF_CElow                    // arrête de recevoir pour pouvoir lire nRF24L01
        //---------------------- special envoie la commande Read Payload ---------------------------------------------
        RF_CSlow                // activate SPI for nRF24L01+
        *SPIBUF=*SPIBUF;    *SPIDAT=0x61;        while (! (*SPISTS & SETB6)) {}
        *SPIBUF=*SPIBUF;    // Clear buffer
        for (j=0; j<RF24LInDataLenght; j++)
            {
            // Lectures des donnees du RF24L, en burstmode
            *SPIDAT=0x00;        while (! (*SPISTS & SETB6)) {}        // Wait for transmission to begin and for Reception to complete
            slvdsp_spi_rxfifo[j] =*SPIBUF;        // va lire 1 byte
            }
        RF_CShi                // Donnnées lue, déselectionne le SPI du nRF24L01 non actif => en VEILLE
    
        RF_CSlow                // activate SPI for nRF24L01+
        *SPIBUF=*SPIBUF;    *SPIDAT=0xE2;        while (! (*SPISTS & SETB6)) {}
        RF_CShi
    
        RF_CSlow                // activate SPI for nRF24L01
        *SPIBUF=*SPIBUF;    *SPIDAT=0x27;        while (! (*SPISTS & SETB6)) {}
        *SPIBUF=*SPIBUF;    *SPIDAT=0x40;        while (! (*SPISTS & SETB6)) {}
        RF_CShi               
        RF_CEhi        // remet à nouveau le nRF24L01 en mode réception
    

    thanks for your kind help

  • Hi, you know where to buy MPU 9150 ? http://www.invensense.com/mems/gyro/mpu9150.html I found an AliExpress @ 10 USD but one must buy a lot because of DHL cost… http://www.aliexpress.com/store/product/100-New-INVENSENSE-MPU9150-MotionTracking-Sensor-MPU-9150/102034_558565991.html are many of you interested ? Can Sparkfun reease a breakout board with the MPU9150 sooner ? thanks Lotfi

  • https://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24LU1P#Download you need to register

No public wish lists :(