Alchitry Forums
Alchitry Cu and Io Pulldown Resistors - Printable Version

+- Alchitry Forums (https://forum.alchitry.com)
+-- Forum: Alchitry (https://forum.alchitry.com/forum-1.html)
+--- Forum: General Questions (https://forum.alchitry.com/forum-2.html)
+--- Thread: Alchitry Cu and Io Pulldown Resistors (/thread-6.html)



Alchitry Cu and Io Pulldown Resistors - Geo747 - 02-26-2019

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


RE: Alchitry Cu and Io Pulldown Resistors - alchitry - 02-28-2019

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;
 }
}