hi everyone,
length=uart_read_bytes(UART_NUM_0,buff,2000, 100/ portTICK_RATE_MS);
the above API has a peculiar behaviour where in if i specify 2000 bytes as the limit in the API and if i send 4000 bytes of data but unfortunately it is printing only last 2000 bytes of data (my application is to print all the received data). My requirement is to fetch 2000 bytes in batches to print complete data been sent(in case of 4000 bytes of data it should be 2 batches of 2000 bytes).is there any solution or API to achieve this requirement.
thanks
uart flow control issue
Re: uart flow control issue
Could it be that you have to write your own buffer in which to store the incoming bytes being received from serial? For example, performing a uart_read_bytes() may receive the bytes that are currently coming in until the maximum is received. But it may be that if you are not actively reading bytes then they are just being dropped? Maybe you need an interrupt handler set of functions which get called whenever new data is received from UART ... you then save that data in a buffer. Now your logic can read from the buffer without worrying about not being in the right place at the right time to receive the data?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
-
- Posts: 51
- Joined: Sat Mar 17, 2018 4:49 am
Re: uart flow control issue
hi ,
i have a requirement where in i need a buffer to fetch 100kb file data in batches of 1kb so that with 100 batches i can fetch the complete file, so is there any API or any logical function which can meet this requirement. In another means i want to fetch 1kb of data , halt the receiving data and process the received data -> again resume the receiving of data -> collect 1kb of data , halt the receiving data -> process the received data and so on till the complete file is processed.
i have a requirement where in i need a buffer to fetch 100kb file data in batches of 1kb so that with 100 batches i can fetch the complete file, so is there any API or any logical function which can meet this requirement. In another means i want to fetch 1kb of data , halt the receiving data and process the received data -> again resume the receiving of data -> collect 1kb of data , halt the receiving data -> process the received data and so on till the complete file is processed.
Who is online
Users browsing this forum: MicroController and 86 guests