Purpose
The Dataflash driver is based on top of the corresponding Spi driver. A Dataflash structure instance has to be initialized using the DF_Init function. Then basic dataflash operations
can be launched using macros such as DF_continuous_read. These macros invoke the DF_Command() function which invokes the DPI low driver using the SPI_SendCommand() function. Beware to compute the dataflash internal address, the dataflash sector description must be known (DataflashDesc). Dataflash
can be automatically detected using the DF_Scan() function. !!!Usage
- Initializes an AT45 instance and configures SPI chip select pin using AT45_Configure().
- Detect DF and returns DF description corresponding to the device connected using AT45_FindDevice().This function shall be called by the application before AT45_SendCommand.
- Sends a command to the DF through the SPI using AT45_SendCommand(). The command is identified by its command code and the number of bytes to transfer.
- Example code for sending command to write a page to DF.
// Issue a page write through buffer 1 command
error = AT45_SendCommand(pAt45, AT45_PAGE_WRITE_BUF1, 4,
pBuffer, size, address, 0, 0);
|
- Example code for sending command to read a page from DF. If data needs to be received, then a data buffer must be provided.
// Issue a continuous read array command
error = AT45_SendCommand(pAt45, AT45_CONTINUOUS_READ_LEG, 8,
pBuffer, size, address, 0, 0);
|
- This function does not block; its optional callback will be invoked when the transfer completes.
- Check the AT45 driver is ready or not by polling AT45_IsBusy().