cancel
Showing results for 
Search instead for 
Did you mean: 

Report a Bug

cy187lion
Associate
Posted on April 03, 2014 at 07:54

Hardwa: STM32F429Discovery

Software: STemWin, STemWin_Library_V1.0.0 and STemWin_Library_V1.0.1

When using the functiong of Multiple Buffering of STemWin, I found that words was drawn in back buffer, but the filled rectangle was drawn in front buffer.

Because there is a bug in the file of 'GUIDRV_stm32f429i_discovery.c'. _aBufferIndex[i] shouldn't be assigned in LTDC_ISR_Handler but int the custom defined routine for copying buffers. Like this...

static void _LCD_CopyBuffer(int LayerIndex, int IndexSrc, int IndexDst) {

    U32 BufferSize, AddrSrc, AddrDst;

    BufferSize = _GetBufferSize(LayerIndex);

    AddrSrc    = _aAddr[LayerIndex] + BufferSize * IndexSrc;

    AddrDst    = _aAddr[LayerIndex] + BufferSize * IndexDst;

&sharpif (NUM_BUFFERS==2)

    _aBufferIndex[LayerIndex] = IndexDst;

&sharpendif

    _DMA_Copy(LayerIndex, (void *)AddrSrc, (void *)AddrDst, _axSize[LayerIndex], _aySize[LayerIndex], 0);

}

Or it will give a wrong address when drawing rectangles.

#stemwin-multiple-buffering #stemwin
1 REPLY 1
Posted on May 08, 2014 at 16:42

Hi,

I confirm that this a bug and it should be fixed : changing buffer should be done in all the case (Multibufering used or not)

static void _LCD_CopyBuffer(int LayerIndex, int IndexSrc, int IndexDst) {

U32 BufferSize, AddrSrc, AddrDst;

BufferSize = _GetBufferSize(LayerIndex);

AddrSrc = _aAddr[LayerIndex] + BufferSize * IndexSrc;

AddrDst = _aAddr[LayerIndex] + BufferSize * IndexDst;

_DMA_Copy(LayerIndex, (void *)AddrSrc, (void *)AddrDst, _axSize[LayerIndex], _aySize[LayerIndex], 0, 0);

_aBufferIndex[LayerIndex] = IndexDst; // After this function has been called all drawing operations are routed to Buffer[IndexDst]!

}

void LTDC_ISR_Handler(void) {

U32 Addr;

int i;

LTDC->ICR = (U32)LTDC_IER_LIE;

for (i = 0; i <

GUI_NUM_LAYERS

; i++) {

if (_aPendingBuffer[i] >= 0) {

//

// Calculate address of buffer to be used as visible frame buffer

//

Addr = _aAddr[i] + _axSize[i] * _aySize[i] * _aPendingBuffer[i] * _aBytesPerPixels[i];

//

// Store address into SFR

//

_apLayer[i]->CFBAR &= ~(LTDC_LxCFBAR_CFBADD);

_apLayer[i]->CFBAR = Addr;

//

// Reload configuration

//

_LTDC_ReloadConfig(LTDC_SRCR_IMR);

//

// Tell emWin that buffer is used

//

GUI_MULTIBUF_ConfirmEx(i, _aPendingBuffer[i]);

//

// Clear pending buffer flag of layer

//

_aPendingBuffer[i] = -1;

}

}

}

The fix should be included in the next STemWin package.

With regards,