Main Site Documentation

Third Preview of TinyCLR OS Core Features


#1

Today we are excited to release the third preview of our TinyCLR OS. It adds support for the G400, Visual Basic, and LCDs.

All you need to do to get going is make sure you have Visual Studio 2017, install the latest extension, update your device’s firmware, and drop the new NuGet packages in your local feed. If you’re just now getting started with TinyCLR or just want a quick refresh, take a look at the first news post for more information.

Some of the things that exist today in TinyCLR OS:
[ul]Stable preview firmware for G30, G80, G120, G400, and products based on them.
GPIO, UART, SPI, I2C, ADC, DAC, PWM, LCD, and signal generation and capture support.
Full debugging capabilities including breakpoints, source stepping, and variable inspection.
Support for Visual Studio 2017 and the new Roslyn compiler with an easy install.
Practically unlimited max allocation size.
Improved deployment and startup times.
Better diagnostics support.
Code in C# and Visual Basic.[/ul]
While this preview includes the core features of TinyCLR OS, there is still a lot to do. Here are a few of the things in progress or under consideration:
[ul]USB host and client
File system
More graphics
Secure networking
Device updates
Generics
Controller Area Network
Runtime Loadable Procedures
Improved class library[/ul]
TinyCLR OS 0.3.0 Download: http://ghielectronics.com/downloads/TinyCLR/TinyCLR.0.3.0.zip
TinyCLR Release Notes: https://www.ghielectronics.com/docs/350/tinyclr-os


#2

signal generation and capture? Where can I read more about that?


#3

@ Mr. John Smith - https://www.ghielectronics.com/docs/24/signal-generator and https://www.ghielectronics.com/docs/106/signal-capture the API still matches what is in NETMF for now.


#4

@ John - Miam, miam !!! I’ll give it a try on my spider II and panda III this week-end !


#5

I thought I will give it a quick try, but…


#6

@ iamin - Are you on VS2017 with the desktop .NET workload? If so, try to repair the installation.


#7

@ John - I have reinstalled VS2017 and the first issue is gone now, however, I still cannot add other nuget packets.


#8

@ iamin - the error seems to imply your package sources are corrupt. Can you take a screenshot of the package list settings?


#9

Can you give us a hint on what LCDs are currently supported and how to initialize the LCD. And better yet please give us an example an example how to with some basic drawing primitives and text.


#10

@ John - You were spot on, there was one unnecessary entry in the source list.


#11

Visual Basic too ?

Give us a example! Blink led in BASIC


#12

@ scardinale - you can find a link on https://www.ghielectronics.com/docs/350/tinyclr-os at the bottom of the notes section for the 0.3.0 release that shows using a few of the new APIs in this release. Any display you could use in NETMF works here, just supply the correct configuration.

@ iamin - glad to hear you got it working

@ BASIC4EVER - see below:


Imports System.Threading
Imports GHIElectronics.TinyCLR.Devices.Gpio
Imports GHIElectronics.TinyCLR.Pins

Module Startup
    Sub Main()
        Dim controller = GpioController.GetDefault()
        Dim pin = controller.OpenPin(G30.GpioPin.PA0)

        pin.SetDriveMode(GpioPinDriveMode.Output)

        While True
            pin.Write(GpioPinValue.High)
            Thread.Sleep(100)
            pin.Write(GpioPinValue.Low)
            Thread.Sleep(100)
        End While
    End Sub
End Module


#13

Will TinyCLR OS in any way be compatible with the Azure IoT platform?? if not headed applications (which Windows 10 IoT Core is probably better because of UWP apps) i can see this very useful as headless (background) apps.

Generally Raspberry Pi 3 loaded with an UWP UI app is probably currently the cheapest option, but then for even smaller devices which don’t need UI, options are only Arduino, mbed, and maybe some others.

It would be great if you could create a version of G30 or G80 with a WIFI chip

something like Adafruit Feather https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-arduino-huzzah-esp8266-get-started
or Sparkfun Thing https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-sparkfun-esp8266-thing-dev-get-started

