Project - G120HDR Gadgeteer Mainboard

@ andre.m -
socket c type means customer mode? Where can I specify it to the pins and how?
could you give an example? better with pictures. Thanks a lot!!!

@ andre.m -
to be honest, I don’t really understand this…do I need to write any program in C# to define the pins of sockets?

@ andre.m -
OK!
Thank you!!!

@ andre.m -
sorry for disturbing you again!
but, where can I define the connections between socket pins and cpu pins?
I mean it is done in C# or I should use cables to solder them together physically?
if it is done in C#, could you show me a picture, thank you!
I know this is a stupid question >_<

@ andre.m -
Yes, I have downloaded and installed this driver. After I make some modification I have to install it again right?

It seems very difficult for me to do that!!
I will try, thanks a lot!

@ andre.m -
You really help me a lot!!
May I ask you one more, according to socket C definition: its pin 3 is GPIO! and pin 6 is GPIO. I don’t know what to do with them, the following is my code and the error appears as " Socket 4 does not support type ‘C’ required by CAN_DW module."

  #region Socket 4

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(4);
            socket.SupportedTypes = new[] {'Z'};
            socket.CpuPins[3] = Pin.GPIO_NONE;
            socket.CpuPins[4] = Pin.P0_1;
            socket.CpuPins[5] = Pin.P0_0;
            socket.CpuPins[6] = Pin.GPIO_NONE;
            socket.CpuPins[7] = Pin.GPIO_NONE;
            socket.CpuPins[8] = Pin.GPIO_NONE;
            socket.CpuPins[9] = Pin.GPIO_NONE;

You need to look at this line:
socket.SupportedTypes = new[] {‘Z’};

It needs to include C as a valid socket.

@ Brett -
I changed Z to C. But, this error still exists…

@ andre.m -
I think so~~~maybe

@ andre.m -
this is the figure shows the connection
and my codes of sockets are following:

 #region Socket 4

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(4);
            socket.SupportedTypes = new[] {'C'};
            socket.CpuPins[3] = Pin.GPIO_NONE;
            socket.CpuPins[4] = Pin.P0_1;
            socket.CpuPins[5] = Pin.P0_0;
            socket.CpuPins[6] = Pin.GPIO_NONE;
            socket.CpuPins[7] = Pin.GPIO_NONE;
            socket.CpuPins[8] = Pin.GPIO_NONE;
            socket.CpuPins[9] = Pin.GPIO_NONE;

            //// A
            //GT.Socket.SocketInterfaces.SetAnalogInputFactors(socket, 3.3, 0, 12);
            //socket.AnalogInput3 = Cpu.AnalogChannel.ANALOG_2;
            //socket.AnalogInput4 = Cpu.AnalogChannel.ANALOG_1;
            //socket.AnalogInput5 = Cpu.AnalogChannel.ANALOG_0;

            //// I
            //// N/A

            //// T
            //// N/A

            //// X
            //socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            #endregion Socket 4

            #region Socket 5

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(5);
            socket.SupportedTypes = new[] {'D'};
            socket.CpuPins[3] = Pin.GPIO_NONE;
            socket.CpuPins[4] = (Cpu.Pin) 14; // USB_A_N
            socket.CpuPins[5] = (Cpu.Pin) 31; // USB_A_P        
            socket.CpuPins[6] = Pin.GPIO_NONE;
            socket.CpuPins[7] = Pin.GPIO_NONE;
            socket.CpuPins[8] = Pin.GPIO_NONE;
            socket.CpuPins[9] = Pin.GPIO_NONE;

            //// U
            //socket.SerialPortName = "COM1";

            //// X
            //socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            #endregion Socket 5

            #region Socket 6

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(6);
            socket.SupportedTypes = new[] {'C'};
            socket.CpuPins[3] = Pin.GPIO_NONE;
            socket.CpuPins[4] = Pin.P0_5;
            socket.CpuPins[5] = Pin.P0_4;
            socket.CpuPins[6] = Pin.GPIO_NONE;
            socket.CpuPins[7] = Pin.GPIO_NONE;
            socket.CpuPins[8] = Pin.GPIO_NONE;
            socket.CpuPins[9] = Pin.GPIO_NONE;

            // S
            socket.SPIModule = SPI.SPI_module.SPI2;

            // X
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            #endregion Socket 6

            #endregion Socket Setup

