2020-12-10 06:05 AM
2020-12-16 10:41 PM
Hello again, everyone. Dear @Flemming Gram CHRISTENSEN As in the example about FMC drivers, I have made my settings and adjusted the functions. I also arranged the flushFrameBuffer and copyFrameBufferBlockToLCD functions for myself. But in getClientFrameBuffer function return frameBuffer0 always returns 0 and my screen remains black. I don't understand where the event frameBuffer0 is populated by TouchGFX ????
2020-12-16 11:55 PM
Hello.
I am not sure I fully understand your question here.
Does getClientFrameBuffer return zero? Or a pointer to memory where you have zero?
The framebuffer is drawn to by the Widgets. So if you have created a Screen with the Designer, you can try to set a breakpoint in Screen1ViewBase::Screen1ViewBase() to see that it is actually created.
Even better is to insert a tick function in Screen1View. This should be called multiple times:
class Screen1View {
virtual void handleTickEvent() { }
};
If you don't hit this function many times, your event loop is not running.
If TouchGFX does not have the correct framebuffer pointer, it can of course not draw anything.
From the F412 template, the framebuffer is passed here:
void TouchGFXGeneratedHAL::initialize()
{
HAL::initialize();
registerEventListener(*(Application::getInstance()));
setFrameBufferStartAddresses((void*)frameBuf, (void*)0, (void*)0);
You should have something similar in your project.
2020-12-17 01:20 AM
@Flemming Gram CHRISTENSEN
yes GetClientFrameBuffer always returns zero. Also, Screen1ViewBase :: Screen1ViewBase () does not have a cut. What could be the reason for this? I am sending my adjustments in the attachment.
2020-12-17 01:27 AM
In the copyFrameBufferBlockToLCD(const Rect rect) you should not loop to 480 if your display is 240x240.
This method is called when a block in the framebuffer is drawn (could be the whole screen).
I think you should also call LCD_SetDisplayWindow here with the rect coordinates.
void TouchGFXHAL::flushFrameBuffer(const Rect& rect)
{
// Partial framebuffer might be supported for this platform only when Double
// Buffering is enabled
dma.flush();
HAL::flushFrameBuffer(rect);
/* Set Cursor */
__ST7789H2_SetDisplayWindow(rect.x, rect.y, rect.width, rect.height);
/* Prepare to write to LCD RAM */
ST7789H2_WriteReg(ST7789H2_WRITE_RAM, (uint8_t*)NULL, 0);
/* Read dummy data */
LCD_IO_ReadData();
this->copyFrameBufferBlockToLCD(rect);
}
void TouchGFXHAL::copyFrameBufferBlockToLCD(const Rect rect)
{
__IO uint16_t* ptr;
int16_t height;
// Use default implementation (CPU copy!).
// This can be accelerated using regular DMA hardware
for (height = 0; height < rect.height ; height++)
{
ptr = getClientFrameBuffer() + rect.x + (height + rect.y) * 240;
LCD_IO_WriteMultipleData((uint16_t*)ptr, rect.width);
}
}
2020-12-17 01:47 AM
@Flemming Gram CHRISTENSEN Ekranım 800x480 çözünürlükte 7inch bir ekran.
2020-12-17 01:48 AM
@Flemming Gram CHRISTENSEN My screen is a 7inch screen with 800x480 resolution.
2020-12-17 02:10 AM
Sorry, @Flemming Gram CHRISTENSEN photo it is 240x240. Because I tried it with other resolution values. Although I tried 240x240 resolution, ptr = getClientFrameBuffer () + rect.x + (height + rect.y) * 240; , Although I tried 800x480 resolution ptr = getClientFrameBuffer () + rect.x + (height + rect.y) * 480; I am making my adjustments.
2020-12-17 03:31 AM
How do you tick TouchGFX on screen refresh?
Do you have code like this:
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
/* Prevent unused argument(s) compilation warning */
if(GPIO_Pin == LCD_TE_Pin)
{
uint8_t PinStatus = (HAL_GPIO_ReadPin(LCD_TE_GPIO_Port, LCD_TE_Pin) == GPIO_PIN_SET ? 1 : 0);
TouchGFX_TickHandler(PinStatus);
}
}
TouchGFX is only drawing something when the screen is updating. So you need to propagate the signal. This is from the F412 template.
2020-12-17 03:39 AM
To emphasize what Flemming says, please check the STM32F412-Disco FMC Application Template from TouchGFX Designer for a concrete example. You may find some hints. Generally i would (which flemming also mentioned):
1) Verify Generator configuration (Custom LCD interface, Custom TouchGFX tick driver)
2) Verify your tick driver implementation (handleTickEvent() should be called continuously in your view) - get inspiration from f412 AT.
3) Verify that your driver can transfer something to display. Verify that you can do it from flushFrameBuffer(Rect& rect)
4) Inspect 0x60000000 to see if TouchGFX is rendering something. Is your memory configured correctly? CubeMX does not help you here with latency configuration, etc, since chip dependant - configure in a user code section.
/Martin
2020-12-17 03:56 AM
@Flemming Gram CHRISTENSEN Yes, there is.