cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX with custom board

https://www.touchgfx.com/news/high-quality-graphics-using-only-internal-memory/Hey there ...

I have a custom board having STM32F429ZI MCU. I'm using TFT display with ST7789V controller

For my graphics related project, I'm going to use TouchGFX but the problem is, hardware has been already developed and i need to deal with SPI Display only (as display is connected with SPI2 of the MCU) . Board also contains the SPI flash , No may i seek any possibility to go with touchGFX (my baremetal code with SPI display working great)

I need to use internal SDRAM for the frame buffer

I just little roam on goggle and i have found the same reference here

My graphics requirement is not too high

I needs some expert advice

Thanks

11 REPLIES 11
Martin KJELDSEN
Chief III

Hi @Mahendra Sondagar​,

For SPI based displays you need to implement

HAL::flushFrameBuffer(Rect& rect);

Internal memory is just fine. You can find more about this here:

https://touchgfx.zendesk.com/hc/en-us/articles/203642951-MCUs-without-TFT-controller

Let me know if you need more help.

/Martin

Hey, @Martin KJELDSEN​ 

Thanks for your feedback

yes, I'm exacting the help in this case to make it happen!

I have read the URL that you have shared me here, and I have few questions for the same

I have implemented ST7789V Display driver in TouchGFX demo application (default driver was for ili9341)

Display driver is working great with SPI (As I'm getting display id), And I already have working driver for ST7789V. In my case i need to use internal flash and SRAM

for the Frame buffer I have defined Single internal frame buffer "SINGLE_FRAME_BUFFER_INTERNAL" and that's around 75KB for my 240x320 display size and I'm happy with them as my graphics requirement is not so high for now

On my TFT display, I doesn't required any touch activity, that's why i have commented all touch related activity in demo code

My questions are as follow

(1) Do i need to generate the periodic tik of 60Hz for the "VSYNC interrupt notification" as per the guide ?

(2)Do i need to disable the DMA lock if yes, then how ?

(3)At where do i implement the the sub class for "HAL::flushFrameBuffer(const Rect& rect)"?

I'm eagerly waiting for your feedback =)

Regards,

Mahendra Sondagar

Martin KJELDSEN
Chief III

Hi @Mahendra Sondagar​,

1) Regardless of touch, you need to generate a perodic tic (From LTDC, hardware timer, ...) to drive TouchGFX forward. The main event loop is expecting this signal.

2) Do you mean lockDMAToFrontPorch() ? It's unclear to me.

3) You could implement it inside the HAL that you're using (STM32F4HAL.cpp) - Except, now that you're not using LTDC but transferring data manually to the display in flushFrameBuffer() you probably need to make a few changes:

This is the original LTDC interrupt handler - Notice how it's calling OSWrappers::signalVSync(); This is the signal you must send this based on some syncronization signal from your display.

extern "C"
__irq void LTDC_IRQHandler(void)
{
    if (LTDC->ISR & 1)
    {
        LTDC->ICR = 1;
        if (LTDC->LIPCR == lcd_int_active_line)
        {
            //entering active area
            LTDC->LIPCR = lcd_int_porch_line;
            HAL::getInstance()->vSync();
            OSWrappers::signalVSync();
            // Swap frame buffers immediately instead of waiting for the task to be scheduled in.
            // Note: task will also swap when it wakes up, but that operation is guarded and will not have
            // any effect if already swapped.
            HAL::getInstance()->swapFrameBuffers();
            GPIO::set(GPIO::VSYNC_FREQ);
        }
        else
        {
            //exiting active area
            LTDC->LIPCR = lcd_int_active_line;
            GPIO::clear(GPIO::VSYNC_FREQ);
            HAL::getInstance()->frontPorchEntered();
        }
    }
}

And then also define the HAL::flushFrameBuffer(const Rect& rect) method here. If you intend to use DMA to transfer the data over SPI let me know because you need to protect the method from returning until DMA is done transferring by introducing another semaphore.

/Martin

Thanks @Martin KJELDSEN​ for quick reply!

yeah! , I'm talking about lockDMAToFrontPorch() , do i need to disable it ? then How ?

As, I'm not using LTDC, i have kept DMA2D as it is

yes, I'll set the timer interrupt of 60Hz for the OSWrappers::signalVSync() as per the guide

I'm not using DMA with SPI, suppose if i need to do, then what are the best use case ?

Regards,

Mahendra Sondagar

void HAL::lockDMAToFrontPorch(bool) is always false by default, so unless you did something manually, you don't have to do anything. The call is made in BoardConfiguration.cpp in our application templates.

Re best use case for DMA+SPI: Let's take that if the need arises. It just involves blocking on a semaphore in flushFrameBuffer() until it is signaled by the DMA (to SPI display) completed interrupt handler. This ensures that you do not continue to the next frame until DMA is finished.

/Martin

Thanks @Martin KJELDSEN​ 

I'll implement the required stuff and let you know, if i need any further help

I'll keep this thread continue

Thanks for support

Regards

Mahendra Sondagar

No problem. Let me know!

/Martin

Hey @Martin KJELDSEN​ 

I'm back once again with few more test and updates and problems as well =)

As per your suggestions and touch GFX guide for the custom board, I have made few changes in my code

(1) Implemented 60 Hz timer for the signalVSync() (which is working great)

(2) Added and link my custom "generated" and GUI files with the code

(3) Un-comment "#define SINGLE_FRAME_BUFFER_INTERNAL" for the internal flash and SRAM use (which causes problem!)

with the 3rd change, I'm getting Hard fault

My, target MCU is STM32F429ZI having 2MB flash and 256+4KB SRAM

I'm using keil MDK 5 for as IDE

Here is the memory footprint after compilation code on keil5

Code =  57840  bytes

RO-data= 565412  bytes

RW-data= 2500   bytes

ZI-data=215644

RW-data=2500

For "Option for Target", i have attached in screen shot

Stack_Size EQU   0x5000

Heap_Size   EQU   0x200

FreeRTOS task heap size 2000kb

From the memory footprint, i can say that it should be easily fitted with my MCU, but unfortunately that's not happening!

The functions at where I'm getting hard-fault is shown here

Bitmap::registerBitmapDatabase(BitmapDatabase::getInstance(),
                                   BitmapDatabase::getInstanceSize(),
                                   bitmapCache,
                                   bitmapCacheSize,
                                   numberOfDynamicBitmaps);
 
 
/*  Calling from Above BitmapDatabse Function */
 
 
 
 
namespace BitmapDatabase
{
const touchgfx::Bitmap::BitmapData* getInstance()
{
    return bitmap_database;                                                    <--------------Cause Hardfault 
}
uint16_t getInstanceSize()
{
    return (uint16_t)(sizeof(bitmap_database) / sizeof(touchgfx::Bitmap::BitmapData));
}
}

@Martin KJELDSEN​ Can you give me any suggestions ?

0690X00000AQuesQAD.jpg

Here is the hardfault report

0690X00000AQufgQAD.jpg

Eagerly waiting for your feedback

Regards

Mahendra Sondagar

Hello Community

I need help to sort-out the issue

I'll really appreciate all suggestions and comments

Thanks