This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

app_fifo wrapping problem

The app_fifo support e.g. in SDK 12.1.0, appears to have a serious problem when the read_pos/write_pos values wrap. i.e. when the fifo has been used over a period of time, regardless of the configured fifo size, since the pos vars are continually incremented with use over time, there will come a point when the write_pos wraps beyond 0xffffffff and read_pos will typically lag behind. Once the write_pos has wrapped, fifo_length() will return a incorrect value until read_pos has wrapped too! During this time other things will go wrong too such as app_fifo_put() failing due to the "if (FIFO_LENGTH() <= p_fifo->buf_size_mask)" check failing -even if the fifo is not actually full!

This appears to affect not just direct use of app_fifo from the application but also indirect use e.g. via app_uart_fifo i.e. as used in the UART driver support.

This must surely be a problem for apps built with the SDK? Is the same source used in the softdevices!? If so, they would have a problem too.

Apologies in advance if I've missed something that means it is not actually a problem (which would be great)

Thanks

Related