cancel
Showing results for 
Search instead for 
Did you mean: 

CAN bus and TouchGFX

itxs
Associate II

Hi,

In my system I have 2 devices connected over CAN bus (one on F746, second on F205), and F746 runs a TouchGFX application (800x600x16bpp) with 2 lightweight screens; FreeRTOS and SysTick configured to 100Hz. My problem is that image on screen may suddenly trembling (moves <-->), if CAN bus connected. If I disconnect second device trembling will stop. If I increase size of data transfer over CAN bus then screen picture trembling will increase. Sometimes only the random horizontal part of the screen shakes. The time during which the band is offset is approximately 1 frame or 17-20 ms. I watched LTDC rgb gpio outputs, and noticed that they changes too, so its not a synch lost. I think this is due to interruption priority (CAN and DMA2D/LTDC), but changing priority doesnt make an effect.0690X0000089Kx3QAE.png

8 REPLIES 8
Martin KJELDSEN
Chief III

Hi @itxs​,

What happens after you receive your data over CAN? Are you writing to the same memory the framebuffer is located? Now, it looks like your application is fairly simple currently, but you may have a lot of actors accessing the memory. DMA2D, LTDC, CAN. Maybe you're having memory contention issues. What is your VSYNC currently? Can you try slowing down your application by adjusting the porch areas a bit to see if that helps?

You can also try to set hal.lockDMAToFrontPorch(true) in the boardconfiguration to ease the pressure to start with to see if that helps.

Thanks for answer. lockDMAToFrontPorch(true) changes nothing, i tried this yesterday.

After receiving CAN data writes to SRAM buffers (not DRAM where videobuffer is located). This data viewed by my application protocol over CAN which manager I put to a separate FreeRTOS task.

TouchGFX task have priority tskIDLE_PRIORITY + 3

CAN application protocol have priority tskIDLE_PRIORITY + 2

I tried to change front porch, but picture on screen moved to right. Also i turn on setFrameRateCompensation to normalize animation timings, it doesnt not affect screen shake.

VSYNC GPIO:0690X0000089hTfQAI.png

VSYNC frequency is 62.7 Hz

itxs
Associate II

I discovered that turning large Model class members into global variables can reduce or even get rid of screen shake. Anyone knows how Model class size affects screen shake or speed?

Martin KJELDSEN
Chief III

Hi @itxs​,

I don't see how the size of the model should matter to run time performance. Do you have a video of this screen shake?

Martin KJELDSEN
Chief III

Any update on this @itxs​ ?

I found that this problem depends of how many time the CPU must give to non-graphic work. I refactored and optimized whole project and shaking disappear. In addition to my words that "turning large Model class members into global variables can reduce or even get rid of screen shake" I think that cpu takes more time to get access to Model class data than if that data was global variable. CAN events also consumes a lot of CPU cycles.

Okay, so i guess that's good news? Any issues left?

/Martin

I want to know is I right that cpu takes more time to get access to Model class data than if that data was global variable? If right, then why?