Main Site Documentation

i2C cerbuino bee


#1

Hello all,
I need help to program my Cerbuino bee with GPS (DS-GPMS) I2C, I connected it with Module Extender on the socket 2. I can not take values like time or gps coordinate. Please help me. I attach link to download the manufacturer doc of this gps.

http://www.designersystems.co.uk/Technical%20data%20on%20DS-GPM.S%20Global%20Positioning%20System%20Shield.pdf

Thank you.


#2

Hi Jenba, welcome to the forum

Do you know if you have been able to read any information or set any information to the device? Have you checked you’re using the correct pins on the I socket for the I2C pins? And have you checked that you have the correct I2C address for the device (as I2C addresses are strictly 7-bit addresses for netmf, see the I2C page https://www.ghielectronics.com/docs/12/i2c ). From the PDF I expect that the I2C address is your problem, since the PDF you link to shows an 8-bit address on page 3 - the address looks like it should be 0b11010xx where xx depends on your address setting, and assuming that’s “00” you end up with 0x68 as your address… what did you use?


#3

Here is the code that I did, but I can not read the variable like time, or coordinate GPS.
For this moment when i start my program, i see the variable 240/31/255/255/255/…/255.

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.Presentation.Shapes;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using GHI.Hardware.FEZCerb;
using Gadgeteer.Modules.GHIElectronics;

namespace GPSI2C
{
public partial class Program
{

    // Declaring an object I2C BUS
    GT.Interfaces.I2CBus I2CGPS;


    // read buffer gps register
    byte[] readBuffer = new byte[13] ;

    // This method is run when the mainboard is powered up or reset.   
    void ProgramStarted()
    {


        // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
        Debug.Print("Program Started");

        // Statement and creating a socket object that defines the connector used 2
        GT.Socket socket = GT.Socket.GetSocket(2, true, null, null);

        // Creating GPS I2C object whose address is 0x68
        I2CGPS = new GT.Interfaces.I2CBus(socket, 0x68, 400, null);

        GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
        timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
        timer.Start();

        Thread.Sleep(500);

    }

    void timer_Tick(GT.Timer timer)
    {
        //throw new NotImplementedException();

        // Measurement request
        I2CGPS.Write(new byte[1] { 0 }, 100);

        Thread.Sleep(60);

        // read 12 bytes 
        I2CGPS.Read(readBuffer, 100);

        Debug.Print(readBuffer[0].ToString() + "/" + readBuffer[1] + "/" + readBuffer[2] + "/" + readBuffer[3] + "/" + readBuffer[4] + "/" + readBuffer[5] + "/" + readBuffer[6]
            + "/" + readBuffer[7] + "/" + readBuffer[8] + "/" + readBuffer[9] + "/" + readBuffer[10] + "/" + readBuffer[11] + "/" + readBuffer[12]);


    }

}

}