Project - G120HDR Gadgeteer Mainboard

I saw your declaered about socket 6- but it isn’t so clear me-

socket.CpuPins[7] = (Cpu.Pin) 9; //P0.9

-which pin in G120HDR you physical connect to?

and more- you have the ready socket which GHi already built us, why don’t use it?, I didn’t know what its pins’ names?
(that is what I already have asked-
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?)

thanks

@ Chaya
The pins that are wired to socket 6(SPI) are

socket.CpuPins[3] = Pin.P0_5;
            socket.CpuPins[4] = Pin.P1_14;
            socket.CpuPins[5] = Pin.P1_16;
            socket.CpuPins[6] = Pin.P1_17;
            socket.CpuPins[7] = (Cpu.Pin) 9; //P0.9
            socket.CpuPins[8] = (Cpu.Pin) 8; //P0.8
            socket.CpuPins[9] = (Cpu.Pin) 7; //P0.7

they are used

socket 5 (usb) is wired as

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;

so pins 3 and 6to 9 have no physical connection so that is why it gives errors about socket 5.

socket 4 (user) has no cpu pins prewired. you can specify any pins you want to use on that socket and wire it up manually

hi, took a look again to the schematic and understand what you talked about.
Does it says that if I want 2 sockets of SPI- use one with the built socket and one with the pins, I couldn’t?

and what do you mean “any pins”, I want to suit the pins of those sockets, but wahat is thheir names in G120?

“any pins” means that you are free to wire up whatever pins you have not in use, it’s your decision. There’s no pre-defined pins, you have to pick which ones you’re going to connect, and then you’ll need to amend your mainboard definition appropriately to match that.

right, that’s what I want to know- I want to connect to the socket what I attached a picture, which pins I have to declare about?

and what about 2 sockets for SPI?

Forgot to explain about SPI.

SPI is a bus, it’s intended to be “shared”, except for the Chip Select (CS) pin. For CS, you must have a unique CS pin for each attached SPI device. So you can re-use the MOSI MISO and SCK pins, and just choose a different pin for your CS.

Well, what you need to declare totally depends on what you have physically wired there!

Perhaps let me explain everything in this way for you. The mainboard definition is the logical mapping of a physical hardware solution into something that Gadgeteer designer can use. In most mainboards, the mapping between physical hardware sockets and individual pins is known and understood by the manufacturer, because they physically create the mainboard.

The user socket on the G120HDR https://www.ghielectronics.com/catalog/product/431 allows a USER to connect what pins they want to the Gadgeteer socket. By doing so, you can create pretty much whatever kind of socket you want (see socket definitions at https://www.ghielectronics.com/docs/120/gadgeteer-sockets ). But to do that means you have to physically wire up a connection from the pins header on the board to the header next to the USER socket. Then once youve physically done that, you can logically update the Gadgeteer board definition you use as you need.

Does that help understand? You pick the pins you want, then you wire them up to the correct place on the header next to the USER socket, then you define your mainboard, then you can use the socket as that type in the designer…

don’t sure I understood…

can I give code example?

I have another question, maybe i can answer it also by the code example- that would be great!-

I need interuptable pin in G120, but as my trying- there is no suit pin for that, can you decalre for me the User socke for interupable-pins?

thanks!

hi,
thank you all. found out what wasn’t clear.
hope now it will be OK :slight_smile:

@ Chaya
great good luck

Updated to R3 sdk

hi,
after using and changing the code-

I want to possible serial mode in debugging.

I found out in
https://www.ghielectronics.com/docs/38/g120hdr-developer

that pin 2.1 is responsible about, and for serial mode it need to be low
and found in @ MikeCormier code this deceleration:

public override void SetProgrammingMode(ProgrammingInterface programmingInterface)
        {
           // Change the reflashing interface to the one specified, if possible.
            // This is an advanced API that we don't expect people to call much.
        }

if I understand right - when i write to pin 2.1 this function is called?

for possible this option- I have to change the implementation here?
if not- what should be the issue- I don’t success to transform mode

Chaya,
short p2.1 to ground on bootup an it will be in serial debug

hi,
thanks, it help- I can use with the USB device as Kb emulator (what I needed),
but it doesn’t recognize in FEZ config tool :frowning:

my another problem-
I want to connect SD card and USB host to my G120,
I declared them, but they both don’t recognize device connected to the module.
in the SD card it more strange- the property of "Device connected’ is true, but “Get storage device” return null.

