Page 1 of 2
Extend ESP32 UART interfaces, Is it possible?
Posted: Wed Jul 26, 2017 2:47 pm
by Prasad
I'm looking to have a 5 serial connections with ESP32 and preferably with hardware UART connections, But we can use only 2 out of total 3 UART peripherals because one is already using for serial flash. So i'm wondering if there is a way to extend UART interfaces or should i go with Software UART interfaces? If so how? Please advice.
Re: Extend ESP32 UART interfaces, Is it possible?
Posted: Thu Jul 27, 2017 4:15 am
by samsam
You have 3 on the chip that you can use on almost any of the pads available through the driver provided with esp-idf!
And 2 more you can get with external IC like NXP SC16IC7x2 which is Dual UART with I²C-bus/SPI interface
Re: Extend ESP32 UART interfaces, Is it possible?
Posted: Fri Jul 28, 2017 1:40 am
by ESP_Sprite
Also, if your connections are half-duplex with the ESP32 sending commands and the peripherals just replying, you may get away using only one UART channel and using the GPIO matrix to multiplex it to different pins. Does have the disadvantage that you cannot receive data on a channel that is not currently muxed to RX, hence the restriction of half-duplex with the ESP32 sending commands.
Re: Extend ESP32 UART interfaces, Is it possible?
Posted: Fri Jul 28, 2017 3:33 am
by Prasad
Actually i need full duplex function for my application so i thought to use SC16IS762IBS from NXP as @samsam mentioned. Any better modules provide dual UART before i order this?
https://www.digikey.com/product-detail/ ... -ND/946249
Re: Extend ESP32 UART interfaces, Is it possible?
Posted: Fri Jul 28, 2017 8:56 am
by loboris
I'm usualy using Atmel ATXMega microcontrollers for situations like this. For example, with ATXMEGA32 you can get 4 UARTS and I2C interface to ESP32, and you can program it to work in a way you want it. You can also use it as port expander, spi expander, etc.
Re: Extend ESP32 UART interfaces, Is it possible?
Posted: Fri Jul 28, 2017 10:33 am
by Prasad
So is ATXMEGA32 capable of handling simultaneous 4 UART channels. Actually i'm trying to communicate with 5 SIM900 modules simultaneously with ESP32 and i'm running FreeRTOS. Any suitable recommendations for that purpose? I'm also worried that i have to program the Atmel chip to achieve above purpose?
Re: Extend ESP32 UART interfaces, Is it possible?
Posted: Fri Jul 28, 2017 11:35 am
by WiFive
You can't use flow control and timeshare the uarts?
Re: Extend ESP32 UART interfaces, Is it possible?
Posted: Fri Jul 28, 2017 11:51 am
by Prasad
I'm not sure what you are referring here. Can you explain little bit more how to achieve this with freeRTOS?
Re: Extend ESP32 UART interfaces, Is it possible?
Posted: Fri Jul 28, 2017 3:55 pm
by loboris
Prasad wrote:So is ATXMEGA32 capable of handling simultaneous 4 UART channels. Actually i'm trying to communicate with 5 SIM900 modules simultaneously with ESP32 and i'm running FreeRTOS. Any suitable recommendations for that purpose? I'm also worried that i have to program the Atmel chip to achieve above purpose?
ATXMEGA is perfectly capable to handle simultaneous 4 UART channels (interrupt based, and xmega works at 32MHz), of course, you have to program it to achieve this (or any) functionality.
If I may ask, for what purpose do you need 5 SIM900 modules? I'm working with SIM800 module attached to ESP32 using PPPoS, so it is possible to use all network functions the same way they are used with WiFi. It works perfectly for couple of months now. ESP32 is comunicating with couple of servers using ftp, sftp, mqtt, ...
You can look at my
basic example and
example with cURL .
Another approach could be to simply multiplex Tx&Rx pins with external multiplexer (for example 74HC4052D). I've used this configuration in some other projects and it works well. It is the most simple & cheapest approach.
Re: Extend ESP32 UART interfaces, Is it possible?
Posted: Fri Jul 28, 2017 5:32 pm
by Prasad
Thanks @loboris for the valuable explanation. Now i'm interested in multiplex Tx&Rx solution as you mentioned and it seems to be the simplest approach. Before that i was considering(Well, couldn't try that yet) switch a single UART connection between 5 SIM900 modules to perform actions, Then it will not be simultaneous of course.
I'm using 5 SIM900 modules to build online top up mechanism for selected telco carriers in here. So it requires 5 telco carriers to be standby to perform topup requests coming through MQTT connection. Any thoughts/corrections/suggestions about my design architecture would be greatly appreciated