uart flow control issue

ningappa BS
Posts: 51
Joined: Sat Mar 17, 2018 4:49 am

uart flow control issue

Postby ningappa BS » Fri May 18, 2018 1:08 pm

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

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: uart flow control issue

Postby kolban » Fri May 18, 2018 5:37 pm

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

ningappa BS
Posts: 51
Joined: Sat Mar 17, 2018 4:49 am

Re: uart flow control issue

Postby ningappa BS » Sat May 19, 2018 7:48 am

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.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: uart flow control issue

Postby WiFive » Sat May 19, 2018 8:06 am


Who is online

Users browsing this forum: Baidu [Spider], OSCPUDEV and 114 guests