Hi everyone,
I am experimenting with the QSPI example provided with SDK 16. I am facing issues when I try to erase memory blocks or the entire chip.
1. First of all I try to erase the entire chip calling the functions below (either the first or the second one), however for both cases the system crashes end restarts..
err_code = nrf_drv_qspi_erase(NRF_QSPI_ERASE_LEN_ALL, 0); err_code = nrfx_qspi_chip_erase();

2. The second problem I am facing is when I try to erase a specific memory block. The snippet bellow:
- Erases a 64KB memory block starting from address 0
- Writes 8 bytes to the memory starting from address 0
- Erases a 4KB memory block starting from address 4000
- Read the first 8 bytes of the memory
- Compares Tx and Rx
m_finished = false;
err_code = nrf_drv_qspi_erase(NRF_QSPI_ERASE_LEN_64KB, 0); // NA - nrf_drv_qspi_erase, Function for starting erasing of one memory block
APP_ERROR_CHECK(err_code);
WAIT_FOR_PERIPH();
NRF_LOG_INFO("Process of erasing first block start");
err_code = nrf_drv_qspi_write(m_buffer_tx, QSPI_TEST_DATA_SIZE, 0); // NA - nrf_drv_qspi_write, Function for writing data to QSPI memory.
APP_ERROR_CHECK(err_code);
WAIT_FOR_PERIPH();
NRF_LOG_INFO("Process of writing data start");
m_finished = false;
err_code = nrf_drv_qspi_erase(NRF_QSPI_ERASE_LEN_4KB, 4000); // NA - nrf_drv_qspi_erase, Function for starting erasing of one memory block
APP_ERROR_CHECK(err_code);
WAIT_FOR_PERIPH();
NRF_LOG_INFO("Process of erasing first block start");
err_code = nrf_drv_qspi_read(m_buffer_rx, QSPI_TEST_DATA_SIZE, 0); // NA - nrf_drv_qspi_read, Function for reading data from QSPI memory.
WAIT_FOR_PERIPH();
NRF_LOG_INFO("Data read");
for (i = 0; i < QSPI_TEST_DATA_SIZE; i++) {
NRF_LOG_INFO("Data %d. %d", i, m_buffer_rx[i])
}
NRF_LOG_INFO("Compare...");
if (memcmp(m_buffer_tx, m_buffer_rx, QSPI_TEST_DATA_SIZE) == 0) // memcpy() is used to copy a block of memory from a location to another
{
NRF_LOG_INFO("Data consistent");
} else {
NRF_LOG_INFO("Data inconsistent");
}
The problem is that when I write the memory (step 2) and then erase a block (step 3), the written data erased when the starting address (of nrf_drv_qspi_write() function) is between 0-4092. When I read the first 8 bytes of memory, I read nothing (255) as shown below.. And also comparing the Tx with Rx the data are inconsistent.. I cannot understand what is going on.. Iam not able to erase any memory block between the address range 8-4092 without losing the written data..

However when I use as a starting address >= 4096 to erase the memory block then surprisingly I do not have any problem. I can read the written data and comparing Tx with Rx the data are consistent
err_code = nrf_drv_qspi_erase(NRF_QSPI_ERASE_LEN_4KB, 4096);
Could you provide some help on these issues?
Thanks in advance
Nick