Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Cyclone IV + Reading from DIP Switches

Status
Not open for further replies.

flote21

Advanced Member level 1
Joined
Jan 22, 2014
Messages
411
Helped
1
Reputation
2
Reaction score
3
Trophy points
1,298
Activity points
5,595
Hello,

I am having some problems to read the '0' logic values from the DIP Swithches with an ALTERA Cyclone IV FPGA. I always read '1' logic whatever position is configured in the switches

DIP Switches are connected in this way, When they are ON, both sides of the SW are connected to VDD throughr a resistor. Therefore the FPGA read "VDD".
And when they are OFF, the pin of the FPGA is open circuit. I mean there is not any connection to ground through the SW. Simply, the DIP SW open the circuit and leave the FPGA pin without any connection...I measured in the pon of the FPGA and I got 20mV. In theory this should be read like a '0' logic, right? What could be the problem?

Is there any special constraint that I have to add to my pin assgnments file?

Note: I've also tried to connect manually the PIN of the FPGA to GND and then the FPGA read '0'.

Thanks a lot!
 

Try adding a pulldown on the pin in the constraint file. It looks like your pin is floating. When you probe the pin you read ~0V because your multimeter load the pin and acts as a pulldown.
 

When the input is floating, what's the voltage there? 0? VDD? You don't know, and neither does your FPGA. The correct way to have done this was to have a pull-down resistor connected to one side of the switch and the FPGA pin, and the other side of the switch connected to VDD. That way, when the switch is open, the input is pulled low, and when the switch is closed, it's pulled high.

But since you DIDN'T do it that way, you'll need to add a pull-down. I haven't used the Cyclone IV, but most FPGAs have the capability of enabling an internal pull-down. That should solve your problem.
 

thanks a lot of for your quick answer.

But I still have the problem because I am not able to set up programmable pull down resistors in ALTERA FPGA. I also was reserching in internet and I found this:

http://www.altera.info/support/kdb/solutions/rd12282007_465.html

Is there any trick or tip to solve this problem via firmware? Or Would I have to modifiy my HW. design?

Thanks,
 

Cyclone IV supports pull-UPs. If you can reconfigure your dipswitch to switch to ground rather than VDD, that would work.
 
Cyclone IV supports pull-UPs. If you can reconfigure your dipswitch to switch to ground rather than VDD, that would work.
Unless Cyclone IV is radically different than Xilinx parts and Stratix parts those pullups are probably something like 50K-100K ohms. Not a very strong pullup. It's best to have a pullup on the pin that gives disapates 1mA when shorted to ground by the switch.
Capture.PNG
 

Ok I made some HW modifications and it works. Cyclone IV has nor the possibility to programm pull down resistors, so I had to remove the resistor from the DIP switches and connecting to ground. Then I programmed internal weak pull up resistors and it looks to work fine.

Thanks for your help!!


Unless Cyclone IV is radically different than Xilinx parts and Stratix parts those pullups are probably something like 50K-100K ohms. Not a very strong pullup. It's best to have a pullup on the pin that gives disapates 1mA when shorted to ground by the switch.
View attachment 106219
 

Then I programmed internal weak pull up resistors and it looks to work fine.

My ee-friend once told me ,as mentioned above.

In order to make the button contacts "self cleaning" , make sure ~2ma runs through them , then the current vil prevent oxidation.

If this is a "text" , don't bother.

But if it's a production ..

/Bingo
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top