Forum Discussion
GPIO Pin Problems
Hi all, I am attempting to interface an ultrasonic range sensor with the DE2 board through the GPIO expansion header. The device has 4 connections, 5v vcc, ground, trigger, and echo. The 5v and ground have been attached to the appropriate power supply pins as indicated in the manual and I'm trying to connect the trigger and echo to a couple of the other pins - say GPIO[0] AND GPIO[1]. The project at this point is being built from scratch rather than coded in VHDL or Verilog, to our detriment, as we are still barely scratching the surface of using the languages. I have build circuitry that should function properly but I'm hitting a roadblock when it comes to actually getting input and output through the pins for some reason. Right now I have a basic test project trying to resolve the issue - please see attached image.
Problem# 1: With the .qsf file we have at the school the GPIO pin assignments are completely missing! Unless they are renamed something other than what's in the manual. That same .qsf file has been working fine all year. I went to altera support to try downloading a newer version but the link doesn't seem to be working properly in edge browser or firefox. Problem# 2: When I try using the 14 pin general purpose IO connector instead it seems to make the assignments, because at least they exist in the .qsf file, but when I compile and program the board the results are way off base. The pin EX_IO[0] doesn't respond at all to SW[0] being toggled - a voltmeter measures no change between the pin and ground. Then pin EX_IO[1], which was supposed to light up LEDR[0] when a voltage was detected is outputting a steady 3.3v even though assigned as an input pin, and LEDR[0] is lit up constantly. Also, segment 1 of HEX2 display is lit up for no discernible reason. I'm coming to the unfortunate conclusion that I have no idea what I'm doing when it comes to using these IO pins and would greatly appreciate any help for this new user. Please assume I know nothing and point me in the right direction. I'm comfortable with a lot of the concepts of digital logic design and I'm comfortable doing research if maybe someone could help me find the right search terms to use. I've been attempting to research this for two days without any breakthroughs. Thanks in advance for any help. Using: Quartus Prime Lite Windows 10 64 bit DE2 board: EP4CE115F29C7N23 Replies
- Altera_Forum
Honored Contributor
Hi Digitalsolace, Do you have (project_name).qsf.bak file in you directory of the working project? if so, You can import and use IT. Download the resources website. OR go to schematic and find the pin. Best Regards, Anand Raj Shankar (This message was posted on behalf of Intel Corporation) - Altera_Forum
Honored Contributor
Thanks for the helpful suggestion. The problem I was having was that the GPIO pins did not show up as assignable in the .qsf file I had. I made some progress tonight by way of the system builder utility that came on the CD. In the utility I found a way to enable to GPIO header and generate a .qsf file. In the project I can now see those pins in the assignment editor, however for some reason quartus is still now letting me assign those pins to input and output. When I build the simple test project I had attached earlier, even with the input and output named as the GPIO[0] and GPIO[1] pins it still fails to assign and the result is broken programming on the DE2 that doesn't work. Any idea what I'm missing here? Why is the program still not allowing the assignment? Is there something else I have to configure?
- Altera_Forum
Honored Contributor
Hi
Can you share the pin planner window screen short? Best Regards, Anand Raj Shankar (This message was posted on behalf of Intel Corporation) - Altera_Forum
Honored Contributor
Hi Digitalsolace,
1.Write a simple logic and connect it to the pin required and check(switch to header). 2.Re-create the project and check. Best Regards, Anand Raj Shankar (This message was posted on behalf of Intel Corporation) - Altera_Forum
Honored Contributor
Hi Digitalsolace,
Have you assigned pins for both the signal? Take care of following I think the issue could be that IOs from a Bank can only be configured as either input or output, aka, If he's using BANK0, and configuring GPIO0 as input, it may not be possible to assign GPIO1 as output. He may need to assign another BANK pin as output. Here's the Altera QSF file for that board. ftp://ftp.altera.com/up/pub/intel_material/boards/de2-115/de2_115.qsf Best Regards, Anand Raj Shankar (This message was posted on behalf of Intel Corporation) - Altera_Forum
Honored Contributor
Hi Digitalsolace,
Have you assigned pins for both the signal. Take care of following I think the issue could be that IOs from a Bank can only be configured as either input or output, aka, If he's using BANK0, and configuring GPIO0 as input, it may not be possible to assign GPIO1 as output. He may need to assign another BANK pin as output. OR Here's the Altera QSF file for that board. ftp://ftp.altera.com/up/pub/intel_material/boards/de2-115/de2_115.qsf Best Regards, Anand Raj Shankar (This message was posted on behalf of Intel Corporation) - Altera_Forum
Honored Contributor
Okay, so I've continued working on this and I've discovered that by grounding the unused pins on the expansion header by assigning them to an output source fed by GND I can add multiple switches to control multiple output pins without any trouble. The switches are controlling the voltage levels on the assigned pins just fine now!
One last problem remains though, in that I'm still having trouble receiving input even with the trick above. I tried assigning one of the GPIO pins to LEDG[7] with the idea being that I could feed GPIO[0] back into it and see if the LED would light up. Instead, the programming failed spectacularly, with multiple random hex segments lit up, LEDG[7] lit continuously with no input, and nothing else working. So clearly that was a disaster. Any ideas on where I can proceed next? - Altera_Forum
Honored Contributor
Hi,
Are you trying to light up the LEDs on the board by connecting them to the SW switches? If you're using any of these SWs/LEDs/7-Seg LEDs, you will need to assign the proper pins for each. The QSF file for the DE2 board has been posted in an earlier reply. Please take a look at that or use it to assign the respective pins if you want to drive the LEDs or 7-Seg LED using the SW switches. GPIO pins are connected to the GPIO header and assigning SW switches to GPIOs will not drive the LEDs. - Altera_Forum
Honored Contributor
Thanks for the continued efforts to help me. So when you talk about a bank, you're saying a bank runs sideways across two pins then, not horizontally down the length of it? I've tried it both ways, assigning inputs across GPIO[2] and GPIO[3] and an output to GPIO[0] with everything else as a grounded output but it still didn't work unfortunately. I can still get everything to work with only outputs AND I actually did get input to work after a fashion:
If I remove all the outputs and assign GPIO[0] and GPIO[1] as inputs to LEDR[0] and LEDR[1] respectively, and then I ground all the other GPIO pins as input to ground (see attachment) then the program compiles and loads. Once programmed, both LEDs are lit up, so they're getting a high signal from somewhere, but if I take a jumper wire and short pins 0 and 1 to ground, the LEDs do go out. It may not be ideal, but it's the first time I've gotten any information to pass through an input channel on these GPIO pins. Now if I could just get input and output to work at the same time... I feel like things are getting closer, thanks so much for all the help. I'll try that other QSF file that was posted as well. - Altera_Forum
Honored Contributor
@eapenabrm (https://www.alteraforum.com/forum/member.php?u=820) Thanks for the reply! I'm trying to figure out how to send and receive data through the GPIO 40 pin expansion header on the DE2. To test my progress I've used an input from a switch, SW[0] to drive an output assigned to GPIO[0]. Grounding the other pins as described in a previous post I was able to control multiple pins simultaneously for output, and measured the voltage change at the pins to verify 0v ~ 3.3v. To test the input I was trying to assign one of the GPIO pins as an input wired to one of the LEDRs, thinking that if successful I could push 3.3v to the input pin and the LED would light up. I'm having trouble getting input and output to work at the same time on the GPIO pins so I can send and receive data (through different pins of course). Everything compiles fine in quartus, but once I program the board everything is gibberish - by which I mean nothing works, and random LEDs and 7 seg display segments will be lit indicating to me that the programming failed.