I just got an experimental .Net class library running, that encapsulates an NRF24L01+ device.
This is made possible by use of this "SPIDriver" board that enables code on a Windows PC (or Linux or MacOS) to use SPI to communicate with peripherals.
The C# code shown below is modelled after the equivalent C code that I developed and tested on a Nucleo board that has an NRF24 attached.
You can see how straightforward it is to use the class library so I'm looking forward to doing some interesting stuff using my desktop PC to communicate with a bunch of Nucleos!
For years I've wanted to be able to use a PC as a base station to control/manage/oversee some microcontrollers and the WiFi route though doable is a trifle cumbersome and overkill really when using these small boards.
As a slight aside, I'd be interested in hearing what hardware gurus think about that SPIDriver board, it certainly works but I wonder if it can be improved upon, a simpler smaller cheaper board that has no display but offers a similar ability to use a serial port (so far as Windows is concerned) to drive an SPI interface.
This is made possible by use of this "SPIDriver" board that enables code on a Windows PC (or Linux or MacOS) to use SPI to communicate with peripherals.
The C# code shown below is modelled after the equivalent C code that I developed and tested on a Nucleo board that has an NRF24 attached.
C#:
using Radio.Nordic.NRF24L01P;
namespace Sandbox
{
class Program
{
private static ulong address = 0x19513831AA; // Testing address
private static byte[] payload = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 };
static void Main(string[] argv)
{
var port = NRF24L01P.GetNrfComPort();
using (NRF24L01P nrf = new NRF24L01P(port))
{
nrf.ConnectUSB();
nrf.Reset();
nrf.ConfigureRadio(9, 1, 0);
nrf.ClearInterruptFlags(true,true,true);
nrf.SetPipeState(Pipe.Pipe_0, true);
nrf.SetPipeState(Pipe.Pipe_1, false);
nrf.SetAutoAck(Pipe.Pipe_0,true);
nrf.SetTransmitMode();
nrf.SetCRC(true,true);
nrf.SetAddressWidth(3);
nrf.SetAutoAckRetries(1, 10);
nrf.PowerUp();
nrf.SetReceiveAddressLong(address, Pipe.Pipe_0);
nrf.SetTransmitAddress(address);
STATUS status;
status = nrf.ReadRegister<STATUS>();
while (true)
{
nrf.SendPayload(payload);
Thread.Sleep(100);
status = nrf.ReadRegister<STATUS>();
}
}
}
}
}
For years I've wanted to be able to use a PC as a base station to control/manage/oversee some microcontrollers and the WiFi route though doable is a trifle cumbersome and overkill really when using these small boards.
As a slight aside, I'd be interested in hearing what hardware gurus think about that SPIDriver board, it certainly works but I wonder if it can be improved upon, a simpler smaller cheaper board that has no display but offers a similar ability to use a serial port (so far as Windows is concerned) to drive an SPI interface.
Last edited:

