I slightly modified the qspi example code to try something that I'd eventually like to implement as part of my application. But when I try to interleave reads and writes then I get inconsistent data.
I made sure that my read write addresses are 4byte aligned, so that should not be a problem. Also another thing I noticed is that if I write the whole array m1 in one nrf_drv_qspi_write() call, and then read it into m2 in one nrf_drv_qspi_read() call - then the data is consistent. Only when I interleave read and write calls of smaller chunks, I see an issue.
Here is the code to illustrate what I'm doing.
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
typedef struct {
uint8_t buffer[6];
uint32_t value;
} my_struct;
my_struct m1[19], m2[19];
int main(void)
{
uint32_t i;
uint32_t err_code;
err_code = NRF_LOG_INIT(NULL);
APP_ERROR_CHECK(err_code);
NRF_LOG_DEFAULT_BACKENDS_INIT();
NRF_LOG_INFO(""
"QSPI write and read example using 32bit addressing mode");
srand(0);
And when this is the output for the code:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<info> app: QSPI write and read example using 32bit addressing mode
<info> app: QSPI example started.
<info> app: Process of erasing first block start
<info> app: Compare...
<info> app: Struct size 12
<info> app: Data inconsistent at index 0
<info> app: WRITE -> 1 2 3 4 3 1234
<info> app: READ -> 0 0 1 0 0 1024
<info> app: Data inconsistent at index 1
<info> app: WRITE -> 2 3 4 5 4 1235
<info> app: READ -> 0 1 0 0 0 1024
<info> app: Data inconsistent at index 2
<info> app: WRITE -> 3 4 5 6 5 1236
<info> app: READ -> 1 0 1 0 0 1024
<info> app: Data inconsistent at index 3
<info> app: WRITE -> 4 5 6 7 6 1237
<info> app: READ -> 0 1 2 0 0 0
<info> app: Data inconsistent at index 4
<info> app: WRITE -> 5 6 7 8 7 1238
<info> app: READ -> 1 2 3 0 0 0
<info> app: Data inconsistent at index 5
Please let me know if I'm doing something horribly wrong or if this is a known issue with a workaround.