Transmit Basic Client Selection
My first milestone was to get my Adafruit RFM69HCW Radio Bonnet 433/868/915MHz sending packets to a program running on an Arduino device.
On GitHub there were quite a few RFM69 libraries, many of which were “based on”/”inspired by” the library by Felix Rusu from lowerPowerLab. (I have a number of LowPwerLab devices and they are pretty robust and reliable)
https://github.com/LowPowerLab/RFM69
https://github.com/dltech/RFM69
https://github.com/UKHASnet/ukhasnet-rfm69
https://github.com/jdesbonnet/RFM69_LPC812_firmware
https://github.com/grilletjesus
https://github.com/SamClarke2012/RFM69-AVR
https://github.com/boti7/RFM69-driver
https://github.com/ahessling/RFM69-STM32
https://github.com/tanchgen/wl_light
https://github.com/floxo/rfm69
https://github.com/JohnOH/raspirf
https://github.com/jgromes/RadioLib
https://github.com/flok99/RFM69
https://github.com/noearchimede/RFM69
https://gitlab.com/sedgwickcharles/RFM69
https://github.com/j54n1n/rfm69
https://github.com/DeltaNova/RFM69W
https://github.com/shaunhey/rfm69-elster
https://github.com/ivan-kralik/rfm69
https://github.com/rasmatic
https://github.com/iwanders/plainRFM69
https://www.hoperf.com/data/upload/back/20181204/RFM69-LCD-Listen-mode-code.rar
I was looking for something like the Arduino-LoRa library by Sandeep Mistry which was a fairly lightweight wrapper for the HopeRF RFM9X family of devices. I was looking for a library that didn’t change many of the default settings, have any in memory buffering or an implementation which included retries or transmit power adjustments.
The first version of the code to send packets was based on the example in part3.
public sealed class StartupTask : IBackgroundTask
{
private const int ChipSelectLine = 1;
private const int ResetLine = 25;
private Rfm69HcwDevice rfm69Device = new Rfm69HcwDevice(ChipSelectLine, ResetLine);
const double RH_RF6M9HCW_FXOSC = 32000000.0;
const double RH_RFM69HCW_FSTEP = RH_RF6M9HCW_FXOSC / 524288.0;
const byte NetworkID = 100;
const byte NodeAddressFrom = 0x03;
const byte NodeAddressTo = 0x02;
public void Run(IBackgroundTaskInstance taskInstance)
{
rfm69Device.RegisterDump();
// regOpMode standby
rfm69Device.RegisterWriteByte(0x01, 0b00000100);
// BitRate MSB/LSB
rfm69Device.RegisterWriteByte(0x03, 0x34);
rfm69Device.RegisterWriteByte(0x04, 0x00);
// Frequency deviation
rfm69Device.RegisterWriteByte(0x05, 0x02);
rfm69Device.RegisterWriteByte(0x06, 0x3d);
// Calculate the frequency according to the datasheett
byte[] bytes = BitConverter.GetBytes((uint)(915000000.0 / RH_RFM69HCW_FSTEP));
Debug.WriteLine("Byte Hex 0x{0:x2} 0x{1:x2} 0x{2:x2} 0x{3:x2}", bytes[0], bytes[1], bytes[2], bytes[3]);
rfm69Device.RegisterWriteByte(0x07, bytes[2]);
rfm69Device.RegisterWriteByte(0x08, bytes[1]);
rfm69Device.RegisterWriteByte(0x09, bytes[0]);
rfm69Device.RegisterWriteByte(0x38, 0x04);
rfm69Device.RegisterDump();
while (true)
{
// Standby mode while loading message into FIFO
rfm69Device.RegisterWriteByte(0x01, 0b00000100);
byte[] messageBuffer = BitConverter.GetBytes((uint)0);
rfm69Device.RegisterWrite(0x0, messageBuffer);
// Transmit mode once FIFO loaded
rfm69Device.RegisterWriteByte(0x01, 0b00001100);
// Wait until send done, no timeouts in PoC
Debug.WriteLine("Send-wait");
byte IrqFlags = rfm69Device.RegisterReadByte(0x28); // RegIrqFlags2
while ((IrqFlags & 0b00001000) == 0) // wait until TxDone cleared
{
Task.Delay(10).Wait();
IrqFlags = rfm69Device.RegisterReadByte(0x28); // RegIrqFlags
Debug.Write(".");
}
Debug.WriteLine("");
// Standby mode while sleeping
rfm69Device.RegisterWriteByte(0x01, 0b00000100);
Debug.WriteLine($"{DateTime.Now.ToShortTimeString()}Send-Done");
Task.Delay(5000).Wait();
}
}
}
For testing my client device was an Easy Sensors Arduino Nano Radio Shield RFM69/95

I could see bytes getting put in the send buffer and the PacketSent bit flag in RegIrqFlags2 register was getting sent which was positive.