what should be the problem?

attached the deceleration of the relevant sockets:

 #region Socket 3

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(3);
            socket.SupportedTypes = new[] /*{'Z'};*/{'H'};
            socket.CpuPins[3] = /*G120.Pin.GPIO_NONE;/*/G120.Pin.P2_8;
            socket.CpuPins[4] = /*G120.Pin.GPIO_NONE;/*/(Cpu.Pin)G120HDR_AnalogOut.SpecialPurposePin.USBH_DM;
            socket.CpuPins[5] = /*G120.Pin.GPIO_NONE;/*/(Cpu.Pin)G120HDR_AnalogOut.SpecialPurposePin.USBH_DP;
            socket.CpuPins[6] = G120.Pin.GPIO_NONE;
            socket.CpuPins[7] = G120.Pin.GPIO_NONE;
            socket.CpuPins[8] = G120.Pin.GPIO_NONE;
            socket.CpuPins[9] = G120.Pin.GPIO_NONE;

            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            #endregion Socket 3

            #region Socket 4

            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(4);
            socket.SupportedTypes = new[] {'Y','U','K'};
            socket.CpuPins[3] = G120.Pin.P0_15;
            socket.CpuPins[4] = G120.Pin.P2_0;
            socket.CpuPins[5] = G120.Pin.P0_16;
            socket.CpuPins[6] = G120.Pin.P0_6;
            socket.CpuPins[7] = G120.Pin.P0_17;
            socket.CpuPins[8] = G120.Pin.P0_18;
            socket.CpuPins[9] = G120.Pin.P0_22;

            //Y
            socket.NativeI2CWriteRead = nativeI2C;

            //U\K
            socket.SerialPortName = "COM2";

            
            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            #endregion Socket 4

            #region Socket 5
            socket = GT.Socket.SocketInterfaces.CreateNumberedSocket(5);
            socket.SupportedTypes = new[] { 'F', 'Y' };
            socket.CpuPins[3] = G120.Pin.P0_4;
            socket.CpuPins[4] = G120.Pin.P1_6;
            socket.CpuPins[5] = G120.Pin.P1_7;
            socket.CpuPins[6] = G120.Pin.P1_3;
            socket.CpuPins[7] = G120.Pin.P1_11;
            socket.CpuPins[8] = G120.Pin.P1_12;
            socket.CpuPins[9] = G120.Pin.P1_2;

          
            // Y
            socket.NativeI2CWriteRead = nativeI2C;

            GT.Socket.SocketInterfaces.RegisterSocket(socket);

            #endregion Socket 5

about ‘F’ socket- is as from Devloper Guide,
about ‘H’ don’t sure I declared right.

@ MikeCormier - Hello, I use since more months your G120HDR mainboard template downloaded from CodeShare with MF4.2 and GHI software “NETMF and Gadgeteer Package 2014 R1”.

Now, I have migrate on the MF4.3 and the last GHI release “NETMF and Gadgeteer Package 2014 R4”.
I have installed the G120HDR driver but I can used it only with MF 4.2.
I have try to modify the solution to have by default MF4.3 version but without success (more compilation errors).
Have you planned an update for the MF4.3 and the last GHI release ?

Best regards
Christian

I was just going through that same process as ChristianJack, and I am running into all kinds of errors as well. @ MikeCormier - Thanks for your initial work, I am sorry to have to ask you for help as well. I prefer to get these things resolved on my own. But after so many hours I have to throw in the towel.

i’ll take a look at it tomorrow guys. my computer is at work.

@ jgtech and @ ChristianJack

Updated the project
https://www.ghielectronics.com/community/codeshare/entry/755

@ MikeCormier - Thanks you for the update.
I have looked the change in your code for MF4.3 . This is much better than what I tried to do but I have the same problem when I use the template in a project.

I have uninstall previous G120HDR mainboard and installed your new mainboard template.
When I create a MF4.2 project with a G120HDR and a Wifi RS21 module all is correct but when I create a MF4.3 project with a G120HDR and a Wifi RS21 module I have an error “GHI Networking could not be found”.

I have try to create a MF4.3 project with a G400HDR and a Wifi RS21 module I have not this error.

@ jgtech and @ ChristianJack

Updated the project
https://www.ghielectronics.com/community/codeshare/entry/755

Only includes 4.3 now if you need 4.2 download the previous download
uninstall any previous versions to use this one as i had to redo this from scratch.