Chat freely about anything...

User avatar
By kript0n
#42568 Hey. I'm using esp8266 as tcp-uart bridge. When I begin transmitting I get network freezing. Try to ping router and get this:

Image
I'm stumped with that. It's not router problem, just tested with torrent and ping time is about 5-10ms.

Transmission function in esp:
Code: Select allLOCAL ICACHE_FLASH_ATTR void communication_task(os_event_t *events)
{
    #ifdef DEBUG
    os_printf("Communication task\r\n");
    #endif // DEBUG
    struct espconn *conn = TCP_get_current_conn();
    if(events->sig == EVENT_UART_MESSAGE)
    {
        uint16 remaining = uart_available();
        uint8  buf[remaining];
        uint16 k = 0;
        while(remaining-- > 0)
        {
            buf[k++] = uart_read();
        }

        if(conn != NULL)
        {
            espconn_send(conn, buf, k);
        }
    }
    else if(events->sig == EVENT_TCP_MESSAGE)
    {
        CircularBuffer *buffer = (CircularBuffer*)conn->reverse;
        TCP_data *data = CircularBuffer_get(buffer);
        while(data != NULL)
        {
            uint8 i = 0;
            for(; i<data->len; i++)
            {
                uint8 t = data->ptr[i];
                uart0_tx_buffer(&t, 1);
            }
            os_free(data);
            data = CircularBuffer_get(buffer);
        }
    }
}