Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By fvpalha
#19217 Hi.

We are using the ESP-12 and we need send data by UART0.
We are using the Unofficial Development Kit for Espressif ESP8266 (http://www.programs74.ru) and Absolutely transparent bridge for the ESP8266 (https://github.com/beckdac/ESP8266-transparent-bridge).

The problem is the garbage on start.
We are using GPIO15 to signal the beginning of the UART0.
We are using GPIO4 to signal the beginning of the uart_tx_one_char().
Code: Select allLOCAL STATUS
uart_tx_one_char(uint8 uart, uint8 TxChar)
{
   // INTCOM em alta - envio de comando
   gpio_write(GPIO_4_PIN, 1);

   while (true)
   {
      uint32 fifo_cnt = READ_PERI_REG(UART_STATUS(uart)) & (UART_TXFIFO_CNT<<UART_TXFIFO_CNT_S);
      if ((fifo_cnt >> UART_TXFIFO_CNT_S & UART_TXFIFO_CNT) < 126) {
         break;
      }
   }

   WRITE_PERI_REG(UART_FIFO(uart) , TxChar);
   return OK;
}


How to avoid garbage in UART0 after restart of ESP8266?
You do not have the required permissions to view the files attached to this post.
User avatar
By tytower
#19234 From what I've seen when it resets it dumps this out on 75000 baud odd then changes serial speed to 115200 baud . I would expect this will be the same each reset so can you have your program skipp so many bytes of data to some point you know that it will be at the later baud rate? Or perhaps time it ,say 5 seconds delay before you use UART
User avatar
By fvpalha
#19378 I added this tip too:
http://www.esp8266.com/viewtopic.php?f=6&t=425&p=1827&hilit=softAP+dhcp+server+start#p1827

Code: Select allLOCAL void ICACHE_FLASH_ATTR
uart1_write_char(char c) {
   uart_tx_one_char(UART1, c);
}

void ICACHE_FLASH_ATTR
uart_init(UartBautRate uart0_br)
{
   UartDev.baut_rate = uart0_br;
   uart_config(UART0);

   // install uart1 putc callback
   os_install_putc1((void *)uart1_write_char);
}