I'm trying to understand from the imx7 Reference Manual and the Datasheet, how to go about configuring the GPIO for following operations:
- Push Pull
- Drive Low, Pull-Up High
- Drive High, Pull-Down Low
Using IOMUXC_SW_PAD_CTL_PAD_SAI1_RX_BCLK and as reference, please describe the appropriate register settings to get the above GPIO behavior? The documentation is pretty sparse in describing the GPIO internal structure and how output stage can be configured.
AN5078 does a good job of showing a simplified internal structure (fig 6) but that doc doesn't apply to imx7 SOC.
Apologies, I think I misread your response.
- Push-Pull is enabled when the GDIR is 1, output. Then writing to DR will change state on the output line.
- For driving 0, i set GDIR to 1 and DR to 0.. When I want to release the line, I set the PAD PS & PE and then set the GDIR to 0 for the line to be pulled high.
Let me know if this is the correct method. Thanks again!
>When I want to release the line, I set the PAD PS & PE and then set the GDIR to 0
for the line to be pulled high. Let me know if this is the correct method.
yes this is correct.
Thanks Igor. So to confirm,
- if I set the GPIO GDIR as output, the PAD_* settings PS and PE are ignored, and the output is Push-Pull
- If I set GPIO_GDIR as input, the PAD_* settings PS and PE take effect
For the Drive Low, Pull-Up High, I don't understand how I'm able to Drive Low if I configure the DIR to be input. Shouldn't the GPIO output block be disabled/tri-stated and only enable the input? It seems like there is a potential for contention if I set the DIR as input and set DR to be 0.
This behavior you've described is not documented, or maybe I'm not understanding the documentation correctly:
18.104.22.168 GPIO data register (GPIOx_DR) : If GDIR[n] is cleared and IOMUXC input mode is GPIO, then reading DR[n] returns the corresponding input signal's value.
There is no mention of what happens on the Pad if you set or clear the DR when GDIR[n] is cleared (input).
>There is no mention of what happens on the Pad if you set or clear the
>DR when GDIR[n] is cleared (input).
Pad settngs do not depend on GDIR[n].
> if I set the GPIO GDIR as output, the PAD_* settings PS and PE are ignored,
>and the output is Push-Pull
they are not ignored. With setting PE=0 Pull Disabled, "output is Push-Pull".
>For the Drive Low, Pull-Up High, I don't understand how I'm able to
>Drive Low if I configure the DIR to be input.
what do you mean by "Drive Low if I configure the DIR to be input" ?
1. set IOMUXC_SW_MUX_CTL* register MUX_MODE to GPIO,
sect.22.214.171.124 SW_MUX_CTL_PAD_SAI1_RX_BCLK SW MUX Control
2. set that GPIO registers GPIOx_GDIR as output, write data to GPIOx_DR,
sect.126.96.36.199 GPIO direction register (GPIOx_GDIR),
sect.188.8.131.52 GPIO data register (GPIOx_DR)
>Drive Low, Pull-Up High
for "Drive Low" follow above description and write "0" to GPIO data register GPIOx_DR.
for "Pull-Up High" set GPIO direction register GPIOx_GDIR as input,
set SW_PAD_CTL_PAD* register with appropriate pull settings "PS", "PE" :
sect.184.108.40.2065 SW_PAD_CTL_PAD_SAI1_RX_BCLK SW PAD Control