I just received my Feather board and loading TinyCLR OS was a success. Starting with a copy of the Cerb as the base, I modified the ScatterFile as mentioned above, and then comment out the support for CAN in device.h at this time. Build the new device and voila it produces a [your device].hex, and a [your device].bin; I did create a .dfu file from either of these files, but opt to use the STM32CubeProgrammer that uploads either of these files and flashes the chip.
The test. Why waste time blinking LEDs when you have plants that are dying from dehydration? From the sensor collection box, comes the Stemma soil moisture level sensor to the rescue.
class Program
{
static void Main()
{
var i2cController = GHIElectronics.TinyCLR.Devices.I2c.I2cController.FromName(Cerb.I2cBus.I2c1);
var soil = i2cController.GetDevice(new GHIElectronics.TinyCLR.Devices.I2c.I2cConnectionSettings(0x36, GHIElectronics.TinyCLR.Devices.I2c.I2cBusSpeed.FastMode));
var tempReadCmd = new byte[] { 0x00, 0x04 };
var touchReadCmd = new byte[] { 0x0F, 0x10 };
var buf_1 = new byte[4];
var buf_2 = new byte[2];
while (true)
{
soil.Write(tempReadCmd);
soil.Read(buf_1);
var read = (buf_1[0] << 24) | (buf_1[1] << 16) | (buf_1[2] << 8) | buf_1[3];
double temp = (1.0 / (1UL << 16)) * read;
temp = Math.Round(temp);
Thread.Sleep(200);
soil.Write(touchReadCmd);
soil.Read(buf_2);
var read1 = (buf_2[0] << 8) | buf_2[1];
System.Diagnostics.Debug.WriteLine($"Soil temp {temp}°C|{temp * 1.8 + 32}°F, Moisture level: {read1}");
Thread.Sleep(1000);
}
}
}
This is awesome! I am starting to love the Feather compact form factor over the duino style boards. Over the past year, I have been getting fat from eating too many RPi3 A’s with Raspian fillings and dotnetcore toppings. Porting and running TinyCLR OS (thanks @valon_hoti_gmail_com) has proven to be a delightful change in diet, as it is lean and comes with no empty calories.
Only downside, it may be stuck running TinyCLR 1.0 for a long time, even after 2.0 have been grandfathered and 4.0 is in the works (taking a page from Microsoft here).