How to deploy TinyCLR to FEZ Raptor and porting the Gadgeteer modules drivers to TinyCLR

Hello friends,

In this video I will show you how to deploy TinyCLR to the Fez Raptor.

please join me to port all of gadgeteer modules drivers to TinyCLR, I have setup the code repository in GitHub - Gravicode/GadgeteerToTinyCLR: This is our effort to port gadgeteer modules/mainboards to TinyCLR , this project will be dedicated to the .NET gadgeteer fans :wink:

12 Likes

Great. Glad to see Gadgeteer working with VS2017, thanks to TinyCLR OS :slight_smile:

1 Like

Some correction to update bootloader.
[ul]Download G400 bootloader installer (make sure 2016 SDK is install with g400 Tools).
Copy
G400 Bootloader.2.0.2.bin in G400 bootlader installer directory.
Update Bootloader.tcl file with new name: replace booloader.bin with G400 Bootloader.2.0.2.bin.
Connect pin 8 on socket 3 to ground. Press reset and after 3 sec remove connection on this pin.
Open a command line (for me, it canā€™t work when just launch Flash booloader.bat with double-click on it) and launch .bat file.
Wait some minutes until Bootloader complete message appears.[/ul]

2 Likes

@ Bauland - Thanks for the correctionā€¦

More Drivers for Gadgeteer TinyCLR:
Tunes
DisplayT35
LEDStrip
Joystick

Serial Camera L1 - failedā€¦ (need more time)

source code here : [url]https://github.com/Gravicode/GadgeteerToTinyCLR[/url]

3 Likes

More drivers today for Gadgeteer TinyCLRā€¦
-DisplayNHVN (new haven module) - I use Dave touch controller driver for the capacitive touch, thanks mate :wink:
-AccelG248 (accelerometer)
-CharacterDisplay
-CurrentACS712
-Gyro
-RotaryH1

source code here : GitHub - Gravicode/GadgeteerToTinyCLR: This is our effort to port gadgeteer modules/mainboards to TinyCLR

Note:
Serial Camera L1 : I need to wait for the next TinyCLR release because there is a few methods/properties that doesnā€™t have an implementation in Serial Communication Class

4 Likes

New driversā€¦

-PulseOximeter (waiting for serial com. implementation ready)
-Compass
-Motor Driver L298
-Pulse Count
-Moisture

get: GitHub - Gravicode/GadgeteerToTinyCLR: This is our effort to port gadgeteer modules/mainboards to TinyCLR

1 Like

This reminds me of the request of getting a shared open source repository of drivers somewhere on github, is anyone digging into that? :whistle:

Todayā€™s updateā€¦

more driversā€¦
-MaxO (there is a bug when initialize the SPI, please help)
-Xbee Adapter (waiting for serial com. impl. completed)
-Touch C8
-Breakout TB10

get: GitHub - Gravicode/GadgeteerToTinyCLR: This is our effort to port gadgeteer modules/mainboards to TinyCLR

5 Likes

@ mifmasterz - bug?

@ Gus - yes, bug in my code, when I try to create spi device from id : ā€˜SPI1ā€™. I have tried spi mode 0 to spi mode 3, I got the same error. suggestion ?

@ mifmasterz - please provide simple code that isolates that one issue.

this is my last commit while waiting for the next TinyCLR releaseā€¦ (and I need your help to fix driver for MaxO and VideoOut)

more drivers:
-Relay X1
-VideoOut (I have got a problem when calling setdisplayconfiguration) -> if (ud != 0x55 && ud != 0x54) this.ErrorPrint(ā€œSetting the display configuration failed.ā€); Can I configure SDA and SCL pins manually with TinyCLR ? )
-CellularRadio (waiting for serial com. implementation and PPPSerialModem)
-RFID (waiting for serial com. implementation complete)

I canā€™t continue to these modules till usb host, filesystem, networking are ready

SDCard

WifiRS21

USBHost

ENC28

5 Likes

