Configuration for ESP32 devices more than 1 UART

Industrial Arduino ESP32 Home FORUMS Example programs Configuration for ESP32 devices more than 1 UART

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #5416
    deltatest
    Participant

    For NORVI IIOT devices supporting more than 1 UART channels, a modification of the original drivers are required.
    Maximum of 3 UART channels are supplied with NORVI IIOT range controllers. Adhering to following pinout.
    UART0 : TX-IO2 / RX-IO4 (Standard UART 0)
    UART1 : TX-IO26 / RX-IO25
    UART2 : TX-IO1 / RX-IO3

    Problem :
    By Default ESP32 drivers installed ; the UART channels are assigned to different GPIO, some GPIOs assigned by default causes ESP32 restart after initializing uart channels.

    ESP32 Unusable pins

    Solution :
    The default ESP32 UART driver installed must be edited to GPIO used by NORVI IIoT.

    Procedure :

    1) Locate the HardwareSerial.cpp in the Arduino Installation

    C:\User Account\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\cores\esp32

    or

    Arduino Directory\hardware\espressif\esp32\cores\esp32
    HardwareSerial.cpp Location ESP32

     

    2) Edit the GPIO assigned to the UART channel in HardwareSerial.cpp

     

    if(_uart_nr == 0 && rxPin < 0 && txPin < 0) {

    rxPin = 3;

    txPin = 1;

    }

    if(_uart_nr == 1 && rxPin < 0 && txPin < 0) {

    rxPin = 4;

    txPin = 2;

    }

    if(_uart_nr == 2 && rxPin < 0 && txPin < 0) {

    rxPin = 25;

    txPin = 26;

    }

    ESP32 HardwareSerial.cpp Edit

    Sample program is attached to test the UART functions of NORVI Industrial ESP32 controllers.

    Attachments:
    You must be logged in to view attached files.
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.