What is the best way to read the async data received on a UART in to a buffer when ever there is an a byte available and in a separate task read the data from the buffer as and when needed.
For receiving uart data byte-for-byte, you can set up your project similar to this:
But, I would recommend that you do as little processing as possible in the UART interrupt handler, by for instance passing the data to a FIFO or using a system workqueue, or which ever other method you prefer.
If you require more advance uart handling (with RX timeouts, specific sizes, etc), I would recommend that you look into the uart_async module. There's a test-program for it here, which includes several uses of it:
Mean while i have figured it out the way you suggested in your first link, but i am ring_buf_put() to collect byte by byte in ISR call back and in task i use ring_buf_get() to get the data when ever needed, i hope ring_buf_put() is not bulky to use in ISR?
That should be fine. The documentation even lists uart reception as one of the main use-cases: