uart2 cannot send

aih5165
Posts: 15
Joined: Thu Aug 25, 2016 1:32 pm

uart2 cannot send

Postby aih5165 » Sun Sep 17, 2017 1:13 pm

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);
}

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

Re: uart2 cannot send

Postby ESP_Sprite » Mon Sep 18, 2017 1:30 am

How do you declare u2buf?

Who is online

Users browsing this forum: Google [Bot] and 85 guests