Open JaimeLeon2 opened 2 months ago
Same as #1757
We should also prevent D13 from being used as an output on Mega boards.
The way to do this is:
analogOnly
and outputOnly
. By default these should be false so existing files don't need to change, and it doesn't have to be specified on every single pin.Note that this could cause issues with existing configurations that might use these pins in an incorrect way. The code would somehow need to also make sure that the pin shows in the dropdown if it's the current pin, even if it isn't valid per the new rules.
The original Arduino MEGA 2560 has an OpAmp connected to Pin D13, means this Pin can be used as Input and Output without any restrictions schematic
Clones don't have this OpAmp, so there are some restrictions:
I would not restrict the use of Pin 13 as it's usable on original ones, but clearly state that the above mentioned restrictions apply for clones.
The information that pins A6 and A7 are only useable for analogIn and not digital for the Nanos are also widely spread in the internet. I would do the same as for the Mega, clearly state this restriction.
Now the question is where to do it. At least on the mobiflight homepage where the compatible boards are listed. Addiotiuonal a pinned thread under Hardware on the Discord server.
Maybe we could add an information in the board.json file which gets displayed in the Configured Modules window. This would be shown everytime the board is selected as an additional information.
Also Pro Micro does not have a LED on D13, so not applicable to this board.
Wouldn't installing an external pull up resistor on D13 solve the low voltage that causes the bad input readings on this pin?
You have to be above > 0.6 Vcc to get a stable H signal and < 0.3 Vcc to get stable L signal.
So for H signal 0.6*5V = 3V is required, Rled is 1K and let's assume LED is ideal (voltage drop 1.5V, no resistor). This means 3.5V must be split up for the 1k resistor and the pullup resistor while the voltage drop for the 1k resistor must be 1.5V to get the stable H signal. That would also be roughly a 1k resistor. Getting the L signal is no problem as you switch directly to GND.
So yes, it should be possible. But my calculation has to be tested before ;)
The build in pullup resistor from the board is 10k. So 3.5V has to be split up 1:10, means voltage drop on Rled is 0.35V. This added to 1.5V from the LED results in 1.85V as input voltage for the ATmega pin which is in the undefined area for input voltage, but "near" 0.3*Vcc=1.5V for L signal. That's why it does not work.
Also Pro Micro does not have a LED on D13, so not applicable to this board.
we have individual board json files. So any restriction on the pin would be specific to a single board
Describe the bug Current UI allows assignment of pins A6 and A7 for digital input and output. These pins can only be used for analog input. Reported by user in Discord.
Steps To Reproduce Steps to reproduce the behavior:
Expected behavior Assignment to digital input or output should not be allowed.
Actual behavior Assignment is allowed.
Details
Additional context None.