Part Number: AM2634-Q1
Other Parts Discussed in Thread: AM2634, SYSCONFIG
I am trying to use the QSPI flash API for doing a read/erase/write operation to a sector on flash using sector API’s provided in flash.h in board drivers. The Block API’s seem to work, the sector API’s are failing.
I am using the non-dma qspi flash write example and following is my code implementation. Any guidance what could be failing?
#define FLASH_OFFSET 0x00100000U
/* The source buffer used for transfer */
uint8_t gQspiTxBuf[256];
/* Read buffer MUST be cache line aligned when using DMA */
uint8_t gQspiRxBuf[256] __attribute__((aligned(CacheP_CACHELINE_ALIGNMENT)));
void main(void *args)
{
uint32_t offset = FLASH_OFFSET;
uint32_t sector, page, status;
/* Open drivers to open the UART driver for console */
Drivers_open();
Board_driversOpen();
flash_attributes_get();
status = Flash_offsetToSectorPage(gFlashHandle[CONFIG_FLASH0], offset, §or, &page);
DebugP_assert(SystemP_SUCCESS == status);
status = Flash_read(gFlashHandle[CONFIG_FLASH0], offset, gQspiRxBuf, 256);
DebugP_assert(SystemP_SUCCESS == status);
gQspiTxBuf[0] = gQspiRxBuf[0] + 2;
status = Flash_eraseSector(gFlashHandle[CONFIG_FLASH0], sector);
DebugP_assert(SystemP_SUCCESS == status);
DebugP_log("[QSPI Flash Transfer Test] Performing Write-Read Test...\r\n");
status = Flash_write(gFlashHandle[CONFIG_FLASH0], offset, gQspiTxBuf, 256);
DebugP_assert(SystemP_SUCCESS == status);
}


