Skip to main content
Chandan Bhatia1
Associate III
July 8, 2020
Question

Code is getting stuck at vPortRaiseBASEPRI after using Touchgfx

  • July 8, 2020
  • 33 replies
  • 9539 views

Hello, I have created one basic project with STM32F746ZG and touchgfx. When I ran my code, In starting only its getting stuck at freeRTOS function vPortRaiseBASEPRI. After debug I found that code asserted at below line of function xQueueSemaphoreTake of queue.c.

/* Check this really is a semaphore, in which case the item size will be

0. */

configASSERT( pxQueue->uxItemSize == 0 );

This function is getting called by OSWrapper.cpp function tryTakeFrameBufferSemaphore. Here we are trying to take Semaphore "frame_buffer_sem". So in simple words value of frame_buffer_sem. uxItemSize is odd like 480.

0693W000001sSfFQAU.jpg

When I debug more, I found during initialization(OSWrappers::initialize) of Semaphore has all correct values but seems like after sometime its getting all data corrupted.

I am really not sure how heap memory is getting corrupted as I just generated code from touchgfx and STM32CubeMX. My heap size is 32768 bytes.

Below are the screen shot of memory allocated for Semaphore "frame_buffer_sem"

After Initializing:

0693W000001sSdwQAE.jpg

At function tryTakeFrameBufferSemaphore call:

0693W000001sSf4QAE.jpg

Note : 0x200004c0  is address of Semaphore "frame_buffer_sem" .

Clearly heap data is getting corrupted.

Below is the stack level

0693W000001sSfOQAU.jpg

Any help?

This topic has been closed for replies.

33 replies

Alexandre RENOUX
Visitor II
July 9, 2020

Hello,

Maybe you can look at the Application Template STM32F746G-DISCO for some reference and comparison. It's available on TouchGFX Designer.

/Alexandre

Chandan Bhatia1
Associate III
July 9, 2020

Hello, Yes I did. Its same code. Not able to find reason for it. Doesn't seem like this issue is related to external SDRAM or flash.

MM..1
Super User
July 9, 2020

try in boardconfig use nodma

//STM32F7DMA dma;

NoDMA dma;

Chandan Bhatia1
Associate III
July 9, 2020

Compile time error "NoDMA dma;'

MM..1
Super User
July 9, 2020

/* USER CODE BEGIN user includes */

#include <touchgfx/hal/NoDMA.hpp>

Chandan Bhatia1
Associate III
July 9, 2020

Thanks, it compiled. I don't have board with me right now. I will update you tomorrow.

Chandan Bhatia1
Associate III
July 10, 2020

Post changing to NoDMA I am getting hard fault due to TIMER6. I am not using TIMER6 any where. Does Touchgfx needs it?

0693W000001sauvQAA.jpg

Last trace is highlighted line

0693W000001savFQAQ.jpg

Chandan Bhatia1
Associate III
July 10, 2020

I created one new project and now its working but I m observing some issue with color and few areas like circle, it came like bit odd on screen.

Btw now i am using RGB565 format so below is my new LCD Connector schematic. Please check if this is correct.

0693W000001sbbzQAA.jpg

Chandan Bhatia1
Associate III
July 10, 2020

Is this due to HorizontalSync, VerticalSync, porch ? How should i get correct value of these parameter as unable to find it LCD datasheet.

Alexandre RENOUX
Visitor II
July 10, 2020

Hello,

The back porch and front porch are supposed to be on the LCD datasheet. I don't think you can find them elsewhere. It's quite strange that you cannot find these values.

Or else if you have code examples of this screen being used, you can refer to that as the values should be the same.

/Alexandre

MM..1
Super User
July 10, 2020

Yes porch numbers is one point , but your schematc is RGB666 or 18bit LTDC interface. You can config it and framebuffer RGB565 or RGB888.

Chandan Bhatia1
Associate III
July 11, 2020

Yes In software I am sending low on R2,B2 lines. Basically I want to saved size of external flash and RAM so choosing RGB565.

MM..1
Super User
July 10, 2020

In datasheet X043DTLT is all polarity and timing porch info on page 9.

Chandan Bhatia1
Associate III
July 11, 2020

​@MM..1​   Thanks for replay. Actually I am first time working on LCD so kinda confused.

I checked page 9, but there data is in CLK(HZ) but I need to mention it in pixels for horizontal and lines for vertical. Can you please help me understand it?

0693W000001sgkDQAQ.jpg

0693W000001sgkIQAQ.jpg

0693W000001sgkSQAQ.jpg

Alexandre RENOUX
Visitor II
July 11, 2020

Hello,

I looked at the two datasheet and I don't seem to find any relevant info for porch for the 5'' screen 800*480.

On the other hand, like MM..1 mentioned, the screen with a resolution of 480*272px has a table regarding that.

You can see that Horizontal display period = 480 and Vertical display period = 272 which matches the resolution.

Therefore I guess that :

Horizontal front porch is 2 pixels

Horizontal Back porch is 2 pixels

An same for vertical.

Horizontal Synchronization in CubeMX would correspond to Horizontal pulse width and same for Vertical.

/Alexandre

MM..1
Super User
July 11, 2020

9,6M / 525px / 286ln = around 64Hz refresh then next critical info is polarity of sync and clock for LCD as i say on page 9 is graph signal too.

 hltdc.Init.HSPolarity = LTDC_HSPOLARITY_AL;

 hltdc.Init.VSPolarity = LTDC_VSPOLARITY_AL;

 hltdc.Init.DEPolarity = LTDC_DEPOLARITY_AL;

 hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC;

only my example you need set your polarity.

And when your MCU is slow or ram ... try half of 9,6MHz as ltdc clock maybe 4,8

Chandan Bhatia1
Associate III
July 11, 2020

I think 64Hz i need to set somewhere in Touchgfx but unable to find correct location, Can you help ?

Also in Touchfgfx I need to set LCD RESET PIN XRES but there is reset pin in LCD.

0693W000001sh1sQAA.jpg

Thanks

MM..1
Super User
July 15, 2020

When you dont have reset on LCD simply set unused port pin here.

Chandan Bhatia1
Associate III
July 15, 2020

ok, Also above we was discussing to add display refresh as 64Hz, but unable to find correct location in touchgfx setting Can you help ?

Alexandre RENOUX
Visitor II
July 20, 2020

Hello,

As MM..1 said, the LCD-TFT clock at 9,6 MHz indicates already that the LTDC will try to transfer the framebuffer to the screen at 64 Hz (called display refresh in you sentence).

If you want to change the display refresh, changing this value should be enough.

/Alexandre