Main Site Documentation

SDK release covering some important updates


#1

This release includes some very important updates for .NET Gadgeteer users. It covers all known issues.

Important notes:

  1. This SDK also includes the changes in previous beta so check the previous release notes for full details.
  2. Update your device with latest firmware
  3. Read the release notes
  4. Start with a new project (or update the DLLs if you know how)

As always, the package installer is found at http://www.tinyclr.com/support/


#2

Just in time for the weekend! ;D

Thanks!


#3

Sorry I missed the beta period. Here’s my results.

Updated…

  • 2 x Pandas = no problem
  • 2 x Panda-II = 1st one no problem. 2nd one came up on COM16 and the updater couldn’t find it. Changed USB plugs and it came back as COM10 and the updater found it and updated.
  • 1 x Rhino = 1st attempt blew up the updater. 2nd attempt worked.

Love the new Hydra updater. However…there’s one big problem with it. I’m not sure about the SD method since I haven’t tried it, but If you’re using the wire jumper method then the instructions are out of order. If you follow the steps in order and reset the board (#6) just after you put it into Tinybooter mode (#5) then you will end up back in TinyClr mode. Trying to update (#7) will not work at this point. #7 really should be #6. Did I overlook something in the instructions? Following the order I outlined (#5, #7, then #6), the board updated correctly.


#4

Yes correct. This needs to be updated.


#5

Is I2C still working? The I2C Read function freeze my board, and Visual Studio debugger. And the write does not work anymore…


#6

What device? Example code?

I2C was only changed on Hydra and it was tested to work with all available modules.


#7

I’m using Hydra. Everything worked fine with the beta release and this morning, after the firmware upgrade, no more success.

using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using GTI = Gadgeteer.Interfaces;

using Gadgeteer.Modules.GHIElectronics;
using Gadgeteer.Modules.Seeed;

namespace HyperionGadgeteer
{
    public partial class Program
    {
        Font baseFont = Resources.GetFont(Resources.FontResources.NinaB);
        Font baseFontSmall = Resources.GetFont(Resources.FontResources.small);
        GTI.I2CBus MyI2C;
        bool RunningTest = true;
        int I2C_timeout = 100;
        int bitShift = 0;
        long ValueToWrite = 254;
        byte[] ByteToWrite = new byte[1];
        byte[] ByteRead = new byte[1];
        ushort NXP_PFC8574A_ADDRESS = 0x38;
        int NXP_PFC8574A_CLOCK_IN_kHz = 100;

        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/
            
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");

            GT.Socket socket = GT.Socket.GetSocket(6, true, MyI2CExtender, null);
            MyI2C = new GTI.I2CBus(socket, NXP_PFC8574A_ADDRESS, NXP_PFC8574A_CLOCK_IN_kHz, null);

            ShowHyperionInfo();

            // Définitions des timers
            GT.Timer TimerOR8 = new GT.Timer(250);   // every 2 seconds (2000ms)
           
            // Définition des Handlers
            TimerOR8.Tick += new GT.Timer.TickEventHandler(TimerOR8_Tick);
            MyButton.ButtonPressed += new Button.ButtonEventHandler(MyButton_ButtonPressed);
                       
            // Démarrage des timers
            TimerOR8.Start();
           
            //Initialisation des relais à l'état éteint;
            //MyI2C.Read(ByteRead, I2C_timeout);
            ByteToWrite[0] = (byte)ValueToWrite;
            MyI2C.Write(ByteToWrite, I2C_timeout);

        }

        
        #region EventHandler
        
        void TimerOR8_Tick(GT.Timer timer)
        {
            if (RunningTest)
            {
                ValueToWrite = 255;
                Clear(ref ValueToWrite, bitShift);
                ByteToWrite[0] = (byte)ValueToWrite;
                MyI2C.Write(ByteToWrite, I2C_timeout);
                //MyI2C.Read(ByteRead, I2C_timeout);

                if (bitShift < 7)
                {
                    bitShift += 1;
                }
                else
                {
                    bitShift = 0;
                }
            }

            //throw new NotImplementedException();
        }

        void MyButton_ButtonPressed(Button sender, Button.ButtonState state)
        {
            if (RunningTest)
            {
                RunningTest = false;
            }
            else
            {
                RunningTest = true;
            }

            //throw new NotImplementedException();
        }

        #endregion

        void ShowHyperionInfo()
        {
            MyOledDisplay.SimpleGraphics.DisplayText("Inertia Systemes", baseFont, GT.Color.Blue, 15, 15);
            MyOledDisplay.SimpleGraphics.DisplayText("Hyperion P.A.S.", baseFont, GT.Color.White, 15, 30);
            MyOledDisplay.SimpleGraphics.DisplayText("Version 2012.02.19", baseFontSmall, GT.Color.White, 15, 45);
        }

        void Clear(ref long ba, int bit)
        {
            long mask = 1L << bit;
            mask = ~mask;
            ba &= mask;
        }
    }
         
}


#8

For information, I’m using NXP PCF8574AP I2C I/O Expander

Which module is using I2C? I will buy one.


#9

Did you follow #4 below?

[quote]Important notes:

  1. This SDK also includes the changes in previous beta so check the previous release notes for full details.
  2. Update your device with latest firmware
  3. Read the release notes
  4. Start with a new project (or update the DLLs if you know how)
    [/quote]

The ones with socket type I, like accelerometer.


#10

yes I did.


#11

If this could help : From MFDeploy Device Info