maybe even SIM card, something like https://hologram.io/dash/

and do some samples and documentation on how to bring this to the IoT bandwagon.


#14

@ Darko - Yes you can use TinyCLR with Azure. But please do not compare TinyCLR running on a tiny micro with Windows running on a full blown system. Each one has its own use. They complement each other, not replace one another.


#15

This is for TE35 we tested.

For different screen that supported by GHI, you can use their setting same as FEZ config shows.


static void TestLCD()
        {
            var displayController = DisplayController.GetDefault();

            displayController.ApplySettings(new LcdControllerSettings { Width = 320, Height = 240, HorizontalBackPorch = 27, HorizontalFrontPorch = 51, HorizontalSyncPolarity = false, HorizontalSyncPulseWidth = 41, OutputEnableIsFixed = true, OutputEnablePolarity = true, PixelClockRate = 15000000, PixelPolarity = true, VerticalBackPorch = 8, VerticalFrontPorch = 16, VerticalSyncPolarity = false, VerticalSyncPulseWidth = 10 });




            var background = Resources.GetBitmap(Resources.BitmapResources.Background);
            var font = Resources.GetFont(Resources.FontResources.small);
            var screen = Graphics.FromHdc(displayController.Hdc);

            screen.DrawLine(new Pen(Color.White, 2), 10, 10, 30, 10);
            screen.Flush();

            Thread.Sleep(1000);

            screen.Clear(Color.Black);
            screen.Flush();

            Thread.Sleep(1000);

            screen.DrawImage(background, 0, 40);
            screen.FillEllipse(new SolidBrush(Color.FromArgb(100, 0xFF, 0, 0)), 0, 0, 100, 100);
            screen.FillRectangle(new SolidBrush(Color.FromArgb(100, 0, 0, 0xFF)), 0, 100, 100, 100);
            screen.DrawEllipse(new Pen(Color.Blue), 100, 0, 100, 100);
            screen.DrawRectangle(new Pen(Color.Red), 100, 100, 100, 100);
            screen.DrawLine(new Pen(Color.Green, 5), 250, 0, 220, 240);
            screen.DrawString("Hello, world", font, new SolidBrush(Color.White), 10, 220);

            var i = 0;
            screen.DrawLine(new Pen(Color.Black, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.White, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Gray, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Red, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Green, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Blue, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Yellow, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Purple, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Teal, 4), 260 + i, 10, 260 + i, 50); i += 4;

            screen.Flush();

            using (var bmp = new Bitmap(2, 2))
            {
                var graphics = Graphics.FromImage(bmp);

                graphics.DrawLine(new Pen(Color.White, 1), 0, 0, 1, 0);

                using (var stream = new MemoryStream())
                {
                    bmp.Save(stream, ImageFormat.MemoryBmp);

                    var byteArray = stream.ToArray();
                }
            }

        }

Display setting for a G120E Developer Board 1.2
#16

@ DAT Why is there a difference in the LcdControllerSettings for PixelClockRate and HorizontalBackPorch for the G120/G120E and the G400?


#17

@ Darko - What we really need is TinyCLR running on the Feather boards.


#18

Code fixed. That was a copy/paste error from code used for testing. Yes they all should be the same.


#19

Hi.
Already TinyCLR0.3.0 and my Blink program still works. :smiley:

namespace TinyCLR_Blink
{
    public class Program
    {
        public static void Main()
        {
     	// Get the default GPIO controller on the system
            var gpio = GpioController.GetDefault(); // (1)

// Open GPIO Led1
            GpioPin led = gpio.OpenPin(FEZPandaIII.GpioPin.Led1); // (2)
// Set the IO direction as output
            led.SetDriveMode(GpioPinDriveMode.Output); // (3)

            while (true)
            {
                led.Write(GpioPinValue.High);
                Thread.Sleep(100);
                led.Write(GpioPinValue.Low);
                Thread.Sleep(300);
            }
        }
    }
}

It’s time to porting all my NetMF 4.3 libraries 8)


#20

Is LCD Touch included in the things in [em]progress or under consideration[/em]. It is not included in the list.