This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP-EXP430G2: Facing problem Communication between two MSP430G2553 Launchpad using nRF24L01+

Part Number: MSP-EXP430G2

Tool/software: Code Composer Studio

I want to do wireless communication between two "MSP430G2553" launchpads using "nRF224L01+" . The program for Transmitter and Receiver  are listed below. I am using"GitHub - spirilis/msprf24: nRF24L01+ Library for MSP430 micro controller line" library. There are no error shown in both the program the problem is my program LED should be glow but nothing is happening. please provide me some guidance.

These transmitter and receiver code are from library in which given as the Test_Programs. I have also provide link at the title of the program

#include <msp430.h>
#include "msprf24.h"
#include "nrf_userconfig.h"
#include "stdint.h"
volatile unsigned int user;
int main()
{
uint8_t addr[5];
uint8_t buf[32];
WDTCTL = WDTHOLD | WDTPW;
DCOCTL = CALDCO_16MHZ;
BCSCTL1 = CALBC1_16MHZ;
BCSCTL2 = DIVS_1;  // SMCLK = DCOCLK/2
// SPI (USCI) uses SMCLK, prefer SMCLK < 10MHz (SPI speed limit for nRF24 = 10MHz)
// Red, Green LED used for status
P1DIR |= 0x41;
P1OUT &= ~0x41;
user = 0xFE;
/* Initial values for nRF24L01+ library config variables */
rf_crc = RF24_EN_CRC | RF24_CRCO; // CRC enabled, 16-bit
rf_addr_width      = 5;
rf_speed_power     = RF24_SPEED_1MBPS | RF24_POWER_0DBM;
rf_channel         = 120;
msprf24_init();  // All RX pipes closed by default
msprf24_set_pipe_packetsize(0, 32);
msprf24_open_pipe(0, 1);  // Open pipe#0 with Enhanced ShockBurst enabled for receiving Auto-ACKs
        // Note: Pipe#0 is hardcoded in the transceiver hardware as the designated "pipe" for a TX node to receive
        // auto-ACKs.  This does not have to match the pipe# used on the RX side.
// Transmit to 'rad01' (0x72 0x61 0x64 0x30 0x31)
msprf24_standby();
user = msprf24_current_state();
addr[0] = 0xDE; addr[1] = 0xAD; addr[2] = 0xBE; addr[3] = 0xEF; addr[4] = 0x00;
w_tx_addr(addr);
w_rx_addr(0, addr);  // Pipe 0 receives auto-ack's, autoacks are sent back to the TX addr so the PTX node
            // needs to listen to the TX addr on pipe#0 to receive them.
while(1){
__delay_cycles(800000);
if(buf[0]=='0'){buf[0] = '1';buf[1] = '0';}
else {buf[0] = '0';buf[1] = '1';}
w_tx_payload(32, buf);
msprf24_activate_tx();
LPM4;
if (rf_irq & RF24_IRQ_FLAGGED) {
rf_irq &= ~RF24_IRQ_FLAGGED;
msprf24_get_irq_reason();
if (rf_irq & RF24_IRQ_TX){
P1OUT &= ~BIT0; // Red LED off
P1OUT |= 0x40;  // Green LED on
}
if (rf_irq & RF24_IRQ_TXFAILED){
P1OUT &= ~BIT6; // Green LED off
P1OUT |= BIT0;  // Red LED on
}
msprf24_irq_clear(rf_irq);
user = msprf24_get_last_retransmits();
}
}
return 0;
}

Code For Receiver:- link--" https://github.com/spirilis/msprf24/blob/master/TESTPROGS/g2553/ike-uscia-rx.c "

