2021-06-04 05:34 AM
Hi all,
I want to use TouchGFX without STM HAL. In my project that uses STM32L476, the code was just written with another library (libohiboard on GitHub). Our customer asks to add a display to this project, and I would use TouchGFX but without ST HAL. I try to generate a project with CubeMX, but I can't find the glue layer between GFX and HAL where I can change the HAL call.
Can you help me? Is it possible?
Thanks
Best regards
Marco
Solved! Go to Solution.
2021-06-04 09:47 AM
Complete example for custom FMC and SPI Display Interface | TouchGFX Documentation
2021-06-04 08:30 AM
I mean TouchGFX use hal parts only in generated target for dma2d and in
void TouchGFXGeneratedHAL::setTFTFrameBuffer(uint16_t* adr)
{
LTDC_Layer1->CFBAR = (uint32_t)adr;
/* Reload immediate */
LTDC->SRCR = (uint32_t)LTDC_SRCR_IMR;
}
void TouchGFXGeneratedHAL::flushFrameBuffer(const touchgfx::Rect& rect)
{
HAL::flushFrameBuffer(rect);
}
extern "C"
{
void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc)
{
if (LTDC->LIPCR == lcd_int_active_line)
{
//entering active area
HAL_LTDC_ProgramLineEvent(hltdc, 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
HAL_LTDC_ProgramLineEvent(hltdc, lcd_int_active_line);
GPIO::clear(GPIO::VSYNC_FREQ);
HAL::getInstance()->frontPorchEntered();
}
}
}
Here is only one call HAL_LTDC_ProgramLineEvent(hltdc, lcd_int_active_line);, when you rewrite this to regs, target code is ok without hal.
Try explain what you need change?
2021-06-04 08:39 AM
Hi,
thanks for your reply. I use STM32L476 and I would use FMC to communicate with the display.
Into TouchGFXGeneratedHAL I don't see any reference to FMC:
namespace {
// Use the section "TouchGFX_Framebuffer" in the linker to specify the placement of the buffer
LOCATION_PRAGMA("TouchGFX_Framebuffer")
uint32_t frameBuf[(((240 + 7) / 8) * 128 + 3) / 4] LOCATION_ATTRIBUTE("TouchGFX_Framebuffer");
}
void TouchGFXGeneratedHAL::initialize()
{
HAL::initialize();
registerEventListener(*(Application::getInstance()));
enableLCDControllerInterrupt();
enableInterrupts();
setFrameBufferStartAddresses((void*)frameBuf, (void*)0, (void*)0);
/*
* Set whether the DMA transfers are locked to the TFT update cycle. If
* locked, DMA transfer will not begin until the TFT controller has finished
* updating the display. If not locked, DMA transfers will begin as soon as
* possible. Default is true (DMA is locked with TFT).
*/
lockDMAToFrontPorch(true);
}
void TouchGFXGeneratedHAL::configureInterrupts()
{
}
void TouchGFXGeneratedHAL::enableInterrupts()
{
}
void TouchGFXGeneratedHAL::disableInterrupts()
{
}
void TouchGFXGeneratedHAL::enableLCDControllerInterrupt()
{
}
inline uint8_t* TouchGFXGeneratedHAL::advanceFrameBufferToRect(uint8_t* fbPtr, const touchgfx::Rect& rect) const
{
// Advance vertically Advance horizontally
fbPtr += rect.y * lcd().framebufferStride() + rect.x / 8;
return fbPtr;
}
uint16_t* TouchGFXGeneratedHAL::getTFTFrameBuffer() const
{
return (uint16_t*)frameBuf;
}
void TouchGFXGeneratedHAL::setTFTFrameBuffer(uint16_t* adr)
{
//setTFTFrameBuffer() not used for selected display interface
}
void TouchGFXGeneratedHAL::flushFrameBuffer(const touchgfx::Rect& rect)
{
HAL::flushFrameBuffer(rect);
}
bool TouchGFXGeneratedHAL::blockCopy(void* RESTRICT dest, const void* RESTRICT src, uint32_t numBytes)
{
return HAL::blockCopy(dest, src, numBytes);
}
I don't know where to modify to detach ST HAL.
2021-06-04 09:08 AM
Here isnt STM HAL. HAL:: is cpp TouchGFX HAL layer .
FMC is custom type interface, then you need write your own code where you simply not use HAL. But why you plan FMC instead RGB?
2021-06-04 09:18 AM
Yes, I know that there isn't STM HAL into this file... but with CubeMX I select the custom interface on TouchGFX, and when I activate the FMC the red point on TouchGFX come green! So, I think that there is just a connection between FMC and TouchGFX.
"FMC is custom type interface, then you need write your own code where you simply not use HAL."
Where can I put the code? I don't understand!
" But why you plan FMC instead RGB?"
What do you mean? The customer display is https://www.winstar.com.tw/it/products/graphic-lcd-display-module/display-lcd-240x128.html and I think it is the only way to manage this display. is it wrong?
2021-06-04 09:47 AM
Complete example for custom FMC and SPI Display Interface | TouchGFX Documentation
2021-06-07 12:24 AM
Thanks! I didn't see this section!