Fez Cerberus - Can't configure PC1 as InputPort

Hi, not sure why this is happening but I can’t configure pin PC1 of my Fez Cerb as an Input Port, this is socket 3 pin 4 to be precise, all I get is error message in VS2012, according to the Fez Cerb schematic socket 3 pin 4 points to “PC1/ADC123_IN11”, I’ve no idea why it’s not working so any help would be great.

@ chillydk147 - I was able to create an InputPort on that pin without issue. Are you sure it isn’t reserved somewhere else in your program and are you sure your function is returning the correct pin number?

@ john - This is my method for get socket pin

public static Cpu.Pin GetSocketPin(int socket, int pin)
        {
            return GT.Socket.GetSocket(socket, false, null, null).CpuPins[pin];
        }


should be


```cs]Inputs = new InputPort[4][/code
1 Like

Make sure you leave the semi-colons on the end of the line though. @ BG almost led you astray, but I saved ya.

@ Brett - Gotta give the Padawan’s something to catch :wink:

@ Bill - Thanks Bill, I’ll test this once I solve another issue, all of a sudden I’m not seeing the “GHI NETMF Debug Interface” in device manager when I connect the Dev Boards USB cable, strange this has never happened before.

Tight loop?

Never heard that phrase before, il try and reboot once I get home, hopefully windows will reinstall the Ghi Usb driver once I plug the usb cable in

a tight loop is a loop that has no thread.sleep() that means the processor never gives the debugging thread any time to run. That means you never get to the point of showing a debugging interface to the PC. Usually caused by the last change you committed to the code :slight_smile:

@ ALL - Ok i managed to fix my USB issue with a simple reboot but I’m still running into this wierd error, if I declare Socket 3 Pin 4 as an input “i3” on its own or with 1 other input I get no error, but if I have 2 or more other inputs declared, I get the error, can someone please test this as it must be just my board, I’ve checked all my code and this Socket Pin is not used anywhere.

This Works

//var i1 = new InputPort(Utility.GetSocketPin(4, 9), true, Port.ResistorMode.PullUp);
var i2 = new InputPort(Utility.GetSocketPin(3, 7), true, Port.ResistorMode.PullUp);
var i3 = new InputPort(Utility.GetSocketPin(3, 4), true, Port.ResistorMode.PullUp); 

This does not Work

var i1 = new InputPort(Utility.GetSocketPin(4, 9), true, Port.ResistorMode.PullUp);
var i2 = new InputPort(Utility.GetSocketPin(3, 7), true, Port.ResistorMode.PullUp);
var i3 = new InputPort(Utility.GetSocketPin(3, 4), true, Port.ResistorMode.PullUp); 

What does Utility.GetSocketPin do?

Scrub that…read the first page… ::slight_smile:

NETMF uses interrupts when you enable glitch filter (second parameter is true).

Same number pins from different ports share an interrupt. (4,9) is PB1, (3,4) is PC1. These two pins share an interrupt. You can’t have them both with the glitch filter enabled.

3 Likes

@ Architect - Thanks, I think that solved it, seems to work fine now, I’ve no intention of using interrupts, my code is setup to periodically scan the inputs, so from what you’re saying, the “glitch filter” is specifically for interrupts and since I’m using polling then it’s safe to just set this parameter to “false”?

If you had read your PMs, it would have been solved yesterday.

@ Beac a Fuel - Sorry I’m still new to all this, I don’t see how anything from yesterday would have solved my issue

It is the other way around - interrupts are used as a way to implement “glitch filter” on an input pin.

@ Architect - Thanks, I’ll read up on this :slight_smile:

@ chillydk147 - You are welcome!