#include <msp430.h>
#include "msprf24.h"
#include "nrf_userconfig.h"
#include "stdint.h"
volatile unsigned int user;
int main()
{
uint8_t addr[5];
uint8_t buf[32];
WDTCTL = WDTHOLD | WDTPW;
DCOCTL = CALDCO_16MHZ;
BCSCTL1 = CALBC1_16MHZ;
BCSCTL2 = DIVS_1;  // SMCLK = DCOCLK/2
// SPI (USCI) uses SMCLK, prefer SMCLK < 10MHz (SPI speed limit for nRF24 = 10MHz)
// Red LED will be our output
P1DIR |= BIT0+BIT6;
P1OUT &= ~(BIT0+BIT6);
user = 0xFE;
/* Initial values for nRF24L01+ library config variables */
rf_crc = RF24_EN_CRC | RF24_CRCO; // CRC enabled, 16-bit
rf_addr_width      = 5;
rf_speed_power     = RF24_SPEED_1MBPS | RF24_POWER_0DBM;
rf_channel         = 120;
msprf24_init();
msprf24_set_pipe_packetsize(0, 32);
msprf24_open_pipe(0, 1);  // Open pipe#0 with Enhanced ShockBurst
// Set our RX address
addr[0] = 0xDE; addr[1] = 0xAD; addr[2] = 0xBE; addr[3] = 0xEF; addr[4] = 0x00;
w_rx_addr(0, addr);
// Receive mode
if (!(RF24_QUEUE_RXEMPTY & msprf24_queue_state())) {
flush_rx();
}
msprf24_activate_rx();
LPM4;
while (1) {
if (rf_irq & RF24_IRQ_FLAGGED) {
rf_irq &= ~RF24_IRQ_FLAGGED;
msprf24_get_irq_reason();
}
if (rf_irq & RF24_IRQ_RX || msprf24_rx_pending()) {
r_rx_payload(32, buf);
msprf24_irq_clear(RF24_IRQ_RX);
user = buf[0];
if (buf[0] == '0')
P1OUT &= ~BIT0;
if (buf[0] == '1')
P1OUT |= BIT0;
if (buf[1] == '0')
P1OUT &= ~BIT6;
if (buf[1] == '1')
P1OUT |= BIT6;
} else {
user = 0xFF;
}
LPM4;
}
return 0;
}

 

  • Could you please clarify on,

    "the problem is my program LED should be glow but nothing is happening"

    What is the program LED? Is this an LED you control though MSP430 or are talking about programming the MSP430.

  • Nima Eskandari said:

    Could you please clarify on,

    "the problem is my program LED should be glow but nothing is happening"

    What is the program LED? Is this an LED you control though MSP430 or are talking about programming the MSP430.

    Yes I am talking about programming the msp430. in program as result after successful implementation i got led as output but led is not glowing. Program are as above mentioned. please guide where I making mistake. 

  • There are two LEDs. P1.6 and P1.0. They are both configured correctly.Which LED is not turning on? Also is the issue on both the rx and the tx code?

  • Nima Eskandari said:

    There are two LEDs. P1.6 and P1.0. They are both configured correctly.Which LED is not turning on? Also is the issue on both the rx and the tx code?

    Both LEDs are not glowing neither on  Tx nor on Rx.

  • #include <msp430.h>
    #include "msprf24.h"
    #include "nrf_userconfig.h"
    #include "stdint.h"
    volatile unsigned int user;
    int main()
    {
    uint8_t addr[5];
    uint8_t buf[32];
    WDTCTL = WDTHOLD | WDTPW;
    DCOCTL = CALDCO_16MHZ;
    BCSCTL1 = CALBC1_16MHZ;
    BCSCTL2 = DIVS_1;  // SMCLK = DCOCLK/2
    // SPI (USCI) uses SMCLK, prefer SMCLK < 10MHz (SPI speed limit for nRF24 = 10MHz)
    // Red LED will be our output
    P1DIR |= BIT0+BIT6;
    P1OUT &= ~(BIT0+BIT6);
    
    while(1)
    {
     P1OUT ^= BIT0+BIT6;
    }
    }

    Could you try this code and verify that the LEDs are working?

  • Nima Eskandari said:
    #include <msp430.h>
    #include "msprf24.h"
    #include "nrf_userconfig.h"
    #include "stdint.h"
    volatile unsigned int user;
    int main()
    {
    uint8_t addr[5];
    uint8_t buf[32];
    WDTCTL = WDTHOLD | WDTPW;
    DCOCTL = CALDCO_16MHZ;
    BCSCTL1 = CALBC1_16MHZ;
    BCSCTL2 = DIVS_1;  // SMCLK = DCOCLK/2
    // SPI (USCI) uses SMCLK, prefer SMCLK < 10MHz (SPI speed limit for nRF24 = 10MHz)
    // Red LED will be our output
    P1DIR |= BIT0+BIT6;
    P1OUT &= ~(BIT0+BIT6);
    
    while(1)
    {
     P1OUT ^= BIT0+BIT6;
    }
    }

    Could you try this code and verify that the LEDs are working?

    After running this code both led are glowing.

  • Okay Chetan. This shows that the launchpads and your configuration of LEDs is not the problem. you will need to check the code for nrf_userconfig to see if the program gets halted due to errors in that code. This is a third party library. Double check your external hardware connection.

  • Nima Eskandari said:

    Okay Chetan. This shows that the launchpads and your configuration of LEDs is not the problem. you will need to check the code for nrf_userconfig to see if the program gets halted due to errors in that code. This is a third party library. Double check your external hardware connection.

    Thank you so much Nima Esksndari for your all time and support. After reading your reply  I made some changes in file "nrf_userconfig" and my problem got solved. Thank  you once again!!!

  • No problem. I'm glad your issue was solved. I'm closing this thread.

  • Hello, Chetan, I'll start working a NRF24L01 as TX and another NRF24L01 as the RX to send HTTP packages. Could you please send me the nrf_userconfig file to check it out?.. Thanks in advance.

**Attention** This is a public forum