I want to communicate between Arduino Mini Pro (china import) and a stm32f4 running netmf runtime. At the moment I'm able to communicate between SPI1 and SPI2 on the stm32 board.
After that I switched on the Arduino. I'm using the RF24 library and modified the GettingStarted sample to simply open pipes and send the same byte array again and again to the stm32.
It works for the first transmit but after that I did not receive any interrupts on the receiver side.
Both NRF24L01+ are power supplied by a breadboard power supply module which supplies 500ma (max USB bus). The Arduino is connected and power supplied by a CP2102 USB/Serial adapter.
NETMF Address: 0F0F0F0F0F Arduino Address: 0F0F0F0F0E
As arduino uses little endian, I reverse the bytes on stm32 side before writing the address into the pipe. But I'm already unsure if I need that step (adding the Arduino address on netmf side).
Here's my Arduino code:
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(9,10);
const int payload_size = 4;
const char payload[] = "PING";
void setup(void)
{
Serial.begin(57600);
printf_begin();
radio.begin();
radio.enableDynamicPayloads();
radio.setChannel(77);
radio.setAutoAck(true);
radio.setRetries(15,15);
radio.setDataRate(RF24_2MBPS);
radio.openWritingPipe((uint64_t)0x0F0F0F0F0FLL);
radio.openReadingPipe(1,(uint64_t)0x0F0F0F0F0ELL);
radio.stopListening();
radio.printDetails();
}
void loop(void)
{
unsigned long time = millis();
bool ok = radio.write( payload, payload_size );
if (ok)
printf("SUCCESS %lu...\n",time);
else
printf("fail %lu...\n",time);
// Try again 1s later
delay(1000);
}
Here's my NETmf code
NRF24L01Plus _module = new NRF24L01Plus();
public override void Init()
{
_module.Initialize(SPI_Devices.SPI2, Pins.GPIO_PIN_D_8, Pins.GPIO_PIN_D_10, Pins.GPIO_PIN_B_12);
_module.Configure(new byte[] { 0x0F, 0x0F, 0x0F, 0x0F, 0x0F }, 77, NRFDataRate.DR2Mbps);
// both handlers are never executed
_module.OnDataReceived += this.OnReceive;
_module.OnInterrupt += _module2_OnInterrupt;
_module.Enable();
}