Part Number:PROCESSOR-SDK-AM437X
Tool/software: Code Composer Studio
Hello,
I am trying to write to flash on the AM437x Industrial Development Kit.
I have access to the QSPI_BasicExample_idkAM437x_armExampleProject.
I have also integrated the spi_test() and spi_read_write() from the example.
Here is the problem: If this number is changed to anything below 64, it works. When this number is 64 or greater it fails.
void spi_test() { SPI_Params spiParams; /* SPI params structure */ S25FL_Handle flashHandle; /* Flash handle */ bool retVal = false; /* return value */ /* Init SPI driver */ SPI_init(); /* Default SPI configuration parameters */ SPI_Params_init(&spiParams); /* Open QSPI driver */ flashHandle = SF25FL_open(((QSPI_INSTANCE - 1)+(QSPI_OFFSET)), &spiParams); /* Print flash Id */ FlashPrintId(flashHandle); /* Set the transfer length in number of 32 bit words */ transferLength = 50; /* read/write test on block 0, address 0 */ retVal = spi_read_write(flashHandle, 0, transferLength); if (retVal == true) { /* read/write test on block 256, address 16M */ retVal = spi_read_write(flashHandle, 256, transferLength); } SF25FL_close(flashHandle); if(true == retVal) { DebugLog::Write("\n All tests have passed. \n"); } else { DebugLog::Write("\n Some tests have failed. \n"); } while(1); }
I have narrowed it to failing at the highlighted line below in the function in the class S25FL.c: bool SF25FL_bufferWrite(S25FL_Handle flashHandle, S25FL_Transaction* flashTransaction)
if(QSPI_OPER_MODE_MMAP == object->qspiMode) { for(idx = 0; idx < length; idx++) { /* Write enable */ S25FLFlash_WriteEnable(flashHandle); /* Perform the transfer */ transaction.txBuf = (unsigned char *)dstOffstAddr; transaction.rxBuf = srcAddr; transaction.count = 1; transferType = SPI_TRANSACTION_TYPE_WRITE; if (dstOffstAddr > 0xFFFFFFU) { transferCmd = QSPI_LIB_CMD_PAGE_PRG_4B; } else { transferCmd = QSPI_LIB_CMD_PAGE_PRG; } SPI_control(handle, SPI_V1_CMD_TRANSFERMODE_RW, (void *)&transferType); SPI_control(handle, SPI_V1_CMD_MMAP_TRANSFER_CMD, (void *)&transferCmd); retVal = SPI_transfer(handle, &transaction); /* Check flash status for completion */ while ((FlashStatus(flashHandle) & 0x1U)); dstOffstAddr += 1; srcAddr += 1; } }
Seeing as I am using example code, I am wondering why this is failing.
Any help would be greatly appreciated.