Can someone guide on how to use esp8266 hardware serial port2 uart2(D7,D8)
What do you want to connect to it ?
GSM Module, A9G
What type of serial interface does it have ?
Something else ?
RS232, RX from GSM is connected to ESP8266 TX and TX from GSM is connected to ESP8266 RX directly and GND to GND.
You need to convert the TTL levels of the ESP8266 to the RS232 levels of the GSM and vice versa
I need coding, hardware I will handle
I am pretty sure that UART1 on the ESP8266 is TX only, and UART2 does not exist. The pins you are referring to are the alternate pins to UART0. As Bob mentioned already you will need to make sure that you don't exceed 3.3v on the RX-pin, it is not 5v Tolerant !
you can swap UART0 between the pins by using
once swapped UART reception and transmission happens on pin D7 & D8, this also means that you will not have access to that UART via USB, until you swap() back. There is no harm in swapping back and forth, but of course you may lose any data that you want to receive on those pins while the other pins are enabled.