Transfer display memory with SPI DMA
Hello,
I want to update my display data via SPI DMA. The display has 480x320px and I have chosen a 3 bit color coding, so that I can send two pixel within one byte. So my framebuffer has a size ox (480x320)/2 = 76800 byte. But when I want to transmit them with
HAL_StatusTypeDef HAL_SPI_Transmit_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)I have the size restriction. Do you have any idea how to solve this? I tried to use a state machine within the Interrupt:
switch ( eSpiDMA_TransmissionState )
{
case eStartTransmission:
LCD_CS_SET;
LCD_DC_RESET;
LCD_CS_RESET;
eSpiDMA_TransmissionState = eSendFirstHalf;
if ( HAL_SPI_Transmit_DMA( &hspi2, (uint8_t *)0x2c, 1 ) != HAL_OK)
{
// todo: error handling
}
break;
case eSendFirstHalf:
LCD_CS_SET;
LCD_DC_SET;
LCD_CS_RESET;
eSpiDMA_TransmissionState = eSendSecondHalf;
if ( HAL_SPI_Transmit_DMA( &hspi2, &displayFramebuffer[0], 38400U ) != HAL_OK)
{
// todo: error handling
}
break;
case eSendSecondHalf:
eSpiDMA_TransmissionState = eStartTransmission;
if ( HAL_SPI_Transmit_DMA( &hspi2, &displayFramebuffer[38400U], 38400U ) != HAL_OK)
{
// todo: error handling
}
break;
}But this doesn't work (it seems that the display is updated in 4 instead of 2 parts), and doesn't update afterwards ( I change the color in another task every 500ms, but the display color doesn't change).
Any ideas for this?
