Alchitry Cu and Io Pulldown Resistors

Hey,
I’ve been trying to get the Io board to work with the Cu today. I’m using verilog and Icecube2 with the alchitry loader (not using the alchitry ide). I’m trying to set up a .pcf file for the IO and have all the LEDs working correctly but cant get the switches or buttons to work. I believe this is because I need to set the inputs to have pull down resistors, as per the schematic, however I cant find any documentation of the iCE40-HX8K that suggests it has pull down resistors available on its inputs. In the icecube2 pin constraints editor only pull up resistors are available, and they havent helped in my scenario. When I have the pullup enabled, I just get a constant high logic level from that pin, and when the pullup isnt enabled it has erratic behaviour and will turn on or change state when i touch the button’s casing, without actually depressing the button.

If someone knows what im missing to get it to work that would be much appreciated.

Thanks,
George

Well this is embarrassing… This is an oversight on the IO element and it should have built in pulldowns. These will be added in the next batch.

However, it isn’t too big of a deal as you can simulate pull down resistors by pulling the pins low every once in a while between reads.

Here’s the module we’re including in the IO Demo project for the Cu.

[code]module pull_down #(
SIZE = 1 : SIZE > 0
)(
input clk, // clock
inout in[SIZE],
output out[SIZE]
) {

.clk(clk) {
dff flip[4];
dff saved[SIZE];
}

always {
flip.d = flip.q + 1;
in.write = 0;
in.enable = SIZEx{flip.q == 0};
if (flip.q > 2)
saved.d = in.read;
out = saved.q;
}
}[/code]

To be clear, it should have a large pulldown resistor BEFORE the switch (next to the pin) and the switch should have a small resistor to prevent accidental short-circuit. For example 1MOhm pulldown, 10k Ohm pullup.
___/ __10k+VCC
/
pin -----|
1M
|
GND

I purchased the IO board to prevent myself from needing to do manual IO. Needing to do my own voltage draining is a bit beyond my newbie-ness at the moment.

Yeah this was fixed in the latest batch of Io elements but I don’t know if SparkFun is shipping those yet.