-->
Page 3 of 4

Re: Hardware flow control

PostPosted: Fri Mar 22, 2019 7:38 am
by btidey
I don't think the things called pin12, 13 in the document refer to GPIO numbering. They also don't relate to the chip pins. I suspect they may refer to numbering on the evaluation board featured.

As far as I know U0CTS is on GPIO13 and U0RTS is on GPIO15

Re: Hardware flow control

PostPosted: Fri Mar 22, 2019 12:22 pm
by JimDrew
You are correct! U0CTS and U0RTS are hardwired on the ESP8266 chip to be on pins 13 and 15, respectively. I found this:

wiki/lib/exe/detail.php?id=esp8266_gpio_pin_allocations&media=pin_functions.png

Re: Hardware flow control

PostPosted: Sun Mar 24, 2019 2:55 pm
by HowardHo
It was hard to find and a lot of trial and error, but this seems to work. It required a lot of digging in the header files of the 8266. Note the const of RTSPin and CTSPin are not used.

const int RTSPin = GPF15; // GPIO15 for RTS
U0C0 |= 0x08000; // this sets tx (rx_flow_en) flow control via MTDO( RTS )

const int CTSPin = GPF13; // GPIO13 for CTS input
U0C1 |= 0x00800000; // 2^24; // UCRXHFE enable rx flow control (rx_flow_en)
// set fifo threshold levels note: setting threshold may not be necessary
const long UART_RX_FLOW_THRHD = 0x0000007F; // FIFO threshold level 0-7 bits 0-127
const long UART_RX_FLOW_THRHD_S = 16; // starts at bit 16
U0C1 |= UART_RX_FLOW_THRHD << UART_RX_FLOW_THRHD_S;

// set pin function the hard way
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_UART0_CTS); // function 5 according to
// ESP8266_Pin_List_141105.xlsx
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_UART0_RTS);

I think the "secret" was the mux of the pins in the last two statements. I found this earlier in another post but the parameters of the PIN_FUNC_SELECT were either wrong or changed so I didn't try it.

Re: Hardware flow control

PostPosted: Sun Mar 24, 2019 11:31 pm
by JimDrew
What routine do yo have for PIN_FUNC_SELECT() ??

This generates an error when trying to compile with the Arduino IDE because that function does not exist.

Also, how do you have this wired? ie. CTS on ESP8266 to RTS on RS232 interface/micro/etc.?