Main Site Documentation

G120HDRII and HUB AP5


#1

Having a little bit of a brain stump-er here trying to get this module to work with the user socket on the G120HDR. Basically i wired up the user socket to be an I type socket for the HUB.

Here is a picture of my wiring but basically it breaks down to this pin assignment that i have double and triple checked. And actually pulled from the current Fez Cobra Driver for 4.3.5.

pin 3 = P0_25
pin 6 = P1_0
pin 8 = P0_27 (SDA)
pin 9 = P0_28 (SCL)

Module is getting power from the user socket as the Led is lit.

Here is a very simple test program i threw together to replicate the problem



public class Program
    {
        public static void Main()
        {
            GT.Socket socket;

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(1);
            socket.SupportedTypes = new char[] { 'A', 'I', 'T', 'X' };
            socket.CpuPins[3] = G120.P0_25;
            socket.CpuPins[4] = Cpu.Pin.GPIO_NONE;
            socket.CpuPins[5] = Cpu.Pin.GPIO_NONE;
            socket.CpuPins[6] = G120.P1_0;
            socket.CpuPins[7] = Cpu.Pin.GPIO_NONE;
            socket.CpuPins[8] = G120.P0_27;
            socket.CpuPins[9] = G120.P0_28;
           
            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            HubAP5 hub = new HubAP5(1);

            new TestModule(hub.HubSocket1);
            
        }

    }

public class TestModule : Gadgeteer.Modules.Module
    {
        private Gadgeteer.Socket Socket { get; set; }

        private Gadgeteer.SocketInterfaces.InterruptInput Interrupt { get; set; }

        public TestModule(int socket)
            : base()
        {
            this.Socket = Gadgeteer.Socket.GetSocket(socket, true, this, "Test Module");

            Interrupt = Gadgeteer.SocketInterfaces.InterruptInputFactory.Create(this.Socket,
                                   Gadgeteer.Socket.Pin.Three,
                                   Gadgeteer.SocketInterfaces.GlitchFilterMode.On,
                                   Gadgeteer.SocketInterfaces.ResistorMode.Disabled,
                                   Gadgeteer.SocketInterfaces.InterruptMode.FallingEdge,
                                   null);

            
        }
    }


Now the issue is that i get a Native I2c Exception informing that the device may not be connected. When i try to create the first Interrupt. I have also tried creating Digital pins with no difference in outcome as it throws the same I2c exception.

Now ive gone over my wiring and the pin outs in the documentation multiple times so i have to rule that out as a cause of the problem.

My current project is a stock .net MF project.

I debugged into the ap5 using a pdb i built locally and the exception is coming from a write but i was able to verify the hub is getting the correct socket assignment in software.

No idea why I’m having so many problems with getting this module to work. I have a hub AP5 running in a g400 project on software i2c and it works fine controlling the touch on a cp7 touch screen. I converted it to software i2c driver for that project because of a clock stretching issue with the cp7 screen but i did have it working with native i2c first.

There must be some configuration setting i’m missing somewhere to cause the i2c to not initialize.

Here is the exact exception text:

Additional information: SoftwareI2C: Exception writing to device at address 32 - perhaps device is not responding or not plugged in.

Want to add that I’m running the latest .net micro framework and gadgeteer release.

Also:

In an attempt to be thorough

I grabbed the project here
https://www.ghielectronics.com/community/codeshare/entry/755#

I converted it to 4.3.5 and the latest gadgeteer assemblies and installed it so i could use the designer as i was worried i was missing config settings or initializations. I implemented a single I socket on the user socket and created a similar test project to the one above. And can repeat the exception. Also quadruple checked the wiring for shorts to other pins and that all checks out.

Added some pics of the beast it is going into when i get it to work. I’ll have it controlling an statefull rgb led button board along with a blackberry track ball mounted to the grip interfacing to my desktop through usb. I’ve kind of gotten sucked into building a set of custom flight sim gear lately.

I suppose the next thing on my shopping list will be a logic analyzer because i just don’t have the tools to track this much further. One thought would be missing pullups on the SDA and SCl lines but id expect the AP5 to have pull ups built in if it needed them. And also the manual mentions there being built in pullups on all of the gpio pins.


#2

@ CSharpie - My initial suggestion would be to remove all of the Gadgeteer things and try to use the basic NETMF I2C and interrupt objects to talk to the Hub AP5 yourself. The most up to date source for the hub can be found here: https://bitbucket.org/ghi_elect/gadgeteer/src/f4166debf799d741ac2ced860d2d2af82cf5698c/Modules/GHIElectronics/HubAP5/HubAP5_43/HubAP5_43.cs?at=master


#3

Thanks for your time John. I’ll attempt to modify the AP5 and IO60P16 drivers to accept the .net mf implementations of i2c bus and digital interrupt rather than a gadgeteer socket. If i can get the IO60P16 to successfully write and read then it would justify converting the rest of the driver over to a native mf implementation. Should be an interesting project for the weekend.


#4

Ok I think I found a possible cause to the problem.

The Fez cobra and also the g400 have hardware pull ups on the i2c lines per the schematics. Basically I think i need to bridge scl and sda on my g120hdr to the 3.3v line with 2.2k resistors.

I included a clip of the pull up on the fez cobra that is not present in the g120 hdr schematic. From a little bit of research it looks like gadgeteer modules never have built in pull ups on i2c lines but the main boards that support I type modules always have them built into the main board.

Since the G120HDR does not have any pre configured I sockets there are no built in hardware pull ups.


#5

Added pull up resistors to the sda and scl lines and it works now. Hopefully this can help someone else out when they try to wire up an I socket to the user socket on the g120hdr.


#6

Hey guys. I just wanted to update on my progress.

Here is a pic of the G120 mounted in my controller. I’ve still got a lot of wiring left but now that its mounted I’m having a much easier time wiring up the physical functions and then testing them. G120 and the hub have been working incredibly well along with the composite hid device usb client software I implemented on top of raw device. I took Johns advice and re wrote parts of the hub driver and I2C to use plain .net mf along with re implementing the driver for the ADS 1115 in C#.


#7

@ CSharpie - Looks like you have had photography lessons from @ Gary :smiley:

Looks like it’s coming along very nicely.


#8

@ Sprigo

Yeah my work space is a mess right now due to several weeks of continuous working whenever i get a spare moment. I kind of put it in the only spot i had available and snapped a quick shot. I’m much better with a soldering iron than a camera. :slight_smile:


#9

Consider yourself added to the “list”! :smiley: