XtGem Forum catalog

Introduce.

This function is only supported on 2.7.2 or higher. This is an advanced feature that allows users to interfere into the output controller by pin mapping on ESP32 to ESPrtk ..

In this way, the selection and placement of the output pins on ESP32 will not depend on the default configuration, making it easier for users to redesign their own ESPrtk PCB board.

This is a special feature and it is hidden when accessed in the Web Config.
To be able to access this page, after the login Profile, type 192.168.4.1/system to enter System page.

This page showing with a black background interface , users can drag and drop ESP32 pins into the frame corresponding to ESPrtk. Click “Save” button to save the configuration.

Or user can enter the JSON string into the text field and click “Save as JSON” to save the configuration.

After that, ESPrtk will check the logic, if there is no error, it will print “Config GPIO save success” in the Submit status box.

At the same time, it export a JSON string, clicks “Copy output” to save it in Clipboard as text and paste it anywhere.

Configure data will store in FLash in ESP32 .

After restarting , GPIO configuration information will be printed on the Serial port (TX_UART0 baud 230400)  and load this configure to all function before main program start. 

Video

Default config from ESPrtk Factory (JSON):

This is the default configuration on ESPrtk, you may need it to restore to the default configuration state, just Copy it, paste it into the JSON box and click “Save as JSON”.

(Copy all text in box)

{ "CWB_BUTTON" : "13" , "RX_UART0" : "3" , "MOSI_SPI" : "23" , 
"ESPrtk_0" : "0" , "TX_UART0" : "1" , "MISO_SPI" : "19" ,
 "ESPrtk_1" : "25" , "RX_UART1" : "17" , "SCK_SPI" : "18" ,
 "ESPrtk_2" : "32" , "TX_UART1" : "5" , "CONNECT_LED" : "15" ,
 "ESPrtk_3" : "33" , "RX_UART2" : "16" , "ERROR_LED" : "2" ,
 "ESPrtk_4" : "34" , "TX_UART2" : "4" , "NEOPIXEL_LED" : "14" ,
"ESPrtk_5" : "35" , "SCL_I2C" : "22" , "SCL_OLED" : "27" ,
 "ESPrtk_6" : "36" , "SDA_I2C" : "21" , "SDA_OLED" : "26" , 
"ESPrtk_7" : "39" }

The above configuration will correspond to the diagram below:

Application .

Besides helping make PCB design more flexible, this feature allows ESPrtk to be compatible on all hardware boards with different pinout designs.

For example: WEMOS / Lolin ESP32 OLED board.

This module is integrated OLED LCD on GPIO5 (SDA_2) and GPIO4 (SCL_2) on board ( ESPrtk also supports OLED display ).

However, by default pin GPIO5 and GPIO4 on ESP32 are TX_UART1 and TX_UART2 of ESPrtk (see default JSON above) so we will swap the configuration on 6 pin, specifically:

  • SCL_OLED : from  4   to 27
  • SDA_OLED : from  5  to 26
  • TX_UART2 : from  25 to 4
  • TX_UART1 : from  26 to 5
  • RX_UART1 : from  36 to 25
  • ESPrtk_6 : from  27  to 36

And other pins remain the same as default.

The JSON code should be : 

(copy all text in box)

{ "CWB_BUTTON" : "13" , "RX_UART0" : "3" , "MOSI_SPI" : "23" , 
"ESPrtk_0" : "0" , "TX_UART0" : "1" , "MISO_SPI" : "19" , 
"ESPrtk_1" : "17" , "RX_UART1" : "36" , "SCK_SPI" : "18" , 
"ESPrtk_2" : "32" , "TX_UART1" : "26" , "CONNECT_LED" : "15" , 
"ESPrtk_3" : "33" , "RX_UART2" : "16" , "ERROR_LED" : "2" , 
"ESPrtk_4" : "34" , "TX_UART2" : "25" , "NEOPIXEL_LED" : "14" , 
"ESPrtk_5" : "35" , "SCL_I2C" : "22" , "SCL_OLED" : "4" , 
"ESPrtk_6" : "27" , "SDA_I2C" : "21" , "SDA_OLED" : "5" , 
"ESPrtk_7" : "39" }

The above configuration will correspond to the board below:

Connect with some componant as ESPrtk standard :

Then , you can connect it to the GNSS RTK modules here:

Connect ESPrtk with RTK Receiver and some other modules.

Note : this board only has 23 GPio Pin , so we cannot add SPI and I2C pin on it , that mean Ethernet and SD Card cannot use on this board !

Exceptions .

ESPrtk supports changing all output pins. However, not all configurations are accepted.

–  GPio 21 (ESP32) has been hard-coded for SDA_I2C pins, and users cannot change it. If you change it, ESPrtk will report “Error: Pin GP [21] must map to SDA_I2C!”

-Some GPio pins of ESP32 cannot be used for ESPrtk if it does not fully support. See table below 

GPio (ESP32) map to ESPrtk ( Input ).. map to ESPrtk ( Output )
Input-Output YesYes
Input OnlyYesNo
Output OnlyNoYes

Sometime the configuration is successfully saved (passes the Logic test) but ESPrtk will fail or not work properly, this depends on how the user configures and how ESP32 work with that configuration.

So users need to know the limitations of output pin on ESP32. Below is a brief summary ( see detail tutorial here https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ )
 
 
GPIO (ESP32) Input Output Notes
0 pulled up OK outputs PWM signal at boot
1 TX pin OK debug output at boot
2 OK OK connected to on-board LED
3 OK RX pin HIGH at boot
4 OK OK  
5 OK OK outputs PWM signal at boot
6 x x connected to the integrated SPI flash
7 x x connected to the integrated SPI flash
8 x x connected to the integrated SPI flash
9 x x connected to the integrated SPI flash
10 x x connected to the integrated SPI flash
11 x x connected to the integrated SPI flash
12 OK OK boot fail if pulled high
13 OK OK  
14 OK OK outputs PWM signal at boot
15 OK OK outputs PWM signal at boot
16 OK OK  
17 OK OK  
18 OK OK  
19 OK OK  
21 OK OK  
22 OK OK  
23 OK OK  
25 OK OK  
26 OK OK  
27 OK OK  
32 OK OK  
33 OK OK  
34 OK   input only
35 OK   input only
36 OK   input only
39 OK   input only

Continue reading for a more detail and in-depth analysis of the ESP32 GPIOs and its functions.

Input only pins

GPIOs 34 to 39 are GPIs – input only pins. These pins don’t have internal pull-ups or pull-down resistors. They can’t be used as outputs, so use these pins only as inputs:

  • GPIO 34
  • GPIO 35
  • GPIO 36
  • GPIO 39

Some note .

Just one note.
If you forget your configure, you still see it on TX_UART0 when device restaring and Be careful when change GPIO13 , it is for CWB_BUTTON to startup Web Configure.  

This change is legal because it is a feature supported by ESPrtk itself, you won’t need to worry about violating our proprietary hardware design.

We do not recommend changing the default settings of ESPrtk, unless the changing hardware connection is impossible or the change is really meaningful and helpful for your system . Because this customization will make the design documents varied and there are no common conventions when talking about them. That’s not really a good thing.