CPLD Unused pins--best practice - Page 1
Forum section: electronics / general

author: gregallenwarner
author_rank: Regular Contributor
timestamp: April 16, 2015, 02:53:13 pm
content: What's the best thing to do with extra unused CPLD pins? I'm using an Altera MAX3000A. I'm not using all the pins in the design, so some are left unassigned in the pin planner. Should I leave the unused pins floating? Or is it better to configure them as reserved pins driving Vcc, or ground, or something else? Or should I add pullup resistors?I'm still relatively new to all this, so I'd like to know what is considered best practice here. Thanks.

author: AndyC_772
author_rank: Super Contributor
timestamp: April 16, 2015, 03:00:27 pm
content: I normally configure unused pins an inputs with internal pull-ups enabled.Configuring unused pins as outputs is OK too, but IMHO less future proof in the event that the hardware gets upgraded, and a previously unused pin needs to become an input.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: April 16, 2015, 03:11:56 pm
content: Connect as many as you can to test pads - can be very useful for debug outputs.Configure either as input with pullup or pulldown, or outputs driven to a defined 0 or 1.In some extreme cases there could be an argument to tie to 0V and drive low to reduce total ground inductance.

author: gregallenwarner
author_rank: Regular Contributor
timestamp: April 16, 2015, 03:20:53 pm
content: As far as I can tell from the datasheets, the Altera MAX3000A line only has internal pullups available during in-system programming. I can't find any method of gaining access to these pullups for configuration for use in "user mode". If anyone knows anything more about this, or if I'm wrong, please correct me.So I might decide to have them as outputs driving low, and connect them to the ground plane.But just to satisfy my curiosity, the general consensus is that it wouldn't be optimal for me to just leave them as floating inputs, correct?

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: April 16, 2015, 03:26:01 pm
content: Quote from: gregallenwarner on April 16, 2015, 03:20:53 pmThis would normally be discussed in the section on the I/O cell, and specified in the constraints fileQuoteNo reason to connect to groundplane unless it's convenient for routing to to reduce ground inductance - more flexible to leave open as you could potentially connect to them.QuoteCorrect. floating inputs are bad.

author: codeboy2k
author_rank: Super Contributor
timestamp: April 16, 2015, 04:27:22 pm
content: Quote from: mikeselectricstuff on April 16, 2015, 03:26:01 pmI've brought unused outputs to test pads, they are indeed handy for debugging.Here's another idea that I've never done before, but it seems like it might be a good idea now: Perhaps bring them out to a small resistor pad, 0603 or 0402, whatever you have room for. The other side of the footprint goes to GND. Then you can still use it to attach debugging wires to, and when building the final board for production you can choose to populate them , or not, for reduced GND inductance.

author: gregallenwarner
author_rank: Regular Contributor
timestamp: April 16, 2015, 04:34:26 pm
content: These all sound like pretty good ideas.I'm having trouble figuring out how to get the Quartus II software to reserve these pins as outputs driving ground. I don't see that option. I tried choosing "Reserve pin as output driving Vcc" just for kicks, but the synthesizer failed, saying, "Reserve pin type is not supported for the device family."Am I just going to have to edit my entity in the VHDL file and manually just make some dummy pins and put <= '0' after them? Seems a bother to have to pollute my VHDL file with package-specific data that has no relevance to my logic. I feel this should be a configuration for the target package, so my VHDL code remains modular and package agnostic.Am I overthinking this?

author: langwadt
author_rank: Super Contributor
timestamp: April 16, 2015, 04:46:13 pm
content: Quote from: mikeselectricstuff on April 16, 2015, 03:26:01 pmbut would they really be floating? I've only used xilinx and unused pins by default have internal weakpull-ups

author: gregallenwarner
author_rank: Regular Contributor
timestamp: April 16, 2015, 04:58:01 pm
content: Quote from: langwadt on April 16, 2015, 04:46:13 pmIf Altera's MAX3000's do have internal weak pullups, I've found nothing in the documentation that says so. The only mention of internal pullups in any of Altera's documentation that I've found states that they are weakly pulled up during in-system programming, so as to tri-state the pins during the programming operation. It makes no mention of what happens to those pullups after programming is completed, so I've been working on the assumption that they're no longer connected. If anybody knows differently, please, point me in the right direction.

author: AndyC_772
author_rank: Super Contributor
timestamp: April 16, 2015, 06:05:34 pm
content: In Quartus, select Assignments > Device > Device and pin options > Unused pins.There you'll get a set of options for what to do with unused pins. See how you get on; I can't remember whether or not a MAX3000 supports pull-ups, sorry.

author: gregallenwarner
author_rank: Regular Contributor
timestamp: April 16, 2015, 06:59:13 pm
content: Quote from: AndyC_772 on April 16, 2015, 06:05:34 pmHoly cow, I never looked at this configuration screen before! Thanks!For the MAX3000A devices, apparently, the only options that chip architecture supports are "As input tristated" and "As output driving an unspecified signal." The "unspecified signal" one was the one selected by default.What does that mean? "Unspecified signal"? What actual value are those pins getting?

