Main Site Documentation

Seeedstudio gadgeteer drivers released


#1

Hi

Yesterday Seeedstudio released BETA drivers for this modules
[ulist]
Accelerometer
Barometer
CellularRadio
Compass
GPS
Gyro
MoistureSensor
OLED_DisPlay
Relays
TemperatureHumidity
[/ulist]

Drivers:http://www.seeedstudio.com/depot/source/SeeedModuleDriver.zip
SourceCode: http://www.seeedstudio.com/depot/source/driverSourcecode.zip

Now I can continue work on my robot :smiley:


#2

Yay,
Thank you…


#3

I’ve done a very short test of my modules with the included code samples

  • Accelerometer Module dont work for me (Returns only the default values)
  • Compass Module dont work for me (Returns only the default values)
  • Gyro Module dont work for me (Returns only the default values)
  • GPS Module Looks good

Someone else tested the seedstudio modules ?

Tomorrow i have more time maybe it’s an error on my side.


#4

Accelerometer and Gyro events do not seem to get triggered. I am only able to get data by manually polling the values in a loop.

I download the source for the drivers and put a break-point on the _input_Interrupt function and it never gets triggered. Anyone know how to fix this?


#5

We will ping seeed on our end but you guys also need to let them know.


#6

Yesterday I also did a quick test.

You’ll have to create a separate thread to do the polling of the values. Play with the thread sleep depending on what you need.

When using the gyro, call the gyro.Init() method, seems this will stabilize the values a bit. Although I’m getting slightly different values with each poll even if the device is laying still.

I did notice that connecting the modules to the spider in the designer isn’t working correctly, “not all modules could be connected”. Had to assign the ports in code.


#7

Hello,
to get my Compass to work i had to do the following and the events fired:


       compass.CompassHigh += new Compass.CompassEventHandler(compass_CompassHigh);
            compass.CompassLow += new Compass.CompassEventHandler(compass_CompassLow);
            //compass.DebugPrintEnabled = false; //for some reason this has no effect even after setting it to false it still prints to the OutPut window.
            // Do one-time tasks here
            compass.getAngle(); //doing this gets the compass going now my High event fires... and it blocks the thread so you definitely need thread for the compass to run...

        void compass_CompassLow(Compass sender, Compass.CompassState state)
        {
             Debug.Print("Compass is Low");//never fires
        }

        void compass_CompassHigh(Compass sender, Compass.CompassState state)
        {
            Thread.Sleep(1000);
            compass.getAngle(); //prints to the OutPut window..
        }

the Low event never fired …not sure when it is suppose to fire…

Also i noticed that when you use the Accelerometer with the Display_T35 you can no longer Plug the T socket to 10 the designer doesn’t allow you even if i have the Accelerometer plugged to it’s own socket… some sort of conflict???

As for the Accelerometer i looked at the source code of the driver and they are not even assigning the onAcceleromoter in the _input_Interrupt…


//it looks like this 
   private void _input_Interrupt(GTI.InterruptInput input, bool value)
        {
           
        }

//and i think it should be like this:

   private void _input_Interrupt(GTI.InterruptInput input, bool value)
        {
            this.OnAccelerometerEvent(this);
        }

thanks.

Jay.


#8

Hello,
After a closer investigation of the driver source code i noticed a few thing:
the interrupt never fires

private void _input_Interrupt(GTI.InterruptInput input, bool value)

so to compensate for that they did a fake loop in the Compass driver which once you call the getAngle() it calls the onCompass event and that goes into a loop given the impression of interrupt being fired. not this works but it has issues… for example they are calling Debug.Print internally and that fills the VS Debugger window even if you stop debugging, i noticed this because i have multiple windows open and suddenly my other VS that has a different project got the buffer of the compass window …

so i guess the seeedstudio driver was put pretty quickly just to get things up and running…

