How to connect GPIO output with peripheral input - single pin
Posted: Fri Feb 23, 2018 1:57 pm
I have a GPIO output driving an external chip that I would like to connect to a MCPWM timer sync input, without using an extra pin. I haven't been able to get this to work, but ESP_Sprite's comment from this thread gives me hope:
If instead I remove the external wire, and try to route GPIO12 through the GPIO Matrix to PWM0_SYNC0, there's no syncing. I can't just call mcpwm_gpio_init() to connect up GPIO12 to PWM0_SYNC0, as it's been set as an output and mcpwm_gpio_init() would disable the output, so I call these functions instead:
It doesn't work, there's no syncing:
Can I connect a GPIO output to a peripheral input through the GPIO Matrix? If so, what am I doing wrong?
Full code is here
I stripped down mcpwm_basic_config_example to just what I needed for a test case. GPIO12 is being driven with a test signal, and if I externally connect GPIO_SYNC0_IN (GPIO2) to GPIO12, my timer0 signal syncs up to the test signal.ESP_Sprite wrote:Outputs are mutually exclusive, for obvious reasons. Inputs can be shared in the GPIO matrix, that is, you connect one GPIO pin to multiple peripheral inputs. You can also connect a pin to the output of one peripheral and to the input of another. I don't think the IO-mux allows sharing of pins, so if you need to share something with a peripheral that's only on the IO-mux you may be out of luck.a2retro wrote:Are all pin uses mutually exclusive or may some be overlapped during use somehow?
If instead I remove the external wire, and try to route GPIO12 through the GPIO Matrix to PWM0_SYNC0, there's no syncing. I can't just call mcpwm_gpio_init() to connect up GPIO12 to PWM0_SYNC0, as it's been set as an output and mcpwm_gpio_init() would disable the output, so I call these functions instead:
Code: Select all
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[GPIO_SYNC0_IN]);
gpio_matrix_in(GPIO_SYNC0_IN, PWM0_SYNC0_IN_IDX, false);
Can I connect a GPIO output to a peripheral input through the GPIO Matrix? If so, what am I doing wrong?
Full code is here