ESP32 - Hardware Flow Control Problem

emanos
Posts: 4
Joined: Wed Dec 09, 2020 12:22 pm

ESP32 - Hardware Flow Control Problem

Postby emanos » Fri Aug 13, 2021 1:54 pm

Hey everyone,

I am having some trouble on implying hardware flow control in the uart communication I am trying to establish.
The board I use is the Firebeetle.
Below, I attach some code snippet of my configuration, in order to activate hardware flow control:

Code: Select all

#define TX_UART2  17
#define RX_UART2  16
#define RTS_OUTP    7
#define CTS_INPT    8
...
uart_config_t uart_config_2 = {
    .baud_rate = 115200,
    .data_bits = UART_DATA_8_BITS,
    .parity = UART_PARITY_DISABLE,
    .stop_bits = UART_STOP_BITS_1,
    .flow_ctrl = UART_HW_FLOWCTRL_RTS
  };
//  pinMode(RTS_OUTP, OUTPUT);
  uart_driver_install(UART_NUM_2, BUF_SIZE * 2, 0, 0, NULL, 0);
  uart_param_config(UART_NUM_2, &uart_config_2);
  uart_set_pin(UART_NUM_2, TX_UART2, RX_UART2, RTS_OUTP, UART_PIN_NO_CHANGE);
The problem now is that whenever uart_set_pin function takes as input RTS_OUTP, seems to lead to continuous reboots of the esp32.
The crash message I get is the following:
Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x800e7584 PS : 0x00060130 A0 : 0x800e7584 A1 : 0x3ffb1eb0
A2 : 0x00000007 A3 : 0x3ffb8058 A4 : 0x00000001 A5 : 0x00000001
A6 : 0x00060120 A7 : 0x00000000 A8 : 0x3f4050a4 A9 : 0x00013ffc
A10 : 0x3f40a3f4 A11 : 0x00060123 A12 : 0x00060120 A13 : 0x3ffb2d78
A14 : 0x00000009 A15 : 0x3ffb2128 SAR : 0x00000010 EXCCAUSE: 0x00000014
EXCVADDR: 0x800e7584 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000

Backtrace: 0x400e7584:0x3ffb1eb0 0x400e7581:0x3ffb1ee0 0x400e5de3:0x3ffb1f10 0x400d0d82:0x3ffb1f40 0x400d11fb:0x3ffb1fb0 0x40088a6d:0x3ffb1fd0
Rebooting...
On the contrary, if instead of RTS_OUTP I pass UART_PIN_NO_CHANGE as an argument then esp32 works just fine. Well, fine but without hardware flow control (as expected though).
My guess is that pin 7 which is the recommended rts pin for uart 2 might be dedicated to flash memory function and thus there is severe conflict leading to those crashes. But how do I overcome this?

So, do you have any suggestions or/and solutions? Both arduino or idf solutions are more than welcomed!
Or any other ideas/solutions about what might be the problem here?

Thanks in advance!!!

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ESP32 - Hardware Flow Control Problem

Postby WiFive » Fri Aug 13, 2021 9:52 pm

Use another pin

Who is online

Users browsing this forum: Baidu [Spider] and 108 guests