author: AndyC_772
author_rank: Super Contributor
timestamp: April 16, 2015, 07:09:47 pm
content: It could be either a 0 or a 1, depending on... well, actually I have no idea. Whatever uses the fewest resources in the chip, perhaps. Since the unused pins aren't connected to anything, it shouldn't really matter which logic level they're stuck at.There is, of course, nothing stopping you from defining the extra pins in your design, so there are no "unused" pins as such. Then you can set the function of those pins in your code just like any other.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: April 16, 2015, 07:16:19 pm
content: Quote from: gregallenwarner on April 16, 2015, 06:59:13 pmIt means "whichever uses the least logic resources", which could be high. low, or maybe even another internal signal.Or perhaps a random, but stable intial state on powerup

author: gregallenwarner
author_rank: Regular Contributor
timestamp: April 16, 2015, 07:18:02 pm
content: Ok, so by the looks of it, it seems to me that Quartus is automatically setting my unused pins as outputs, and assigning them either a 0 or a 1, unknown beforehand. But at least they're stable and not floating.I'm reading in the Xilinx XC9500XL Family datasheet as a comparison, and I found this text:QuoteAm I understanding this right in that this applies to unused tristated input pins? Does this mean that this bus-hold circuit causes the pin to be bistable at either 0 or 1, and that a floating input will quickly drift to one side or the other, and stay latched there by the feedback resistor? If I'm incorrect, please let me know. I'm making a lot of assumptions as I go through these datasheets.

author: AndyC_772
author_rank: Super Contributor
timestamp: April 16, 2015, 07:43:09 pm
content: Yes, that's what bus hold does. But the MAX3000A doesn't have bus hold on its pins.

author: gregallenwarner
author_rank: Regular Contributor
timestamp: April 16, 2015, 08:15:18 pm
content: I also see that the Xilinx CPLD's have a programmable ground drive option, which simply makes an output drive ground.I'm considering switching to Xilinx CPLD's as they have more features that reduce a lot of headache.

author: miguelvp
author_rank: Super Contributor
timestamp: April 17, 2015, 12:10:52 am
content: I usually leave the unused pins as input tri-stated just because that's what they usually do on all the tutorials that I saw at Altera. Otherwise unused pins connected to LEDs glow faintly using the default setting.Here is a simple tutorial helping someone use a schematic top to deal with the reverse input logic for the BeMicroCV push buttonshttps://www.eevblog.com/forum/microcontrollers/bemicro-cv-questions/msg524041/#msg524041

author: AndyC_772
author_rank: Super Contributor
timestamp: April 17, 2015, 05:38:51 am
content: If there's an LED connected to the pin, then it's not really an unused pin. Define it as an output in the code, and set it to drive permanently low.

author: miguelvp
author_rank: Super Contributor
timestamp: April 17, 2015, 05:41:58 am
content: That make sense, it's strange they recommend input tri stated one their DE0-Nano for all unused pins.Then again, that's a global setting so it would be more appropriate to use the pins hooked into unused LEDs and set them to off.

author: spudboy488
author_rank: Regular Contributor
timestamp: April 17, 2015, 11:29:48 am
content: If I have a few processor pins open as well, I'll route them over to a few unused pins in the CPLD. You never know when you may want to add some more logic to the system.

author: gregallenwarner
author_rank: Regular Contributor
timestamp: April 17, 2015, 03:05:02 pm
content: Quote from: miguelvp on April 17, 2015, 05:41:58 amIt's possible they recommend this because those pins are tied to something on the DE0-Nano board that makes their logic state stable, so it's safe to do. In a totally original design where you have dangling pins flapping in the breeze, you wouldn't want them input tristated, because their logic values can float and toggle rapidly, causing excess switching current in their input buffers, even if it's not tied to any internal logic. Best case, it just heats your chip up, and worse case, it actually induces noise in your chip that causes errors.At least that's what I've been learning. Xilinx's datasheets recommend never leaving a tristated input floating, and so I'm going to take the approach of always making unused pins an output, either driving ground if possible, or driving an unspecified signal, as Quartus words it.

author: bingo600
author_rank: Super Contributor
timestamp: April 19, 2015, 07:21:01 pm
content: I just recently used Quartus-II to set all unused input tristate with weak pull up's on a EPM240I also enabled weak pullup's in all low-speed inputs.The MAX-II CPLD's have some neat things up the sleeve./Bingo

author: gregallenwarner
author_rank: Regular Contributor
timestamp: April 20, 2015, 02:42:38 pm
content: Unfortunately, I need to directly interface with some 5v logic, which means I'm limited to those devices which have 5v tolerance on their pins. If I understand correctly, Altera's MAX3000A are the only ones that do. The MAXII's and above are all 3.3v or lower.

author: AndyC_772
author_rank: Super Contributor
timestamp: April 20, 2015, 02:46:43 pm
content: Yes, I think you're right, but Altera has a lot of documentation on how to interface various families to logic at different voltages. It's well worth seeking out and reading thoroughly.I believe the recommended solution to driving a MAX II from a 5V input is to use a series resistor and a Schottky diode clamp to VCC.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: April 20, 2015, 05:27:40 pm
content: Quote from: AndyC_772 on April 20, 2015, 02:46:43 pmLattice 4000 has 5V tolerant IOs