so if you want to the Accelerometer to behave the same way do the following:



        public Acceleration ReadAcceleration()
        {
            //Thread.Sleep(1000);
            Acceleration acceleration = new Acceleration();
            Read(Register.XOUT8, _readBuffer24);
            acceleration.X = ((((_readBuffer24[0] >> 7) == 1) ? -128 : 0) + (_readBuffer24[0] & 0x7F)); // * ConvertRangeToGPerBit(range);
            acceleration.Y = ((((_readBuffer24[1] >> 7) == 1) ? -128 : 0) + (_readBuffer24[1] & 0x7F)); // + 16 * ConvertRangeToGPerBit(range);
            acceleration.Z = ((((_readBuffer24[2] >> 7) == 1) ? -128 : 0) + (_readBuffer24[2] & 0x7F)); // * ConvertRangeToGPerBit(range);
            //Debug.Print("acceleration X= : " + acceleration.X);
            //Debug.Print("acceleration y= : " + acceleration.Y);
            //Debug.Print("acceleration Z= : " + acceleration.Z);
            //Debug.Print("acceleration: " + acceleration);
            OnAccelerometerEvent(this, acceleration);
         
            return acceleration;
        }

//and

public delegate void AccelerometerEventHandler(Accelerometer sender, Acceleration acceleration);

        protected virtual void OnAccelerometerEvent(Accelerometer sender, Acceleration acceleration )
        {
            if (this.onAccelerometer == null)
            {
                this.onAccelerometer = new AccelerometerEventHandler(this.OnAccelerometerEvent);
            }

            if (Program.CheckAndInvoke(AccelerometerInterrupt, this.onAccelerometer, sender))
            {
                this.AccelerometerInterrupt(sender, acceleration);
            }
        }

Jay


#9

Thanks a lot I’ll try this on weekend. Currently i have to finish some other stupid work. No time for Gadgeteer experiments :frowning:


#10

I think I found out how to get the interrupt to trigger. In the GyroInit function add:

Write(Register.INT_CFG, (byte)0xB1);

That will cause the interrupt to trigger. Just call the GyroInit function once you set your events.

To clear the latch (and receive the next string of data) you must complete a Read.

Take a look at the PDF for the Gyro included in the source package under section 8.4 Register 23 – Interrupt Configuration. That’s where I figured all this out. Hope this helps someone out.


#11

Today I spend some hours on my modules and finally i can say no I2C module works.
tested Compass,Gyro,Accelerator

I tried to reduce everything and finally I wrote this code:


 I2CDevice.Configuration con = new I2CDevice.Configuration(0x68, 100); // gyro module (0x68)
            using (I2CDevice MyI2C = new I2CDevice(con))
            {

                I2CDevice.I2CTransaction[] xActions = new I2CDevice.I2CTransaction[2];

                byte[] RegisterNum = new byte[1] { 0x00 }; // 0x00 ... WHO_AM_I
                xActions[0] = I2CDevice.CreateWriteTransaction(RegisterNum);
                byte[] RegisterValue = new byte[1];
                xActions[1] = I2CDevice.CreateReadTransaction(RegisterValue);


                if (MyI2C.Execute(xActions, 1000) == 0)
                {
                    Debug.Print("Failed to perform I2C transaction"); // <--- I always get here :(
                }
                else
                {
                    Debug.Print("Register value: " + RegisterValue[0].ToString());
                }
            }

This code is from the I2C tutorial. I changed adress to 0x68 (found in the Gyro sourcecode)
In the dokumentation i found the WHO_AM_I Register at 0x00.
I also tried INT_CFG(0x17)
I also tried INT_STATUS (0x1A)

No Response from the module.

Any suggestions ?

Is there a code or something else to test if I2C is working ? Or detect if any module is attached ?

