cancel
Showing results for 
Search instead for 
Did you mean: 

dynamicBitmapGetAddress return wrong Address for external SDRAM

TStrasser
Associate

Hello,
I have a problem with dynamic bitmaps when they are generated on an external SDRAM.

We are using a STM32H743BGTx with TouchGFX 4.23.2 and STM32Cube Package 1.11.1.

We create a bitmap cache in the external SDRAM:
FrontendApplication::FrontendApplication(Model& m, FrontendHeap& heap)

: FrontendApplicationBase(m, heap)
{

uint16_t* const cacheStartAddr = (uint16_t*)0xD0000000;
/* Bit per picture 320*240*3*8 */
const uint32_t cacheSize = 320*240*3 + 500;//
Bitmap::removeCache();
Bitmap::setCache(cacheStartAddr, cacheSize, 1);
}

Then we create a new dynamic bitmap as follows:

void Screen1View::setupScreen()
{
   const int width = 320;
   const int height = 240;
   //Create the dynamic bitmap
   bmpId = Bitmap::dynamicBitmapCreate(width, height, Bitmap::RGB565);
   if (bmpId != BITMAP_INVALID)
   {
      bool isDynamic = Bitmap::isDynamicBitmap(bmpId);
      uint32_t nr = Bitmap::dynamicBitmapGetNumberOfBitmaps();
      uint8_t *imgLocation = Bitmap::dynamicBitmapGetAddress(bmpId); //Debug Result = 0xf0000028
      uint8_t *nextfree = Bitmap::getCacheTopAddress(); //Debug Result = 0xd0025828
      memset(imgLocation, 0xF0, width*height*2); //Will fail cause of invalid address
   }
    Screen1ViewBase::setupScreen();
    if(bmpId != BITMAP_INVALID)
    {
       CameraImage.setBitmap(Bitmap(bmpId));
       CameraImage.invalidate();
    }
}

The function dynamicBitmapGetAddress(bmpId) points to a completely wrong address. memset goes wrong of course. However, the function getCacheTopAddress() points to the correct address. Interestingly, it works if we use an internal RAM address such as 0x30000000 for the bitmap cache. The external SDRAM works, we have already tested this. Can someone please help us here.

4 REPLIES 4
JTP1
Lead

Hello

Your code seem to work straight away in F769-DK (with only SDRAM address changed to 0xC0000000 since it has different memory layout).

Are you sure this area of SDRAM is not used ? what if you move cache upper on the SDRAM.

I think the address is not completely wrong, it probably should be 0xD0000028 and you have 0xF0000028. (320 * 240 * 2= 153 600 -> 0x25800 and cacheTopAdress is 0xD0025828 so there seem to be 40 bytes long 'header' before the actual image).

Does it work if you manually insert address 0xD0000028 to imageLocation ?

Br JTP

 

 

 

Hi,

thanks’ for your reply. Today I've tested a bit more. I've tested with different locations in my external SDRAM. In my actual setup 0xD0000000 and 0xD0C00000 are used by LTDC and TouchGFX for the display. What we want to do is to show images from a camera on the display. The idea was to write the image data with DCMI to the external SDRAM area 0xD0800000 and use the dynamic Bitmap to show it on screen.

As soon as I generate the dynamic Bitmap Cache in the external SDRAM in address range 0xD0... the function dynamicBitmapGetAddress will point to the wrong address with 0xf0...Thus the setBitmap function will fail.

My next idea was to change the FMC bank mapping that SDRAM Bank2 is remapped to FMC bank2, but it will also fail to work on 0x70.. memory ranges of FMC bank2.

The actual work around is to use internal RAM at position 0x30000000.

 The FMC settings are as followed:

 

SDRAM_Setting.PNG

 

 

Hello @TStrasser ,

As far as I can see, the addresses set for your framebuffer and the bitmap cache were colliding. However, you have changed the bitmap one since, and the problem persist. 
Can you try placing the framebuffer in the internal RAM (if possible) and check if your Dynamic Bitmap still fails to return the correct address (when it is placed in SDRAM)

 

Mohammad MORADI
ST Software Developer | TouchGFX

Hello @TStrasser ,

Have you made any progress on this issue?

Mohammad MORADI
ST Software Developer | TouchGFX