DeviceInfo:
HAL build info: 4.1.2821.0, Microsoft Copyright © Microsoft Corporation. All rig
OEM Product codes (vendor, model, SKU): 255, 0, 65535
Serial Numbers (module, system):
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Solution Build Info: 4.1.3.1, Copyright © GHI Electronics, LLC
AppDomains:
default, id=1
Assemblies:
mscorlib,4.1.2821.0
Microsoft.SPOT.Native,4.1.2821.0
Microsoft.SPOT.Hardware,4.1.2821.0
Microsoft.SPOT.Graphics,4.1.2821.0
Microsoft.SPOT.TinyCore,4.1.2821.0
Microsoft.SPOT.IO,4.1.2821.0
System.IO,4.1.2821.0
Microsoft.SPOT.Hardware.Usb,4.1.2821.0
System.Xml,4.1.2821.0
Microsoft.SPOT.Hardware.SerialPort,4.1.2821.0
Microsoft.SPOT.Net,4.1.2821.0
System,4.1.2821.0
Microsoft.SPOT.Touch,4.1.2821.0
Microsoft.SPOT.Ink,4.1.2821.0
Gadgeteer,2.41.0.0
Gadgeteer.WebClient,2.41.0.0
Microsoft.SPOT.Net.Security,4.1.2821.0
System.Http,4.1.2821.0
GTM.Seeed.OledDisplay,1.4.1.0
GTM.GHIElectronics.Extender,4.1.1.0
Gadgeteer.WebServer,2.41.0.0
GHIElectronics.OSH.NETMF.Hardware,4.1.3.0
GTM.GHIElectronics.UsbClientDP,4.1.1.0
GTM.GHIElectronics.Button,4.1.1.0
HyperionGadgeteer,1.0.0.0
GHIElectronics.Gadgeteer.FEZHydra,4.1.1.0
System.Net.Security,4.1.2821.0


#12

Could you give me a link to redownload the beta release. I’ve deleted the files to fast. I want to retry the beta to see if I have broken something…


#13

I loaded Gadgeteer sources and found the exact bugging method. The board and VS freeze at

return device.Execute(transactions, timeout);
/// <summary>
        /// Performs a series of I2C transactions. 
        /// </summary>
        /// <remarks>
        /// This is a more advanced API for when <see cref="Write"/>, <see cref="Read"/> and <see cref="WriteRead"/> do not suffice. You may wish to use <see cref="I2CDevice.CreateWriteTransaction"/> and <see cref="I2CDevice.CreateReadTransaction"/> to create the transactions.
        /// </remarks>
        /// <param name="transactions">The list of transactions to perform.</param>
        /// <param name="timeout">The amount of time, in milliseconds, that the system will wait before resuming execution of the transaction.</param>
        /// <returns></returns>
        public int Execute(I2CDevice.I2CTransaction[] transactions, int timeout)
        {
            lock (I2CLock)
            {
                device.Config = this.configuration;
                return device.Execute(transactions, timeout);
            }
        }

Also, is the I2C read method supposed to freeze if the socket used is not connected to anything?


#14

Please use I2C directly through netmf, no gadgeteer, and let me know if it is any different.


#15

Created a new NETMF Console App with the code below :

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace MFConsoleApplication1
{
    public class Program
    {


        public static void Main()
        {
            
            //create I2C object
            //note that the netmf i2cdevice configuration requires a 7-bit address! It set the 8th R/W bit automatically.
            I2CDevice.Configuration con =
               new I2CDevice.Configuration(0x38, 100);
            I2CDevice MyI2C = new I2CDevice(con);

            // Create transactions
            // We need 2 in this example, we are reading from the device
            // First transaxrtion is writing teh "read command"
            // Second transaction is reading the data
            I2CDevice.I2CTransaction[] xActions =
               new I2CDevice.I2CTransaction[2];

            // create write buffer (we need one byte)
            byte[] RegisterNum = new byte[1] { 254 };
            xActions[0] = I2CDevice.CreateWriteTransaction(RegisterNum);
            // create read buffer to read the register
            byte[] RegisterValue = new byte[1];
            xActions[1] = I2CDevice.CreateReadTransaction(RegisterValue);

            // Now we access the I2C bus using a timeout of one second 
            // if the execute command returns zero, the transaction failed (this 
            // is a good check to make sure that you are communicating with the device correctly
            // and dont have a wiring issue or other problem with the I2C device)
            if (MyI2C.Execute(xActions, 1000) == 0)
            {
                Debug.Print("Failed to perform I2C transaction");
            }
            else
            {
                Debug.Print("Register value: " + RegisterValue[0].ToString());
            }
        }
    }
}

I got “Failed to perform I2C transaction”

I’m supposed to get a read of “254” because this is what I am supposed to write to PCF8574


#16

Hi,
I have tested the software I2C implementation found below and it worked.

http://code.tinyclr.com/project/297/software-i2c-driver/

I have used the socket 7 on my Hydra with the pin 8 and 9 as for the standard I2C. With this test I really think the I2C driver is bugged with the latest release.

UPDATE

It is really safe to use 24V power supply AND usb port with the USB Client DP Module? Everything worked fine until I play with the supply. Plugging and unplugging both USB and 24V and suddenly, the I2C transmission stop working. It does not restart now :frowning:

UPDATE

I finally bought a ScopeMeter for my debugging purpose. I don’t know what happened, but two of my PCF8574 was damaged. My circuit work again but Still no success with physical I2C
For the moment, the software version is correct, but speed limited to 1.25 KHz.