pinMode vs gpio_set_direction for UART
Posted: Wed Nov 17, 2021 1:37 am
Hello,
I am using the UART1 (RX:pin16 and TX:pin17) and I need TX to be push-pull output, so I used gpio_set_direction like this:
But it is not possible to send data (println) through the UART. However, I can send data when I replace the above line by:
My questions are:
-What did I missed to add before or after gpio_set_direction?
-Is pinMode(Sender_Txd_pin, OUTPUT) equivalent to gpio_set_direction((gpio_num_t)Sender_Txd_pin, GPIO_MODE_OUTPUT) to get TX push-pull output?
thx
Michel
I am using the UART1 (RX:pin16 and TX:pin17) and I need TX to be push-pull output, so I used gpio_set_direction like this:
Code: Select all
#define Sender_Txd_pin 17
...
gpio_set_direction((gpio_num_t)Sender_Txd_pin, GPIO_MODE_OUTPUT);
Code: Select all
pinMode(Sender_Txd_pin, OUTPUT);
-What did I missed to add before or after gpio_set_direction?
-Is pinMode(Sender_Txd_pin, OUTPUT) equivalent to gpio_set_direction((gpio_num_t)Sender_Txd_pin, GPIO_MODE_OUTPUT) to get TX push-pull output?
thx
Michel