Closed romocitto88 closed 4 years ago
Way too much code to wade through, but I'll take a guess that it's the issue that started, or is related to, this issue: https://github.com/espressif/esp-idf/issues/4537
This issue is something different: when a byte with value 0x00 is reached from Usart causes a stop of reading. For example if my frame is: "0x01 0x02 0x03 0x00 0x01 0x03", when I exec:
[..]
uart_read_bytes(UART_NUM_1,temp,event.size,portMAX_DELAY);
[..]
The function writes in my buffer "temp" only: {0x01, 0x02, 0x03} So it's truncated.
Hmm...if the 0x00 is being seen by the uart as a break character and code higher up flushes the buffer on break detect? Again, just guessing.
The event queue even_type never equals to UART_BREAK, so i presume that the break isn't decteted.
Ok, so that seems to rule out break detect issues.
Is there a long enough time between 0x03 and 0x00 to trigger a timeout?
I found the problem! And it's a very stupid error. This issue can be closed.
I'm sorry.
ok i also figured it out , its really stupid. I was trying to do UART between arduino and esp32. the problem is on arduino side it doesnt transmit after the 0x00. also i want to say if you post your problem online and figured it out later on, please write the solution.
In function
void uart_task (void * pvParameters)
I was showing, in the serial debug, the UART frame whit this line:
ESP_LOGE (GATTC_TAG," WR: ---% s --- \ n ", temp);
But it is wrong, because the "temp" buffer, in my case, was not a string but a sequence of byte. So, when 0x00 value was found for the first time, the frame was resulting truncated.
Environment
Problem Description
I'm using the ble server and client uart bridge example to send my frame from side A to side B and viceversa. I found that the reading of Uart bytes stops when found a 0x00, so the frame is incomplete. Anyone know how to solve it?
Code to reproduce this issue