Electronics > Beginners
Strange behaviors with microcontroller digital inputs
Kasper:
--- Quote from: mikerj on September 23, 2019, 12:01:54 pm ---
--- Quote from: Kasper on September 23, 2019, 05:52:46 am ---When your DMM says 1.5V, it could mean it is quickly switching between 0 and 3V. If you have access to an oscilloscope that could be helpful to see if it is actually 1.5V or something else is happening. For example your MCU could be setting pin to output low and then changing it to input and repeating. If you dont have a scope, test it with the simpliest code you can just to be more confident it is doing what you expect.
--- End quote ---
Quite possibly the LDO oscillating due to too too low a capacitance or too high an ESR on the output cap. This is the opposite of most conventional LDO's and caught me out on a different part when the MLCC capacitance dropped below the minimum required due to voltage derating.
--- End quote ---
That does seem like a possibility but the op says the supply is 3.3V when the problem is occuring so assuming that is true, I think it is something else.
Nominal Animal:
The reason I suggested that maybe the resistors were much smaller than believed, is that having higher current (7 mA if 470 Ω, 70 mA if 47 Ω) should work fine for a while, but later on, generate "odd" effects due to point heat on the microcontroller chip, especially if internal pull-ups/downs were also enabled.
tyguy2:
--- Quote from: Kasper on September 23, 2019, 05:52:46 am ---When your DMM says 1.5V, it could mean it is quickly switching between 0 and 3V. If you have access to an oscilloscope that could be helpful to see if it is actually 1.5V or something else is happening. For example your MCU could be setting pin to output low and then changing it to input and repeating. If you dont have a scope, test it with the simpliest code you can just to be more confident it is doing what you expect.
--- End quote ---
Apologies for the late reply! I checked with an true RMS multimeter in AC mode, got 3.3v, so something internal to the micro is causing this. It happens on both pins, so I can assume it's not something external to the circuitry, so I'm move inclined to believe there's an error in my code. That raises an entire other bag of worms though. I'm just using Arduino to program this, and I'm just calling digitalRead on pins that have been set to pinMode(INPUT). Any ideas? I am utilizing the DAC built into the chip, but I feel like that wouldn't effect the digital I/O?
Kasper:
Good idea using AC measurement to check this. So now it seems pretty clear something is pulling those lines down repetitively.
If you want to be even more sure the MCU is the problem, take the MCU out of the circuit, replace it with resistors similar to what you expect the MCU to have internally and see what happens.
To test the MCU:
Make new code for troubleshooting.
Do nothing except set your inputs as needed and if you can, use serial monitor to increment a variable every second or so.
My guess is something happens after a while that causes your MCU to start rebooting constantly and the pin states change during the reboot. Displaying a count through serial monitor will tell you if it has rebooted or not. Note that your counter variable will eventually overflow, possibly making it look like a reboot but if it only happens at a power of 2 then that should be obvious it was just an overflow.
mikerj:
--- Quote from: Kasper on September 23, 2019, 02:41:47 pm ---
--- Quote from: mikerj on September 23, 2019, 12:01:54 pm ---
--- Quote from: Kasper on September 23, 2019, 05:52:46 am ---When your DMM says 1.5V, it could mean it is quickly switching between 0 and 3V. If you have access to an oscilloscope that could be helpful to see if it is actually 1.5V or something else is happening. For example your MCU could be setting pin to output low and then changing it to input and repeating. If you dont have a scope, test it with the simpliest code you can just to be more confident it is doing what you expect.
--- End quote ---
Quite possibly the LDO oscillating due to too too low a capacitance or too high an ESR on the output cap. This is the opposite of most conventional LDO's and caught me out on a different part when the MLCC capacitance dropped below the minimum required due to voltage derating.
--- End quote ---
That does seem like a possibility but the op says the supply is 3.3V when the problem is occuring so assuming that is true, I think it is something else.
--- End quote ---
The schematic shows a direct connection between the micro's GPIO pin and the output of the LDO, with no series resistors. If the voltage on the micro pin is 1.23v but the voltage at the LDO is 3.3, then there must be a bad connection between them.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version