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);
}
uart2 cannot send
-
- Posts: 9708
- Joined: Thu Nov 26, 2015 4:08 am
Re: uart2 cannot send
How do you declare u2buf?
Who is online
Users browsing this forum: No registered users and 84 guests