Jump to content
Maxim80

MSP430FR2355 problem to connect with nRF24L01+

Recommended Posts

Hi,

I recently bought a MSP-EXP430FR2355 launch pad to build a Weather station with NRF24L01+ so i have used a specific library Enrf24.h for ENERGIA.
The code for below already works with my MSP-EXP430FR2433 but not with my new MSP-EXP430FR2355.

I can't use the MSP430FR2433 beacause it doesn't have enough memory for me to add my temperature sensor BME280 with all code required by the sensor...
On the other side i can receive the information ON and OFF with a Raspberry Pi send by the FR2433 but not with my FR2355.

#include <SPI.h>
#include <Enrf24.h>
#include <nRF24L01.h>
#include <string.h>

Enrf24 radio(P1_3, P1_4, P2_2);  //WIRING MSP430FR2355 P1_3=CE, P1_4=CSN, P2_2=IRQ -> MOSI P1.6, MISO P1.7, SCK P1.5

const uint8_t txaddr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x01 };

const char *str_on = "ON65";
const char *str_off = "OFF65";

void setup() {
  Serial.begin(9600);
  Serial.println("RED10");
  
  SPI.begin();
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(1); // MSB-first

  radio.begin( 1000000, 76 );   
  radio.setCRC( 1, 1 );  
  //radio.begin();  // Defaults 1Mbps, channel 0, max TX power
  radio.setSpeed(250000);
  
  radio.setTXaddress((void*)txaddr);
 // Serial.println("RED10");

  Serial.print("STATE: ");
  Serial.println(radio.radioState());

  Serial.print("SPEED: ");
  Serial.println(radio.getSpeed());
}

void loop() {

  Serial.println("ON_1");
  radio.print(str_on);
  radio.flush();  // Force transmit (don't wait for any more data)
  
  delay(1000);
  Serial.println("OFF_1");
  radio.print(str_off);
  radio.flush();  //
  
  delay(1000);
}

 

With the MSP430FR2433 STATE: 1 and SPEED: 250000 which is ok

With the MSP430FR2355 STATE: 0 and SPEED: 1000000

The code stops when we entrer the loop without communication i thinks it's the SPI but it can be the library itself

Thanks for your help !

 

 

 

 

Share this post


Link to post
Share on other sites

You are right, there is indeed something wrong with SPI. The pins and registers are setup wrong in the SPI library due to incorrect pins in the MSP430FR2355 pins_energia.h header file.

Please copy the attached pins_energia.h to the MSP-EXP430FR2355LP variants directory.

  • Windows: <Energia dir>\hardware\energia\msp430\variants\MSP-EXP430FR2355LP
  • Linux: <Energia dir>/hardware/energia/msp430/variants/MSP-EXP430FR2355LP
  • macOS: Energia.app/Contents/Java/hardware/energia/msp430/variants/MSP-EXP430FR2355LP

Please let us know if this solved your issue.

Robert

pins_energia.h

Share this post


Link to post
Share on other sites

Sorry for the late reply, yes it works very well with this new file,

But there is only one available SPI on Energia ,  USCI B1:

- MOSI = P4.6
- MISO = P4.7
- CLK = P4.5

 

#include <SPI.h>
#include <Enrf24.h>
#include <nRF24L01.h>
#include <string.h>

Enrf24 radio(P5_0, P1_4, P2_2);  //WIRING MSP430FR2355 P5_0=CE, P1_4=CSN, P2_2=IRQ -> MOSI P4.6, MISO P4.7, SCK P4.5

const uint8_t txaddr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x01 };

const char *str_on = "ON65";
const char *str_off = "OFF65";

void setup() {
  Serial.begin(9600);
  Serial.println("RED10");
 
  SPI.begin();
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(1); // MSB-first

  radio.begin( 1000000, 76 );   // Defaults 1Mbps, channel 0, max TX power
  radio.setCRC( 1, 1 );  
  radio.setSpeed(250000);
 
  radio.setTXaddress((void*)txaddr);
  Serial.println("RED10");

  Serial.print("STATE: ");
  Serial.println(radio.radioState());

  Serial.print("SPEED: ");
  Serial.println(radio.getSpeed());
}

void loop() {

  Serial.println("ON_1");
  radio.print(str_on);
  radio.flush();  // Force transmit (don't wait for any more data)
 
  delay(1000);
  Serial.println("OFF_1");
  radio.print(str_off);
  radio.flush();
 
  delay(1000);
}

Thanks you !!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×