ESP32 Unit testing doesn't work

Hey everyone,
I’m using the ESPDUINO-32 for my UART Flow Control project, in which I communicate with a device via the GPIO pins of the development board using AT-Commands(8N1,9600bps).
I’m programming on VSCODE using the PlatformIO embedded environment for my unit testing, and that how my platformio.ini looks like:
platformio.init PIC

I’m also running on an ESP-IDF framework, and I already had success with running a simple test on the embedded environment:


Here is the structure of my project file:

The problem is that when I try to unit test my actual code, the development kit doesn’t give any output.
In the project, I’m using the gpio.h & uart.h libraries to config the output and input pins for the UART Flow Control.
I’m using for this project UART1 and the following gpio pins:
I should mention that I’m configuring the GPIO pins and UART port as follows:

uart_config_t uart_config =
          .baud_rate = 9600,
          .data_bits = UART_DATA_8_BITS,
          .parity = UART_PARITY_DISABLE,
          .stop_bits = UART_STOP_BITS_1,
          .flow_ctrl = UART_HW_FLOWCTRL_DISABLE};


  if (uart_driver_install(UART_PORT, RX_BUF_SIZE, TX_BUF_SIZE, 20, 0, 0) != ESP_OK)
    ESP_LOGE(TAG1, "install uart driver failed");
  if (uart_param_config(UART_PORT, &uart_config) != ESP_OK)
    ESP_LOGE(TAG1, "config uart parameter failed");


  gpio_set_direction(RESET_PIN, GPIO_MODE_INPUT_OUTPUT);
  gpio_set_direction(PWR_PIN, GPIO_MODE_INPUT_OUTPUT);

  gpio_set_level(RESET_PIN, 1);
  gpio_set_level(PWR_PIN, 0);
  gpio_set_level(RTS_PIN, 1);

Furthermore, I also used the menuconfig of the esp-idf framework in platformio to ensure I’m using UART1 for the HWFC:

When I try to unit test my code, here is monitor output:

> Executing task: C:\Users\omrib\.platformio\penv\Scripts\platformio.exe test --environment espduino32 <

Verbose mode can be enabled via `-v, --verbose` option
Collected 2 items

Processing test_embedded in espduino32 environment
If you don't see any output for the first 10 secs, please reset board (press reset button)

ets Jun  8 2016 00:22:57
configsip: 0, SPIWP:0xee
mode:DIO, clock div:2
ho 0 tail 12 room 4
entry 0x4008069c

I just saw on Device Manager on my computer that I have another communication port:

I hope I was clear and explicit about my problem, would love for your help :smiley:

Here you specify 9600 baud but the bootloader and test_speed is at 115200?

1 Like

Yes,I realized so because that’s how my simple embedded test passed.
am I wrong?
What should I do?

Can you upload your whole project for reference?

1 Like

Unfortunately, I can’t share my code but i can give you more information/ send you parts of my project that doesn’t expose my code.
What information could help you help me?

Come again, you re-initialize the UART where the test ouput is sent to to 9600 baud during the test? Or is the test_port UART different from the UART you’re configuring?

So the development board has 2 UART ports, UART0 is the default one on which i communicate with my computer. UART1 is the port i try to communicate via the GPIO pins with HWFC pins. I believe test_port is UART0 In which monitor_speed = 115200 and because of that test_speed =115200.