Electronic – Can both internal and external pullup resistor be used on an MCU pin

microcontrollerpullupresistors

I am taking a microcontroller class in university and have the following problem:

(Sorry for the poor image quality)

enter image description here

Its fairly simple but here is my problem: In my solution I set the internal pullup resistors on the input pins. I realise you don't need to because of the presence of the external pullups but I though it would be safe to do nonetheless. From my perspective, enabling the the internal pullups does not affect the operation of the circuit, however apparently the correct answer is that the internal pullups should be disabled and I'm not sure why. Isn't it a good idea to have the internal pullups enabled for redundancy so in case something happens to the external pullups the input pins still have a defined state?

Best Answer

I see this as both an assignment-interpretation question as well as an electronics question.

Electronics-wise: The internal pullup will be in parallel with the external one. So if there's an internal 10k pullup plus an external 10k pullup, the actual pullup resistance will be 5k, which may or may not be what you want in general. In practice, in this case it's going to be totally harmless, but that won't always be the case. Your argument that it ensures the pin has a defined state even if the external resistance gets disconnected could be reasonable, or not, depending on how the circuit is physically instantiated.

Assignment-wise: The question specified that you should not disturb any configuration bits not necessary to solve the problem. Since the external pullups are present, altering the internal pullup configuration is not necessary to solve the problem, so you shouldn't do it. My guess is that the assignments are being automatically graded, and the autograder software is not flexible about handling various otherwise-legitimate configuations of control bits, which is why you're being asked to leave them alone.

The (human) grader probably should explain all this and give you full credit this time, while asking you not to do it again; but my suggestion to you is to take this as a lesson, that the grader is inflexible about these things, and do your future assignments accordingly.