Hydra and custom sockets

Hi

I’m new to Gadgeteer, my previous experience has been with Fez Rhino and so I’ve been reading up on the standard socket types etc.

In particular we need to support 16 analog inputs using a Fez Hydra and so we are planning to use the following analog mux.

http://www.sparkfun.com/products/9056

Now looking at the socket types at:

Will we be able to use socket 14 (Type A Y) on the Hydra and in code be able to set the pins on socket 14 such that we can use:

Pin 5 - Analog input
Pins 6,7,8,9 mux channel selector

Cheers

Yes. Use an extender module.

We are planning on having an analog input module. The analog sockets are best to be utilized to plug in modules but then you can add an “analog module” to read external signals.

You can built that module yourself as well.

[quote]the answer is no.

A sockets only have three pins to use as an output if you are using one as an analog input.
[/quote]

Yes pins 7,8,9 are marked as unconnected for socket A, but pin 6 is marked as GPIO for socket A so surely I could use all 4 pins (6,7,8,9) as digital output pins to drive the channel selection on the mux?

hmmm.

I had originally said no, but then changed my post.

socket 14 is also a Y socket which is all GPIO. The best way to answer your question is to look at the schematic. you would see that all the pins of socket 14 are connected to something.

No need for schematics. Socket Y has all 7digital pins and socket X has 3 digital.

Please review the socket map on support page.

Yes I was basing my assumption of using pins 6,7,8,9 based on the Y socket type that is listed plus the fact that pin 6 is marked as GPIO for the A socket type.

So I should be able to use the following code in my app?


GT.Socket socket = GT.Socket.GetSocket(14, true, null, null);

GT.Interfaces.DigitalOutput muxSelectionBit0 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Six, false, null);
GT.Interfaces.DigitalOutput muxSelectionBit1 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Seven, false, null);
GT.Interfaces.DigitalOutput muxSelectionBit2 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Eight, false, null);
GT.Interfaces.DigitalOutput muxSelectionBit3 = new GT.Interfaces.DigitalOutput(socket, GT.Socket.Pin.Nine, false, null);

GTInterfaces.AnalogInput analogIn = new GT.Interfaces.AnalogInput(socket, GT.Socket.Pin.Five, null);


Is there any way to write to all 4 digital outputs simultaneously to set the mux channel selection as opposed to writing to each output individually one after the other?

Cheers

Not simultaneously.

We would to see your circuit and drivers if you can share with community.

The circuit is very simple.

So ideally I’d like to set the 4 digital outputs to the analog mux chip simultaneously then read the analog input from the muxh chip.

I guess if we can’t the other option is to use another digital output to control the Enable line of the mux or just not worry about the 4 bits of channel selection being set serially before we read the analog input.

Cheers

disclaimer: I don’t know much about Gadgeteer.

What I think Gus is saying is that if you use a gadgeteer socket for one “device type” then you can’t reuse that socket for any other purpose. So you can’t “borrow” the unassigned/unused pins in that socket for some other purpose.

In this case, what you would need to do is create a “combination driver” that allows you to use both the AnalogIn pin and the digital IO pins.

I guess you could also step out of the Gadgeteer world and back into netmf and use the pins - again, take all this with a grain of salt until someone else who knows more comes along and contradicts or confirms :slight_smile:

I assume Gus’s comment about “not simultaneously” was in reference to my question on whether it was possible to get the CPU to set the state of a bunch of digital output lines, in this case the 4 lines making up the mux channel selection, simultaneously or whether you could only set the state of the digital output lines in a serial fashion.

Yeah, you’re correct in hindsight. But serially is “almost together” and “within the tolerance of most applications”

Parallel signals are never simultaneous. If you change the state of 4 data lines at once there will always be slight timing differences in the time the signal arrives at the other end, and slight timing differences in detecting the the signals on all four inputs at the other end. This is why when you look at a parallel bus you will always find other control lines being used. Generally you set the data lines to the correct state wait for a short time period (settling time), then you toggle the state of a control line which tells the other end it is safe to read the data bus.