This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NRF9160 problem with rx buffer in lpuart sample

Hello!
I'm trying to use this low power UART sample: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/nrf/samples/peripheral/lpuart/README.html
I have a problem when I try to read data from rx buffer as is done in the example. The problem is that when I received information in rx buff the buffer is filled with all the information previously received.
There is a way to clean the buffer on each time that I received the data?

This is the log when I received data:

Parents
  • Hi,
    asuming you are  using the uart in "async" mode, you should get an offset in the callback in evt->data.rx.offset 

    The following is the evt->data.rx structure

    /**
     * @brief UART RX event data.
     *
     * The data represented by the event is stored in rx.buf[rx.offset] to
     * rx.buf[rx.offset+rx.len].  That is, the length is relative to the offset.
     */
    struct uart_event_rx {
    	/** @brief Pointer to current buffer. */
    	uint8_t *buf;
    	/** @brief Currently received data offset in bytes. */
    	size_t offset;
    	/** @brief Number of new bytes received. */
    	size_t len;
    };

    In case you are using "interrupt driven" mode, I cannot help you, as I have never used it. (I am not nordic staff btw, you should also wait for an aswer from them) 

Reply
  • Hi,
    asuming you are  using the uart in "async" mode, you should get an offset in the callback in evt->data.rx.offset 

    The following is the evt->data.rx structure

    /**
     * @brief UART RX event data.
     *
     * The data represented by the event is stored in rx.buf[rx.offset] to
     * rx.buf[rx.offset+rx.len].  That is, the length is relative to the offset.
     */
    struct uart_event_rx {
    	/** @brief Pointer to current buffer. */
    	uint8_t *buf;
    	/** @brief Currently received data offset in bytes. */
    	size_t offset;
    	/** @brief Number of new bytes received. */
    	size_t len;
    };

    In case you are using "interrupt driven" mode, I cannot help you, as I have never used it. (I am not nordic staff btw, you should also wait for an aswer from them) 

Children
No Data
Related