Hello,
Aim : To write and read x bytes from the QSPI interfaced external PSRAM(APS6404L-3SQR) using the nRf52840.
Configuration : Following is the configuration of the QSPI
Protocol layer interface configuration
Execute in place operation : OFF
Interrupt Priority : 6
Read and Write Opcode : 4 Input/Output
Addressing Mode : 24 Bit
Deep Power-Down Mode: OFF(false)
Physical layer interface configuration
QSPI Frequency : 32MHz/1
SCLK Delay : 1
SPI Mode : 0
Deep Power-Down Mode: OFF(false)
Operation : write/read the PSRAM and wait for the ready interrupt
Problem : We observed that sometimes the interrupt never gets generated.
Following are the functions for the read and write operation
Please let us know why we are facing this condition?
/*
* FUNCTION NAME: QspiEvtHandler
* PARAMETER :
* ACTION : Handler for QSPI, event is generated once qspi finished read/write operation
*/
void QspiEvtHandler(nrf_drv_qspi_evt_t event, void * p_context)
{
UNUSED_PARAMETER(event);
UNUSED_PARAMETER(p_context);
qspi_finished = true;
}
/*
* FUNCTION NAME: PsramRead
* PARAMETER : index: PSRAM no, address: PSRAM address, size: buf size
*data_ptr: data ptr of read buf
retun error
* ACTION : Read from selected psram bank
*/
uint32_t PsramRead(uint8_t index, uint32_t addr, uint16_t size, uint8_t *data_ptr)
{
ret_code = nrf_drv_qspi_read(data_ptr, size, addr);
APP_ERROR_CHECK(ret_code);
while (qspi_finished == false);
}
/*
* FUNCTION NAME: PsramWrite
* PARAMETER : index: PSRAM no, address: PSRAM address, size: buf size
*data_ptr: data ptr of write buf
retun error
* ACTION : Write into selected psram bank
*/
uint32_t PsramWrite(uint8_t index, uint32_t addr, uint16_t size, uint8_t *data_ptr)
{
ret_code = nrf_drv_qspi_write(data_ptr, size, addr);
APP_ERROR_CHECK(ret_code);
while (qspi_finished == false);
}