Iā€™ve bug in initialize SPI to, but maybe I initialize it wrong way:

        public DisplayN18(string spiControllerName, int digitalResetPin3, int digitalBackLightPin4, int digitalRsPin5, int digitalCsPin6)
        {
            _orientation = DisplayOrientation.Normal;

            _byteArray = new byte[1];
            _shortArray = new ushort[2];
            _isBgr = true;

            var controller = GpioController.GetDefault();

            _resetPin = controller.OpenPin(digitalResetPin3);
            _resetPin.SetDriveMode(GpioPinDriveMode.Output);

            _backlightPin = controller.OpenPin(digitalBackLightPin4);
            _backlightPin.SetDriveMode(GpioPinDriveMode.Output);

            _rsPin = controller.OpenPin(digitalRsPin5);
            _rsPin.SetDriveMode(GpioPinDriveMode.Output);

            //spiConfig = new GTI.SpiConfiguration(false, 0, 0, false, true, 12000);
            //netMFSpiConfig = new SPI.Configuration(this.socket.CpuPins[6], spiConfig.IsChipSelectActiveHigh, spiConfig.ChipSelectSetupTime, spiConfig.ChipSelectHoldTime, spiConfig.IsClockIdleHigh, spiConfig.IsClockSamplingEdgeRising, spiConfig.ClockRateKHz, this.socket.SPIModule);
            //spi = GTI.SpiFactory.Create(this.socket, spiConfig, GTI.SpiSharing.Shared, this.socket, Socket.Pin.Six, this);


            var settings = new SpiConnectionSettings(1)
            {
                ClockFrequency = 10000000, // 10 000 kHz
                Mode = SpiMode.Mode0,
                SharingMode = SpiSharingMode.Shared
            };
            
            //clock polarity = false, clock phase = true                                  


            string spiAqs = SpiDevice.GetDeviceSelector(spiControllerName);
            var devicesInfo = DeviceInformation.FindAll(spiAqs);
            _dev = SpiDevice.FromId(devicesInfo[0].Id, settings);

            Reset();
...

Exception raises on line:

 _dev = SpiDevice.FromId(devicesInfo[0].Id, settings);

with following message:


 #### Exception System.ArgumentException - 0x00000000 (1) ####
    #### Message: 
    #### GHIElectronics.TinyCLR.Devices.Spi.SpiDevice::FromId [IP: 002b] ####
   

Iā€™ve forget to say that Iā€™m using FEZ Spider II with N18 on socket 6.

Here is how I am initializing a ST7735 display same as the N18 . In my code, I an using fixed pins and SPI2 but you can modify to accommodate your configuration.


        public ST7735()
        {
            var gpio = GpioController.GetDefault();

            ControlPin = gpio.OpenPin(G80.GpioPin.PE10);
            ControlPin.SetDriveMode(GpioPinDriveMode.Output);

            ResetPin = gpio.OpenPin(G80.GpioPin.PE12);
            ResetPin.SetDriveMode(GpioPinDriveMode.Output);

            BacklightPin = gpio.OpenPin(G80.GpioPin.PC7);
            BacklightPin.SetDriveMode(GpioPinDriveMode.Output);

            // Initialize SPI
            var spiConnectionSettings = new SpiConnectionSettings(G80.GpioPin.PD10) { ClockFrequency = 48000000, Mode = SpiMode.Mode3, DataBitLength = 8, SharingMode = SpiSharingMode.Shared };

            var devices = DeviceInformation.FindAll();

            for (var x = 0; x < devices.Length; x++)
            {
                if (devices[x].Id == "SPI2")
                {
                    Spi = SpiDevice.FromId(devices[x].Id, spiConnectionSettings);
                }
            }

            Reset();
            Initialize();
            Backlight = true;
        }

   


2 Likes

Thank you very much, my mistakes were to not define DataBitLength and to initialize SpiConnectionSettings with 0 (in NETMF, it must be 0).
Now itā€™s working.

1 Like

@ Bauland - Thanks, now MaxO driver is working as expected :wink:

Video Out, I have ported from the latest driver as John suggest in this post : https://www.ghielectronics.com/community/forum/topic?id=18613&page=2
but itā€™s still returning ā€œSetting the display configuration failedā€

3 Likes

[quote=ā€œmifmasterzā€]
@ Bauland - Thanks, now MaxO driver is working as expected ;)[/quote]
Good news !

Sorry but I donā€™t own this module to help you.

@ mifmasterz

Take a look at your code at Line 197. Put in a breakpoint at this line and see what the value of ud is.

In line 198, you are testing for ud to be not both equal to either 0x55 and 0x54.

 if (ud != 0x55 && ud != 0x54)
                this.ErrorPrint("Setting the display configuration failed.");

This will always return true as a single byte cannot be both two values at once. Perhaps you mean to be testing with a Logical OR || rather than a Logical AND &&

@ scardinale - A variable can be not equal to two different values. It canā€™t be equal to two different values.

2 Likes