GPIO state on bootup
I have connected my Omega2(+) to 74HC595 shift register, and I noticed strange behaviour during bootup sequence. There is a lot of noice for certain amunt of time on those pins, and some end up high and some low. I would need those pins to stay low till I call them to change in program. How this could be acheived and which pins to choose for output.
I have capured behavior on logic analyser:
Pins that I currently use are GPIO11, 17 and 16.
Thank you for your advice.
Unless specified explicitly, all the GPIO pins are in input mode after reset.
/MediaTek MT7688 Datasheet version 1.4 page 25/
We can use 10 (ten) freely available (not shared / not multiplexed) GPIOs on Omega2(+):
GPIO 11, 3, 2, 17, 16, 15, 1, 0, 19, 18
During and after the system boot 9 (nine) of them stay Input - only GPIO 11 will be Output and High.
Why??? About this please ask email@example.com (I think he is @Zheng-Han).
I have an idea but I also would like to know the official explanation ;-)
An "empty" CMOS input is floating - ie. its HIGH / LOW state is not determined.
So the GPIO Inputs of Omega2(+) and the input pins of your HC595 (and the inputs of your logic analyzer too) are all floating.
The simplest solution for your problem is: try to put one pull down resistor on each of the SRCLK and RCLK pins of HC595.
@György-Farkas Well I have tried pull down resistors, but the problem is that those pins aren't floating from the beginning, as probably the internal multiplexer does something before loading the kernel. As shown on logic analyser graph pins actually go high for around 7 sec and have 1us pulses every 25us or so, which are then detected by 74hc595. DPIO 11 doesn't have those pulses, but stays high (output state) till you don't run a scriptwhere you set the output to low on other side others - 17, 16, 15 go to floating state after that.
I then decided I will go with i2c port expander for more safe and predictable operation. MCP23008 is quiet handy as they are used in relay dock and have libraries written for it.