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 AND GPIO. 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 doesn't respond at all to SW being toggled - a voltmeter measures no change between the pin and ground. Then pin EX_IO, which was supposed to light up LEDR when a voltage was detected is outputting a steady 3.3v even though assigned as an input pin, and LEDR 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: EP4CE115F29C7N
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)
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 and GPIO 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?
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)
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)
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)
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 with the idea being that I could feed GPIO back into it and see if the LED would light up. Instead, the programming failed spectacularly, with multiple random hex segments lit up, LEDG lit continuously with no input, and nothing else working. So clearly that was a disaster. Any ideas on where I can proceed next?
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.
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 and GPIO and an output to GPIO 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 and GPIO as inputs to LEDR and LEDR 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.
@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 to drive an output assigned to GPIO. 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.
One last update for the night. Using bidirectional ports assigned to the GPIO pins with the rest of the unused pins being assigned bidirectional and grounded, I was finally able to get both input and output together without the programming failure. For some reason though, the input is still acting strangely. It's as though a fictitious source is there supplying constant voltage to the input pin and it only detects when it's shorted out. That's not going to work for the project because I need to be able to detect an active high signal. I'm not sure why it's behaving this way, hopefully someone will be able to enlightening me or tell me if the way I'm approaching this is way off base. Thank for all the help received tonight.
So when you use a BiDir pin, you need a separate input signal to control the BiDir port. You could assign another key/DIP switch to this Enable signal of the BiDir port. That way you can switch the port from input mode to output mode and vice-versa. You can also drive this Enable signal always HIGH/LOW to force the port in question to be in either INPUT or OUTPUT mode.From your description, i think this is what you are trying to do: SW ---> FPGA I/O ( input assigned to SW PIN_AB28)---> FPGA I/O ( output assigned to GPIO PIN_AB22)--->GPIO ----external jumper wire from GPIO to GPIO ---> FPGA I/O ( input assigned to GPIO PIN_AC15) ---> FPGA I/O ( output assigned to LEDR pin PIN_G19 ) ---> LEDR Kind of like looping back the output signal from GPIO to GPIO and driving a LED. Is this right?
That's exactly what I'm trying to do, yes, as a test mechanism to establish control over input and output. Ultimately two output pins will be used to trigger the range finder and drive a PWM module, and one input pin will be needed for the return data from the range finder. I've never tried bidirectional pins so thank you for the suggestion. What do you suggest using as a mechanism to control the port direction? Some kind of multiplexer?Also, if anyone knows how I can solve the original problem of not being able to get standard inputs and outputs to work together on the expansion header that's still an option as well. I'm still not sure why it's not working to do that. I think I've seen people do that with these ports in VHDL and Verilog so I'm wondering if the compiler is just taking care of something behind the scenes. Guess that's the advantage to learning those languages. :-)
Okay, I have attached the files from the most current version of my test project. There's not much to it, as I'm just trying to establish input and output communication through the GPIO pins right now. I have attached images on my previous posts that show the top level diagram if you want to see the evolution of the project from then till now.
I'm continuing to try different combinations of connections and elements, but what it basically boils down to is this: I can only assign one IO type to the GPIO expansion header - either input, output, or bidirectional - or quartus will not make the pin assignments. If I assign a switch to GPIO for example, and ground all the other pins then it makes the assignment just fine and the programmed board works - I can toggle voltage at the pin using the switch. If I try to assign any other IO type to any other pin, input or bidirectional, quartus will not assign the pin. The project compiles but when programmed to the board nothing works. I tried to do everything as bidirectional IO types as a workaround and it will make the assignments just fine, but the input instead of detecting voltage, is supplying constant voltage and only detecting when I ground the pin externally. The led indicated in the project file and images I've attached previously stays lit constantly as though there were a source attached to it, only going out when I ground the pin. I don't really understand why things are behaving this way.
Still doing research on this problem, not giving up or waiting for a hand to hold. :-) But seriously, any help would be greatly appreciated. Would my input problem have anything to do with the way I'm configuring the pin settings? I've been reading about things like pull-up and pull-down resistors, tri-state input, open drains, etc. I'm still getting my head wrapped around it but can anybody point me in the right direction or tell me if it's a dead end for what I'm trying to accomplish?
Well, there are a couple of issues with your project:1. You seem to be using the incorrect QSF file for the DE2-115 Board. I've modified the schematic and loaded the correct QSF file. You can download and try it out. 2. You cannot set pins of the same IO Bank as both Input and Output. If you want both directions, you will have to use the pins as IO. I've attached the Quartus archive of your project. Open it using the tool and check if it works on your DE2-115 board. If you look at the Pin in the schematic, you see a VCC under it, double-click that and change it to GND. Thats the default value of the Pin. This is why the LED is lit up when you program the board and goes off only when you short it. Plus using the EX_IO or EXT_IO pins on the board fo GPIO purposes is not correct. If I'm right , the EX_IO/EXT_IO pins are used for the HSMC connector on the board and are not connected to the GPIO header. -Abr
Hey there, thanks for taking the time to help me out! I was able to download the archive project and try it. At first it failed to make pin assignments, but then I changed the project settings to my board and kept the current pin settings and it worked. I get switch control over GPIO as before, and the same issue with the LED staying on as before unless GPIO is shorted. So I went and switched GPIO default to ground as you suggested and tried to load and it failed to program correctly. The I changed the default value on GPIO and GPIO together to ground and this time it programmed just fine but behaved exactly as before with the LED staying on unless shorted, which is strange since its set to ground. I've attached a picture of the change I made so you can tell me if I did it wrong.Thank for the QSF file, I'll give that a try too. I was using a QSF created with Terasic DE2-115 System Builder V 2.0.0 that came on the CD with the board, but I'm not trusting anything 100% at this point. :-) I had tried the EX_IO pins because on my particular board they correspond to an additional 14 pin expansion header located over near the power button. But I'm getting the same issues over there as well so no difference. Please let me know if I messed up setting the pins to ground, I feel like this should be so easy but I'm such a beginner at this.