I am testing the imxrt1050evbk with the flexspi hyper flash polling transfer example.
I have modified the function flexspi_nor_flash_erase_sector() to use FLEXSPI_TransferNonBlocking() instead of FLEXSPI_TransferBlocking() as shown below.
When I do this I get an instruction access violation when execution returns from the FLEXSPI_TransferNonBlocking() call. However if I put a debug breakpoint after this call and manually continue each loop I do not get the fault.
Any hints on what might be causing this or suggestions on how I might further debug my example would be appreciated.
Thanks
volatile bool ___done;
void
flexspi_transfer_callback_1 (FLEXSPI_Type *base,flexspi_handle_t *handle,status_t status,void *userData) {
___done = true;
}
flexspi_handle_t es_handle;
status_t flexspi_nor_flash_erase_sector_nb (FLEXSPI_Type *base, uint32_t address)
{
status_t status;
flexspi_transfer_t flashXfer;
/* Write enable */
status = flexspi_nor_write_enable(base, address);
if (status != kStatus_Success)
{
return status;
}
flashXfer.deviceAddress = address;
flashXfer.port = kFLEXSPI_PortA1;
flashXfer.cmdType = kFLEXSPI_Command;
flashXfer.SeqNumber = 4;
flashXfer.seqIndex = HYPERFLASH_CMD_LUT_SEQ_IDX_ERASESECTOR;
FLEXSPI_TransferCreateHandle(base,&es_handle,flexspi_transfer_callback_1,NULL);
___done = false;
FLEXSPI_TransferNonBlocking (base,&es_handle,&flashXfer);
size_t count;
while ( FLEXSPI_TransferGetCount (base,&es_handle,&count) != kStatus_NoTransferInProgress);
/* Do software reset. */
FLEXSPI_SoftwareReset(EXAMPLE_FLEXSPI);
return status;
}