1
Discussion - EVE / Re: Loading Image into RAM_G Example
« on: July 29, 2022, 04:41:39 PM »
Hi,
If your image is in the raw format (e.g. converted to RGB565 or RGB332 or ARGB1555 etc. from the asset builder) then you can just write to RAM_G directly like writing to a SPI memory device. You dont need to use the co-processor for this and you can stream the data direct.
To do this you would use these steps:
Chip Select Low
Write the 3-byte address in RAM_G that you want the data to be written to (with the read/write bits set for writing)
Stream the data whilst holding CS low for a SPI burst write
Chip Select High
for the address it uses the two most significant bits as 10 and so for writing to RAM_G + 0 you would use 0x80 0x00 0x00 in step 2 above
Here is a small code snippet. This assumes the data is a multiple of 4 bytes but you can add code to pad to a multiple of 4 bytes with 1, 2 or 3 extra 0x00 bytes at the end (before the CS high)
Here is a 32-bit write example too,
Best Regards, BRT Community
If your image is in the raw format (e.g. converted to RGB565 or RGB332 or ARGB1555 etc. from the asset builder) then you can just write to RAM_G directly like writing to a SPI memory device. You dont need to use the co-processor for this and you can stream the data direct.
To do this you would use these steps:
Chip Select Low
Write the 3-byte address in RAM_G that you want the data to be written to (with the read/write bits set for writing)
Stream the data whilst holding CS low for a SPI burst write
Chip Select High
for the address it uses the two most significant bits as 10 and so for writing to RAM_G + 0 you would use 0x80 0x00 0x00 in step 2 above
Here is a small code snippet. This assumes the data is a multiple of 4 bytes but you can add code to pad to a multiple of 4 bytes with 1, 2 or 3 extra 0x00 bytes at the end (before the CS high)
Code: [Select]
MCU_CSlow(); // CS low begins SPI transaction
EVE_AddrForWr(DestAddress); // Send address to which first value will be written
while(DataPointer < DataSize)
{
EVE_Write8(ImgData[DataPointer]); // Send data byte-by-byte from array
DataPointer ++;
}
MCU_CShigh();
Here is a 32-bit write example too,
Code: [Select]
// Writes a block of data to the RAM_G
void EVE_LIB_WriteDataToRAMG(const uint8_t *ImgData, uint32_t DataSize, uint32_t DestAddress)
{
HAL_ChipSelect(low); // Begins SPI transaction - CS low
HAL_SetWriteAddress(DestAddress); // Send address to which first value will be written
DataSize = (DataSize + 3) & (~3); // Pad data length to multiple of 4.
while (DataSize) // Send data as 32 bits.
{
HAL_Write32(*(uint32_t *)ImgData);
ImgData += 4;
DataSize -= 4;
}
HAL_ChipSelect(high); // End SPI transaction - CS high
}
Best Regards, BRT Community