Skip to content

GIGA Display - Graphics offset when running on M4. #743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AndrewCapon opened this issue Oct 24, 2023 · 2 comments · Fixed by #879
Closed

GIGA Display - Graphics offset when running on M4. #743

AndrewCapon opened this issue Oct 24, 2023 · 2 comments · Fixed by #879
Assignees
Labels
bug Something isn't working

Comments

@AndrewCapon
Copy link

Hi Guys,

There seems to be an issue with any code running on the M4 talking to the display.

I first noticed it with LVGL running on the M4, but it seems to effect everything.

I have enabled the pattern generator in dsi.cpp with HAL_DSI_PatternGeneratorStart(&dsi, 1, 0); and everything looks good here, the pattern is fine.

You can replicate with:

#include "Arduino_GigaDisplay_GFX.h"
#include "RPC.h"

GigaDisplay_GFX display;

void setup() 
{
  RPC.begin();
}

void loop() 
{
  display.fillScreen(0);
  display.fillRect(0,0,100,100, 0xffff);
}

IMG_1500

@AndrewCapon
Copy link
Author

Ok, after a bit of investigation its the PLL that is causing the issue:

int dsi_init(uint8_t bus, struct edid *edid, struct display_timing *dt) {
#ifdef ARDUINO_GIGA
	static const uint32_t DSI_PLLNDIV = 125;
	static const uint32_t DSI_PLLIDF = DSI_PLL_IN_DIV3;
	static const uint32_t DSI_PLLODF = DSI_PLL_OUT_DIV1;
	static const uint32_t DSI_TXEXCAPECLOCKDIV = 4;
#else
	static const uint32_t DSI_PLLNDIV = 40;
	static const uint32_t DSI_PLLIDF = DSI_PLL_IN_DIV2;
	static const uint32_t DSI_PLLODF = DSI_PLL_OUT_DIV1;
	static const uint32_t DSI_TXEXCAPECLOCKDIV = 4;
#endif

On the M4 if the second set of values are used it works fine.

@AndrewCapon
Copy link
Author

so this sorts it out for both M7 and M4, just incase someone finds this before it is fixed properly:

int dsi_init(uint8_t bus, struct edid *edid, struct display_timing *dt) {
#ifdef ARDUINO_GIGA
	static uint32_t DSI_PLLNDIV = 125;
	static uint32_t DSI_PLLIDF = DSI_PLL_IN_DIV3;
	static uint32_t DSI_PLLODF = DSI_PLL_OUT_DIV1;
	static uint32_t DSI_TXEXCAPECLOCKDIV = 4;
  if (HAL_GetCurrentCPUID() == CM4_CPUID) {
    DSI_PLLNDIV = 40;
    DSI_PLLIDF = DSI_PLL_IN_DIV2;
    DSI_PLLODF = DSI_PLL_OUT_DIV1;
    DSI_TXEXCAPECLOCKDIV = 4;
  }
#else
	static const uint32_t DSI_PLLNDIV = 40;
	static const uint32_t DSI_PLLIDF = DSI_PLL_IN_DIV2;
	static const uint32_t DSI_PLLODF = DSI_PLL_OUT_DIV1;
	static const uint32_t DSI_TXEXCAPECLOCKDIV = 4;
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants