cancel
Showing results for 
Search instead for 
Did you mean: 

Internal assert failure #75 - Dynamic Bitmap Creation is corrupt

JBenn.1
Associate II

Hello,

I am getting an Internal Assert error.

To be more precise:

"framework/source/platform/driver/lcd/LCD16bpp.cpp #75".

The call stack looks something like this:

touchgfx::LCD::drawPartialBitmap()

touchgfx::Image::draw() at Image.cpp:38 0x8017152   

touchgfx::Screen::JSMOC() at 0x8052524   

touchgfx::Screen::JSMOC() at 0x80524ce   

touchgfx::Screen::startSMOC() at 0x8052546   

touchgfx::Screen::draw() at 0x8052572   

touchgfx::Application::draw() at 0x8051402   

touchgfx::Application::cacheDrawOperations() at 0x80518d0   

touchgfx::HAL::tick() at 0x804d4d6   

touchgfx::HAL::backPorchExited() at HAL.hpp:541 0x80294ce   

touchgfx::HAL::taskEntry() at 0x804d388   

I inherit from image and want to display a dynamic bitmap on the image. The dynamic bitmap was previously populated by a CachableContainer.

Can anyone tell me where the error is?

7 REPLIES 7
Alexandre RENOUX
Principal

Hello JBenn.1,

Can you give me the content of this Internal Assert Error ?

The code handling the image and CacheableContainer would be useful as well.

/Alexandre

JBenn.1
Associate II

We want to cache the bitmap of a graph and output it as an image. This is done for performance reasons for a ScrollWheel.

To do this, we insert the graph into a CachableContainer.

We create a separate dynamic bitmap for each CachableGraphContainer.

To update the graph, we call drawToDynamicBitmap(...).

The image should draw the data of the dynamic bitmap.

But there the Assert Error occurs.

Of course, we use an external RAM and set the cache manually.

We use a cache size of 1296000 bytes.

void CacheGraph::initialize(){
// ...
	if(getWidgethBitmapID() == BITMAP_INVALID){
		uint16_t w = getWidth();
		uint16_t h = getHeight();
		BitmapId bitmapID = Bitmap::dynamicBitmapCreate(w, h, Bitmap::RGB565);
		DBGAIF("Dynamic Bitmap created: %d", bitmapID);
		setWidgetBitmapID(bitmapID);
	}
// ...
}
 
void CacheGraph::updateContent(void){
	// ...
	this->invalidate();
 
	if((lastStateID != curStateID)
			&& (getWidgethBitmapID() != BITMAP_INVALID)){
		//content has changed!
		graphContainer.updateContent();
		graphContainer.drawToDynamicBitmap(getWidgethBitmapID());
		lastStateID = curStateID;
	}
}
#define BITMAP_BUFFER_SIZE (480*135)*2*10
uint16_t XRAM bitmapBuffer[BITMAP_BUFFER_SIZE];
//...
Bitmap::setCache(bitmapBuffer, BITMAP_BUFFER_SIZE, CURRENT_VALUE_MAX_COUNT);

0693W00000FB3CbQAL.png

I have been working through the assembler of the non-public TouchGFX library and found out that the format of the created bitmaps leads to error #75 (In drawPartialBitmap).

My created bitmaps are all clearly created with the format Bitmap::RGB565. So getFormat() should return the 0.

This is my Debugging Output:

Set Cache: at 0x610C0D0C size:1296000
Existing Bitmaps:
	Bitmap[0] at 0x610C0DE8 is Not dynamic and has Format 2
	Bitmap[1] at 0x610CAD48 is Not dynamic and has Format 2
	Bitmap[2] at 0x610D4CA8 is Not dynamic and has Format 0
 
Dynamic Bitmap created: ID: 3 at 0x610D6968 with Format: 16
Dynamic Bitmap created: ID: 4 at 0x610D6968 with Format: 29
Dynamic Bitmap created: ID: 5 at 0x610D6968 with Format: 31
 
Try to draw Image..
ASSERT framework/source/platform/driver/lcd/LCD16bpp.cpp #75

The first 3 Bitmaps was created by the normal TouchGFX Widgets.

The next 3 was created by my own the CachGraph class

But all of them show random formats directly after creation. Moreover, all dynamic bitmaps are located at the same memory address.

Is there an explanation for this? I hope someone can help me.

void cCacheGraph::initialize(void){
	if(getWidgethBitmapID() == BITMAP_INVALID){
		uint16_t w = getWidth();
		uint16_t h = getHeight();
		BitmapId bitmapID = Bitmap::dynamicBitmapCreate(w, h, Bitmap::RGB565);
		uint8_t* add = Bitmap::cacheGetAddress(bitmapID);
		DBGAIF("Dynamic Bitmap created: %d at _0x%x", bitmapID, add);
 
		setWidgetBitmapID(bitmapID);
	}
 
	this->setBitmap(getWidgethBitmapID());
	updateContent();
}

JBenn.1
Associate II

_

Alexandre RENOUX
Principal

Hello JBenn.1,

Since you modified your last message, I suppose Bitmap::clearCache() didn't fix the issue right ?

The Bitmap::clearCache() function deletes all entries in the cache, not less not more ^^

/Alexandre

Right, the clearCache didn't change anything.

Some Builds with small changes run, some not. :\

After long debugging sessions we found out that our bus to the external RAM was causing the problem.

In special situations single bits are written incorrect.

Therefore the format of the sometimes bitmap was incorrect.

We found a work-around by preloading the external RAM. 😎

Thanks for the help.