@ andre.m -
it appears error:
Socket 4 does not support type ‘C’ required by CAN_DW module.

@ andre.m -
I delete the CAN module which connected to socket 4, then it appears the error:
Socket 6 does not support type ‘C’ required by CAN_DW module.

I am going to cry!!!

@ andre.m -
sure! Both are in .NET Micro Framework 4.2
Does it mean that G120 does not support CAN ??

@ andre.m -
you are so kind!!
here it is:

namespace GadgeteerApp2 {
    using Gadgeteer;
    using GTM = Gadgeteer.Modules;
    
    
    public partial class Program : Gadgeteer.Program {
        
        /// <summary>The Display TE35 module using sockets 3, 2 and 1 of the mainboard.</summary>
        private Gadgeteer.Modules.GHIElectronics.Display_TE35 display_TE35;
        
        /// <summary>The CAN_DW (Premium) module using socket 4 of the mainboard.</summary>
        private Gadgeteer.Modules.GHIElectronics.CAN_DW can_dw;
        
        /// <summary>The CAN_DW (Premium) module using socket 6 of the mainboard.</summary>
        private Gadgeteer.Modules.GHIElectronics.CAN_DW can_dw2;
        
        /// <summary>This property provides access to the Mainboard API. This is normally not necessary for an end user program.</summary>
        protected new static MCormier.Gadgeteer.G120HDR Mainboard {
            get {
                return ((MCormier.Gadgeteer.G120HDR)(Gadgeteer.Program.Mainboard));
            }
            set {
                Gadgeteer.Program.Mainboard = value;
            }
        }
        
        /// <summary>This method runs automatically when the device is powered, and calls ProgramStarted.</summary>
        public static void Main() {
            // Important to initialize the Mainboard first
            Program.Mainboard = new MCormier.Gadgeteer.G120HDR();
            Program p = new Program();
            p.InitializeModules();
            p.ProgramStarted();
            // Starts Dispatcher
            p.Run();
        }
        
        private void InitializeModules() {
            this.display_TE35 = new GTM.GHIElectronics.Display_TE35(3, 2, 1, Socket.Unused);
            this.can_dw = new GTM.GHIElectronics.CAN_DW(4);
            this.can_dw2 = new GTM.GHIElectronics.CAN_DW(6);
        }
    }
}

@ andre.m -
OMG!!!
SO stupid I am!!!
What a shame!!!
Forgive me. I just learned it for one week~~~ and I am an automotive engineer. This is my first time to do something related to electronics…
Anyway, thank you very much for your help!!!

hi,
first-
@ MikeCormier- thanks!

just to now I used only the G120HDR_42 as was explained in the forum,

but now I want to use the whole solution and create my own installer-
I tried to open the solution, but the

G120HDR.csproj

doesn’t load me in VS,
get an error:

 error  : Unable to read the project file 'G120HDR.csproj'. 
 The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\Wix.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

how can I repair this issue ?
(I, truly, don’t have the direction “…\Wix…”)

@ Chaya - you need to install Wix from MS to build the installer

@ Jusin- nice, it is, thanks!

back to my edited mainboard (add G120HDR_42 to my solution)-
I run the program- it works!!

but when I try to use socket number 5- don’t change from MikeCormier’s decleration -
I got exception:

trying change with your link-code bring the same error.

what you mean to “not used cpu pin”, decleare without physical connect?

more question I have- in G120HDR rev 2 there are a pins set to socket in right-bottom corner, if I want to use it- what G120.pin \ CPU.pin const i have to use

  • what with the SPI socket- that is what MikeCormier daclerd as socke nu. 6? or I need to declare as new, and again- with which pin’s const?

@ Chaya-
since it is not a true Gadgeteer board GHI only used the USB pins on the cpu instead of using all the Pins that a true D socket specifies. you dont need to add the dp or sp client in the designer and it will still work and you will not get an error.
socket 6 (SPI) works fine for me you can use the same pins in my solution for it or look up the pins on the schematic provided by GHI on the catalog page for the G120HDR.