I think I found a bug in nrf_ringbuf_cpy_get. The first memcpy is wrong. The source and destination should be swapped.
if (length > trail)
{
memcpy(&p_ringbuf->p_buffer[masked_rd_idx], p_data, trail);
length -= trail;
masked_rd_idx = 0;
p_data += trail;
}
memcpy(p_data, &p_ringbuf->p_buffer[masked_rd_idx], length);
p_ringbuf->p_cb->rd_idx += *p_length;