Hi,
In our projects, all of the digital interfaces have been assigned to different functions.
(2 group of I2C port with multiple sensors, 1 UART port for RS485 communication, 1 UART port for debug console)
But we still need one extra UART port to read a low throughput sensor.
Hence, our plan is to conduct pin switching runtime between UART console and UART sensor.
We only need to read the sensor(~100bytes) every 4 minutes.
Our planning as below:
1. uart0 assigned for uart console in device tree. ie: gpio 0.20 and gpio 0.21
2. run uart0 suspend by pm_device_action_run(uart_dev, suspend)
3. reconfigure uart function to other pins by pinctrl_configure_pins,
ie: gpio 1.10 and gpio1.11 in our project
4. run uart0 resume by pm_device_action_run(uart_dev, resume)
5. read sensor data here
6. uart0 suspend
7. call pinctrl_configure_pins to set console pins. ie: gpio 0.20 and gpio 0.21
8. uart0 resume
9. uart debug console works
I will ignore the pinctrl_apply_state function from the uart suspend/resume functions.
Is there any problem in the uart pin switch flow?