This project has moved. For the latest updates, please go here.

A strange issue

Feb 8, 2014 at 11:32 PM
Hi All,

I have a strange issue with the nrf24L01+ modules. Infact the problem is not related to NETMF driver directly.

I have two Netduino+2 boards that can communicate between each other flawlessly. Also there are two MSP-EXP430G Development boards that they also can communicate between themselves without any problem.

But when I want to establish a communication between Netduino+2 and MSP430 I cannot get success.

If you do not have any clue also I may also share all the sources and libraries for both platforms.

If you think this discussion is not the correct place for this question sorry for the inconvenience.

Thanks and Regards,
Feb 9, 2014 at 8:15 AM
Hi,

You may find the both Energia for MSP430 codes and NETMF codes below.

Energia for MSP430:
Enrf24 radio(P2_0, P2_1, P2_2);
const uint8_t rxaddr[] = { 0x66, 0x66, 0x66, 0x66, 0x66 };

void dump_radio_status_to_serialport(uint8_t);

void setup() {
  Serial.begin(9600);

  SPI.begin();
  SPI.setDataMode(SPI_MODE0);
  SPI.setBitOrder(1); // MSB-first
  
  radio.begin();  // Defaults 1Mbps, channel 0, max TX power
  radio.setChannel(50);
  dump_radio_status_to_serialport(radio.radioState());

  radio.setRXaddress((void*)rxaddr);
  
  pinMode(P1_0, OUTPUT);
  digitalWrite(P1_0, LOW);
  
  radio.enableRX();  // Start listening
}

void loop() {
  char inbuf[33];
  
  dump_radio_status_to_serialport(radio.radioState());  // Should show Receive Mode

  while (!radio.available(true))
    ;
  if (radio.read(inbuf)) {
    Serial.print("Received packet: ");
    Serial.println(inbuf);
  }
}
NETMF Codes
namespace NetduinoTest
{
    public class Program
    {
        private static NRF24L01Plus radio;
        private static byte[] rxAddress;
        private static byte[] txAddress;
        private static byte channel;
        private static byte[] sendString;

        private static readonly OutputPort _led = new OutputPort(Pins.GPIO_PIN_A5, false);
        private static InterruptPort button = new InterruptPort(Pins.GPIO_PIN_D8, false, Port.ResistorMode.Disabled,
                                                         Port.InterruptMode.InterruptEdgeLow);
        public static void Main()
        {
            sendString = Encoding.UTF8.GetBytes("ON");

            channel = 50;

            //rxAddress = new byte[] { 0xDE, 0xAD, 0xBE, 0xEF, 0x01 };
            //rxAddress = new byte[] { 0x01, 0xEF, 0xBE, 0xAD, 0xDE };
            //rxAddress = new byte[] { 0x80, 0xF7, 0x7D, 0xB5, 0x7B };
            rxAddress = new byte[] { 0x66, 0x66, 0x66, 0x66, 0x66 };

            //txAddress = new byte[] { 0xDE, 0xAD, 0xBE, 0xEF, 0x01 };
            //txAddress = new byte[] { 0x01, 0xEF, 0xBE, 0xAD, 0xDE };
            //txAddress = new byte[] { 0x80, 0xF7, 0x7D, 0xB5, 0x7B };
            txAddress = new byte[] { 0x66, 0x66, 0x66, 0x66, 0x66 };

            button.OnInterrupt += button_OnInterrupt;
            
            radio = new NRF24L01Plus();
            radio.Initialize(SPI.SPI_module.SPI1, Pins.GPIO_PIN_D4, Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D2);
            radio.Configure(rxAddress, channel, NRFDataRate.DR1Mbps);
            radio.Enable();
            radio.OnDataReceived += radio_OnDataReceived;

            Thread.Sleep(Timeout.Infinite);
        }

        static void button_OnInterrupt(uint data1, uint data2, DateTime time)
        {
            radio.SendTo(txAddress, sendString, 1000);
        }

        static void radio_OnDataReceived(byte[] data)
        {
            var stat = radio.GetStatus();
            Debug.Print(stat.ToString());
            var inData = new string(Encoding.UTF8.GetChars(data));
            Debug.Print(inData);
            _led.Write(inData == "ON");
            Thread.Sleep(1000);
            _led.Write(false);
        }

    }
}
All the channel, TX/RX settings are equal.

Thanks and Regards