Re: Problem with SHC


Dave Schwartz
 

The ESP32 itself (the bit with the square silver metal shield that comes from Espressif Inc. a.k.a. the MCU) is a 3.3V device but the carrier (the 'development kit C board') it is mounted on is built to operate from 5V. This is because of the 5V sourced from the USB port  which is not part of the MCU. The USB 5V can be used to run the MCU. The 5V from the USB is put through a 5-to-3.3V regulator and both those voltages are used to operate the cp2102 (yes, it has one of those) and MCU subcomponents.

When you are not operating the MCU from the USB power, external power can be supplied to either the 5V pin (which runs to the input of the 5-to-3.3 regulator (the same as from the USB) or by providing 3.3V on that pin which is normally the output from the regulator (but you will not have USB functionality because the cp2102 won't be getting its 5V reference).

Since 5V is the standard for the optional voltage on an ST4 connector that's why the power for the DevKitC module is taken from there.

The official DevKitC board uses an NCP1117 regulator which, in its 3.3V version says that the input needs to be between 4.75V and 5.3V.

So for any ESP32 SHC, if the voltage measured at the 5V pin is lower than 4.75 volts, possibly due to voltage loss in a connector or the cable) then it is not guaranteed to operate. If by some miracle it were to operate below this range, the ncp1117 regulator is only rated to supply 10ma at the best of times and therefore any button use (which by definition is shorting a pulled-up GPIO to ground and thus consuming some current) is highly likely to brown out the regulator when running with an out-of-spec input. That may be why your MCU is resetting when you hold down a button.

While the ESP32 is not rated for 5V on the GPIO lines, nearly everybody who's used one says that it is 5V-tolerant so that's why we can get away with pulling it up to 5V. And since we do it through a 2.2K resistor, the current that can be supplied to the GPIO is limited to below its 28ma 'letting the smoke out' rating anyway.

The SHC itself does not pull up the 4 signal lines - that's done on the controller. For similar reasons as above, the ESP32 will be OK with those lines being pulled up to 3.3V or 5V because the pull-up resistors there also limit the current.

Similar situation on the OnStep controller MCU on the other end of the signal lines... even if the GPIO lines there are not rated to be 5V-tolerant (all STM32's are) the current is restricted to below their 'let the smoke out' limit.

The signal voltages don't have to go between exactly 0 and 3.3V to be logic high or low. All MCUs will have a similar spec but for the ESP32-WROOM-32, 'low is anything below .25xVdd and 'high' is anything above .75xVdd (when Vdd = 3.3V, low <= 0.825V and high >= 2.475).

The diagnostics sketch is in the assembly document: https://docs.google.com/document/d/1Yqapj0lpiI2ryzUzsBS99wqcaYcddTj4RX0LUBaBIEE/edit#heading=h.aewrbh38x497

On 2021-05-04 3:12 p.m., Ken Hunter wrote:
// Switching the probe to pin 3 on the next session, a 12.5Hz square wave appeared there shortly after OnStep started. This waveform persisted for about 15 seconds and then disappeared. The SHC display going from // 'Establishing connection' to the main information display coincided with the 12.5Hz waveform on pin 3 going away. I see the intermittent square waves until I press the joystick for 2 seconds then ALL GOES AWAY, nothing after that. One thing I noticed is that I do not have 5 volts on Pin 1 or pin 3. It is more like 3 volts p/p.

Still some of the SHC's work, some don't.

Where is the "button Test" sketch hiding?

Ken

Join main@onstep.groups.io to automatically receive all group messages.