cancel
Showing results for 
Search instead for 
Did you mean: 

Block in _exit() function in syscalls.c with ili9341

cb.7
Associate III

Hi everyone,

I'm developing a project with stm32G0 and ILI9341 graphics controller, as frambuffer strategy I'm using "Partial Buffer". Everything works fine but occasionally the program crashes and ends up in the _exit() function in syscalls.c.

The cause is an assertion in the getBlockForTransfer() function in the FrameBufferAllocator.c file.

For the moment I solve the problem by commenting the line of code "assert(state[sendingBlock] == DRAWN);" in the function "virtual const uint8_t* getBlockForTransfer(Rect& rect)", but it's not the most elegant solution.

Is there a solution to this problem?

The version of TouchGFX is 4.21.2

Thank you

2 REPLIES 2
cb.7
Associate III

Can anyone help me?

AKroe.1
Associate

here is a code example for you (file TouchgfxGeneratedHal.cpp):

/*

 * ******************************************************

 * Required by Partial Frame Buffer Strategy

 * ******************************************************

 */

static volatile bool blockIsTransferred = false;

namespace touchgfx

{

/**

 * This function is called by FrameBufferAllocator if no block is

 * available.

 */

void FrameBufferAllocatorWaitOnTransfer()

{

 /* NOTE: This function should not be modified, when the fuction is needed,

  *      FrameBufferAllocatorWaitOnTransfer should be implemented in the user file

  */

   while(blockIsTransferred){

      osDelay(1);

   }

}

// A user must call touchgfx::startNewTransfer(); once transmitFrameBufferBlock() has successfully sent a block.

void startNewTransfer()

{

   FrameBufferAllocator* fba = HAL::getInstance()->getFrameBufferAllocator();

 // Free the previous transmitted block, marking it ready for rendering

   fba->freeBlockAfterTransfer();

   if (fba->hasBlockReadyForTransfer())

   {

       touchgfx::Rect r;

       // Get pointer to block buffer and coordinates of the rect

       const uint8_t* pixels = fba->getBlockForTransfer(r);

       blockIsTransferred = true;

       // Start transmission of the block

       touchgfxDisplayDriverTransmitBlock((uint8_t*)pixels, r.x, r.y, r.width, r.height);

   }

}

extern "C"

void DisplayDriver_TransferCompleteCallback()

{

 // After completed transmission start new transfer if blocks are ready.

   blockIsTransferred = false;

   touchgfx::startNewTransfer();

}