Hello,
Yes, Rudolph is correct, you would split the data into chucks smaller than the FIFO size.
Below is our implementation from our
BRT_AN_014 for writing data to the FIFO.
Section 7.2 covers using the INFLATE command.
void API_LIB_WriteDataToCMD(const uint8_t *ImgData, uint32_t DataSize)
{
uint32_t CurrentIndex = 0;
uint32_t ChunkSize = 0;
const uint32_t MaxChunkSize = 128;
uint8_t IsLastChunk = 0;
uint16_t Freespace = 0;
// This code works by sending the data in a series of one or more bursts.
// If the data is more than MaxChunkSize bytes, it is sent as a series of
// one or more bursts and then the remainder. MaxChunkSize is a size which
// is smaller than the command buffer on the EVE and small enough to gain
// maximum buffering effect from the MCU SPI hardware.
// Pad data length to multiple of 4.
DataSize = (DataSize + 3) & (~3);
// While not all data is sent
while (CurrentIndex < DataSize)
{
// If more than ChunkSize bytes to send
if ((DataSize - CurrentIndex) > MaxChunkSize)
{
// ... then add ChunkSize to the current target index to make new target
ChunkSize = MaxChunkSize;
// ... and this is not the last chunk
IsLastChunk = 0;
}
// or if all remaining bytes can fit in one chunk
else
{
// ... then add the amount of data to the current target
ChunkSize = DataSize - CurrentIndex;
// .. and this is the last chunk
IsLastChunk = 1;
}
// Wait until there is space
Freespace = 0;
while (Freespace < MaxChunkSize)
{
Freespace = HAL_CheckCmdFreeSpace();
}
// Begin an SPI burst write
HAL_ChipSelect(1);
// to the next location in the FIFO
HAL_SetWriteAddress(EVE_RAM_CMD + HAL_GetCmdPointer());
HAL_Write(ImgData, ChunkSize);
ImgData += ChunkSize;
CurrentIndex += ChunkSize;
// End the SPI burst
HAL_ChipSelect(0);
// Calculate where end of data lies
HAL_IncCmdPointer(ChunkSize);
HAL_WriteCmdPointer();
// If this is the last chunk of the data,
if (IsLastChunk)
{
break;
}
}
}
Best Regards,
BRT Community