Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with UART2 when resetting ESP32 (it has been already fixed over the web) #1584

Closed
euquiq opened this issue Jul 3, 2018 · 1 comment

Comments

@euquiq
Copy link

euquiq commented Jul 3, 2018

Hi!

I use the three hardware serial ports on my ESP32. Problem is that when I restart the ESP32, UART1 and UART2 are corrupted. That is: I cannot get anything through them, no matter what.

I did google it, and found out that this already has been discussed in here and other places:

https://www.esp32.com/viewtopic.php?t=4960

But never actually been fixed.

So the manual patch for now was:

  1. search for espressif\esp32\cores\esp32\esp32-hal-uart.c
  2. Find the sub void uartFlush(uart_t* uart)
  3. And replace the whole sub with:
void uartFlush(uart_t* uart)
{
    if(uart == NULL)
    {
    return;
    }
    UART_MUTEX_LOCK();
    while(uart->dev->status.rxfifo_cnt != 0 || (uart->dev->mem_rx_status.wr_addr != uart->dev->mem_rx_status.rd_addr))
    {
       READ_PERI_REG(UART_FIFO_REG(uart->num));
    }
UART_MUTEX_UNLOCK();
}

I am posting this iisue as reminder that the problem is still here, but there is already a "fix" (at least for me, it gives me back UART2 after an ESP.restart())

Regards,

Enrique

@me-no-dev
Copy link
Member

Here it is :) 12ca9e8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants