Troubles in displaying images on FT801with STM32F4 board
Hi all,
I'm working on a STM32F446E connected to a FTDI FT801 LCD. I am stacked on the commands communication on the SPI between the Micro and the LCD Controller. I have to load a couple of images on the LCD but I didn't found a proper guide on the net. There are a lot of guides for what concern the LCD controller, the ones that I have read don't explain anything about the right sequence of instructions to invoke on the micro.
Up to now I tried this:
Address_RAM_CMD = 0x908000;
SPI_Send_RAM_CMD(Address_RAM_CMD, DLSTART, 7);
SPI_Send_RAM_CMD(Address_RAM_CMD,CLEAR, 7);
SPI_Send_RAM_CMD(Address_RAM_CMD, INFLATE, 7);
SPI_Send_RAM_CMD(Address_RAM_CMD, 0, 7);
// Destination starting address in Graphics RAM
while (filesize > 0) {
f_read(&MyFile_R, data, sizeof(data), (UINT*) &bytesread);
SPI_Send_RAM_CMD(Address_RAM_CMD, data, 7);
filesize -= 4;
}
SPI_Send_RAM_CMD(Address_RAM_CMD, BITMAP_HANDLE(0),7);
SPI_Send_RAM_CMD(Address_RAM_CMD, BITMAP_SOURCE(0),7);
SPI_Send_RAM_CMD(Address_RAM_CMD, BITMAP_LAYOUT(0x00, 946, 92) ,7);
SPI_Send_RAM_CMD(Address_RAM_CMD, BITMAP_SIZE(NEAREST,BORDER,BORDER, image_width, image_height),7);
SPI_Send_RAM_CMD(Address_RAM_CMD, BEGIN(BITMAPS), 7);
SPI_Send_RAM_CMD(Address_RAM_CMD, VERTEX2II(4, 76, 27, 0), 7);
SPI_Send_RAM_CMD(Address_RAM_CMD, END, 7);
SPI_Send_RAM_CMD(Address_RAM_CMD, DISPLAY, 7);
SPI_Send_RAM_CMD(Address_RAM_CMD, SWAP, 7);
HAL_Delay(1000);
Where:
// This function is used to transmit data with SPI
// Address = address in the FTDI801 memory map
// Data = data to write in the FTDI801 memory map
// Size = number of bytes to write (Address + Data)
void
SPI_Send_RAM_CMD(uint32_t
Address,uint32_t
Data,uint16_t
Size){
uint8_t
buffer[7];buffer[0] = ((Address >> 16) & 0xFF);
buffer[1] = ((Address >> 8) & 0xFF);
buffer[2] = (Address & 0xFF);
buffer[3] = (Data & 0xFF);
buffer[4] = ((Data >> 8) & 0xFF);
buffer[5] = ((Data >> 16) & 0xFF);
buffer[6] = ((Data >> 24) & 0xFF);
HAL_GPIO_WritePin
(GPIOG, GPIO_PIN_14,GPIO_PIN_RESET
);
HAL_SPI_Transmit
(&spi_handle_structure, buffer, Size, 10000);
HAL_GPIO_WritePin
(GPIOG, GPIO_PIN_14,GPIO_PIN_SET
);Address_RAM_CMD = Address_RAM_CMD + 0x0000004;
SPI_Send(0x9024E8,(
uint16_t
)(Address_RAM_CMD-0x00908000),7);
// REG_CMD_WRITE
}
void
SPI_Send(uint32_t
Address,uint32_t
Data,uint16_t
Size){
uint8_t
buffer[7];buffer[0] = ((Address >> 16) & 0xFF);
buffer[1] = ((Address >> 8) & 0xFF);
buffer[2] = (Address & 0xFF);
buffer[3] = (Data & 0xFF);
buffer[4] = ((Data >> 8) & 0xFF);
buffer[5] = ((Data >> 16) & 0xFF);
buffer[6] = ((Data >> 24) & 0xFF);
HAL_GPIO_WritePin
(GPIOG, GPIO_PIN_14,GPIO_PIN_RESET
);
HAL_SPI_Transmit
(&spi_handle_structure, buffer, Size, 10000);
HAL_GPIO_WritePin
(GPIOG, GPIO_PIN_14,GPIO_PIN_SET
);}
With this implementation, no image is shown on the LCD.
It seems to me that the image data are not sent to the GPU RAM.
Thanks in advance.
Cheers,
Anna