FEZ Hydra Pin mapping

Hi All,

Ive been playing with the following

 

Microsoft.SPOT.Hardware.Cpu.Pin pin = (Microsoft.SPOT.Hardware.Cpu.Pin)i;
OutputPort test = new OutputPort(pin, false);


now i wrote the code above in a loop so i could determine what pin number in code matched to which pin on my hydra.

Is there a mapping somewhere or am i missing something.

Like i determined that pin 2 in code = to pin 9 on socket 8 on my hydra?

Thanks in advanced.

John

Look at the Hydra schematics:

example

socket4 is X4
Pin 3 on X4 is PB2

PB2 is a member of the FEZHydra.Pin class so to use this pin

OutputPort test = new OutputPort(FEZHydra.Pin.PB2, false);

remember to add

using GHIElectronics.OSH.NETMF.Hardware;

Also, keep in mind that if you’re using the FEZ Hydra as a Gadgeteer board, you should avoid using tight loops for processing, since that will prevent any configured event handlers or timers from running:

http://blogs.msdn.com/b/net_gadgeteer/archive/2011/12/19/why-not-while-true.aspx

Thanks Rajesh,

All makes perfect sense :).

Thanks for the tip devhammer.

for anyone else looking at this here is the link to the schematic

http://www.ghielectronics.com/downloads/Gadgeteer/Mainboard/FEZ%20Hydra%20schematics.pdf

@ KartAssist - There’s no need to do all that anymore. Just use this…

var myPin = Socket.GetSocket(1, false, null, null).CpuPins[2];

To get the pin number of the #2 pin on socket #1. :slight_smile:

Ian,

Always get null back from that call??

if i set the second parameter to true it throws the invalid socket exception.

Cheers

John

What happens if you try to get the pins on Socket 2 with the second parameter set to true?

var myPin = Socket.GetSocket(2, true, null, null).CpuPins[2];

I’m curious if this is failing for all sockets or just Socket 1.

(edit: fix code to reflect socket 2)

@ Kerry - he said he gets an invalid socket exception if he sets it to true.

@ KartAssist - I just pulled that example out of the air w/o testing it. Try some other combinations. Although that should work… Socket 1 on Hydra is a Z socket so it may be a little “special”. Try an X or Y socket.

@ ianlee: I wanted to see if he gets an InvalidSocketException on other sockets. I wonder if Socket 1 is special because it’s type Z (manufacturer specific).

If that call throws the same exception on other sockets, there’s a bug that I’ll want to investigate.

@ Kerry - Yea, you’ll notice I edited my comment with that same thought :wink: I’ve used that syntax w/ other sockets with no problems so I suspect it is the Z socket that’s giving fits.

Yeah socket 2 does the same thing, sorry I didn’t get back sooner, I thought I would have been emailed about responses but didn’t get them, guess I have to watch my own threads?

I was initially trying it on socket 7 and getting it as well

OK on investigation its probably my fault.

I was doing this from a standard Console app, so hadn’t been through the standard Gadgeteer startup


Mainboard = new GHIElectronics.Gadgeteer.FEZHydra();			

Program program = new Program();
program.InitializeModules();
program.ProgramStarted();

when i use the GetSocket call a Gadgeteer templated solution its ok.

Ah… That makes sense now. Glad you figured it out.