Page 1 of 1

uart2 cannot send

Posted: Sun Sep 17, 2017 1:13 pm
by aih5165
while(1)
{
//Read data from UART
int len = uart_read_bytes(UART_NUM_2, data, BUF_SIZE, 20 / portTICK_RATE_MS);
//Write data back to UART
u2buf[0] = 0x01;
u2buf[1] = 0x03;
u2buf[2] = 0x04;
u2buf[3] = 0x1A;
u2buf[4] = 0x00;
u2buf[5] = 0x2A;
u2buf[6] = 0xE4;
u2buf[7] = 0xE2;
uart_write_bytes(UART_NUM_2, (const char*) u2buf, 8); // cannot send out,nothing happened?????????????????please why???

uart_write_bytes(UART_NUM_2, (const char*) data, len); // but this one always worked!!!!!!!!!
vTaskDelay(1000 / portTICK_RATE_MS);
}

Re: uart2 cannot send

Posted: Mon Sep 18, 2017 1:30 am
by ESP_Sprite
How do you declare u2buf?