Module Issue -

I have created my own module which I have connected to port 11 on my Hydra; Port 2 has the USB Client and there are no other modules connected physically or in the software. I created a driver using Pete Brown’s blog post and the Module Builder’s guide as a reference. I get this error when I try to debug my test program on my board:

"An unhandled exception of type ‘Gadgeteer.Socket.PinConflictException’ occurred in Gadgeteer.dll

Additional information:
Unable to configure the _7relayoutput module using socket 11 (pin 3). There is a conflict with the _7relayoutput module using socket 11 (pin 3). Please try using a different combination of sockets."

Just to gain more insight, I commented out the references to pin 3 in the driver and installed the new version. I got the exact same error message now referencing pin 4. The Module Builder’s guide mentioned something about reserving pins on page 12. Any suggestions? It’s my first module so I’m sure I’ve just skipped/missed a step somewhere along the line.

hey there Jermtown, and welcome to the forum ! Talk about jumping right in, first post and you’re doing your own module and driver !

It’s probably going to help telling us about the module and it’s pin requirements. I suspect you’re using this post from Pete:

ok just to expand on the blog post.

        public DerBlinkenLed(int socketNumber)
            _socket = Socket.GetSocket(socketNumber, true, this, null);
            // For the LED, we'll use a digital output on
            // pin 3 of the specified socket
            _output = new DigitalOutput(_socket, Socket.Pin.Three, false, this);

This is the constructor, and it’s saying to reserve a Digital IO port for output on pin 3 of the connected socket. Socket 11 on Hydra is a GY socket, right? The most likely cause of this then would be that you have a LCD using the G port.

Can you confirm what version of the GHI SDK you installed?

Thanks for the reply Brett, yeah I’ve been able to gleen everything I needed from other forum topics or documentation so far. My module is a 7 output module that drives some transistors which drive 10A relays…so 7 10A relay output from a Y socket. Here’s a big chunk of my current code. I’ve tried this with my output# variables static and no designation, these changes caused no different results.

public _7relayoutput(int socketNumber)

           GT.Socket _socket = Socket.GetSocket(socketNumber, true, this, null);

            this.output1 = new GTI.DigitalOutput(_socket, GT.Socket.Pin.Three, false, this);
            this.output2 = new DigitalOutput(_socket, Socket.Pin.Four, false,this);
            this.output3 = new DigitalOutput(_socket, Socket.Pin.Five, false,this);
            this.output4 = new DigitalOutput(_socket, Socket.Pin.Six, false,this);
            this.output5 = new DigitalOutput(_socket, Socket.Pin.Seven, false,this);
            this.output6 = new DigitalOutput(_socket, Socket.Pin.Eight, false,this);
            this.output7 = new DigitalOutput(_socket, Socket.Pin.Nine, false,this);
       private DigitalOutput output1;
       private DigitalOutput output2;
       private DigitalOutput output3;
       private DigitalOutput output4;
       private DigitalOutput output5;
       private DigitalOutput output6;
       private DigitalOutput output7;
        /// <summary>
        /// send this 0 or 1 to turn output1 on/off
        /// </summary>
        /// <param name="newState">The variable that determines relay state</param>
        public void Output1control(bool newState)
            //writes the passed state to output1 of the hardware

sorry, can’t edit that old post, messed up marking the code. :frowning:

Of course you can edit it :slight_smile: Just hit the pencil, get rid of your old text, highlight the actual code, then hit the 101010 button near the top of the message text then resubmit it :slight_smile:

So if you have a pin conflict, that usually means something else is reserving your pin. Now that doesn’t have to mean that it’s actually on the same socket; remember, some sockets can share pins. So can you try moving your module to a different socket and see if your problem goes away, that would mean you’re just using a duplicated pin. I don’t have the Hydra schematic open anymore, that might also give you a tip about where to try?

Thanks, never noticed the pencil before.

I moved the module to port 9 and added my USBClient module back into the code and I get the same error but on port2 with the USBClient. In the call stack it lists this line:

“Gadgeteer.dll!Gadgeteer.Socket.ReservePin(Gadgeteer.Socket.Pin pin, Gadgeteer.Modules.Module module) Line 457 + 0x4e bytes”

Did I accidentally reserve this pin somewhere? I don’t know how to edit this.

This is all of my test code:

namespace _7_Relay_Output_Test
    public partial class Program
        GTM.Odessei._7relayoutput relayout = new GTM.Odessei._7relayoutput(9);
        GTM.GHIElectronics.UsbClientDP usb = new GTM.GHIElectronics.UsbClientDP(2);
        bool _ledState;

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

            Debug.Print("Program Started");
            _ledState = !_ledState;
            Debug.Print("Variable =" + _ledState);

            // write the new value to the pin
            Debug.Print("Relay 1 should be:" + _ledState);
            //Debug.Print("Relay 2 should be:" + _ledState);


This is my GadgeteerHardware.XML code:

        <!-- This example socket is compatible with socket type Y which has electrical connections to pins 3 through 9 -->
        <Socket Left="10" Top="10" Orientation="0" ConstructorOrder="1" TypesLabel="Y">
           <Pin Shared="true">3</Pin>
            <Pin Shared="true">4</Pin>
            <Pin Shared="true">5</Pin>
            <Pin Shared="true">6</Pin>
            <Pin Shared="true">7</Pin>
            <Pin Shared="true">8</Pin>
            <Pin Shared="true">9</Pin>

Found the problem…I was initializing the modules in two places. Thanks for help Brett!

Got the module and driver working! Thanks for your help Brett!

Great news !

Remember, if you manually add a line like:

       GTM.Odessei._7relayoutput relayout = new GTM.Odessei._7relayoutput(9);

then you don’t add it in designer. If you add it in designer, that gets added in the generated code without you doing anything.