I also tried in the Gyro constructor after socket is initialized


 public Gyro(int socketNumber)
        {
            // This finds the Socket instance from the user-specified socket number.  
            // This will generate user-friendly error messages if the socket is invalid.
            // If there is more than one socket on this module, then instead of "null" for the last parameter, 
            // put text that identifies the socket to the user (e.g. "S" if there is a socket type S)
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            i2c = new GTI.I2CBus(socket, 0x68, 100, this);

             byte[] RegisterNum = new byte[1] { 0x00 }; // 0x00 ... WHO_AM_I
             byte[] RegisterValue = new byte[1];
             var result = i2c.WriteRead(RegisterNum, RegisterValue, 1000);
             if (result == 0)
             {
                 Debug.Print("Gyro not working :(");
             }
....

Same result :frowning:


#12

Did you check your Power Source, i know Gus said this many times and he right almost everytime, please double check your USB Port or use a powered USB Hub…


#13

I tried powered USB Port and external power supply.

I have only the seeedstudio modules that use the I2C bus and no oscilloscope to check the signal. So i dont know if it’s an bus or module issue.

no answere from seedstudio support :frowning:


#14

Hi Roman,

The Gadgeteer codeplex (gadgeteer.codeplex.com) site has recently been updated with new drivers for a lot of the Seeed modules.

I believe Seeed will make module installers available directly from their product pages to make it easier for others to install in the future, without having to download and compile the source code.

However, if you would like to try these drivers straightaway you can get the sources from codeplex. They are under the \Modules\Seeed\ directory.

If you download the whole solution included in the \Software\ subsidrectory, you should be able to simply run the TestApp to quickly test the module. You can also build an installer for the driver by building the project under a Release configuration (you must have WiX 3.5 installed). This generates an installer (.msi). When you run the .msi, it installs the module in your designer toolbox.

You should uninstall any previous Seeed drivers to make sure you have the latest version.


#15

Thanks for the info Nicolas

I’ll try it but i think it will not work I tried to access the module without any driver direct via I2C bus and get no response. maybe I2C is not working on my spider.

I ordered an Logic Analyser yesterday I hope it arrives tomorow. This should help to find the problem


#16

Hi Roman2,
Would you care to share which Logic Analyzer did you Order? I’m interested in getting one soon.

thanks.


#17

I ordered a "SCANALOGIC-2"
costs 59 EUR in the shop http://ikalogicstore.com/

Or build your own http://www.ikalogic.com/scanalogic2/build.php hardware parts cost about 10-20 EUR and the Software is free.


#18

FYI I have been quite happy using the “open workbench logic sniffer” for several months ( http://www.seeedstudio.com/depot/open-workbench-logic-sniffer-p-612.html?cPath=174 ) which is 10 times faster as the ikalogic for 50USD, however the ikalogic is great because it can generate signals (wnd the owls can not). Similar protocol dissectors.


#19

If you are having trouble with the new modules, and you are using a FEZSpider, it is possible you are having an I2C problem. Run this quick test to see if I2C is fine on your board.

Assemblies required: Microsoft.SPOT.Hardware

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

namespace i2c_test
{
    public class Program
    {
        public static void Main()
        {
            InputPort I2C_SCL = new InputPort((Cpu.Pin)11, false, Port.ResistorMode.Disabled);
            InputPort I2C_SDA = new InputPort((Cpu.Pin)12, false, Port.ResistorMode.Disabled);
            bool bSCL = true;
            bool bSDA = true;

            if (I2C_SCL.Read())
            {
                bSCL = false;
            }
            if (I2C_SDA.Read())
            {
                bSDA = false;
            }

            if (!bSCL)
                Debug.Print("I2C_SCL works!");
            else
                Debug.Print("I2C_SCL maufunction");
            if (!bSDA)
                Debug.Print("I2C_SDA works!");
            else
                Debug.Print("I2C_SDA maufunction");
        }

    }
}


#20

Thanks for the test.

Now i give the new seeed drivers a Chance

UPDATE: New Drivers Looks better (code quality) but still not working :frowning: I have to wait for my logic analyzer