GUI on M4 rotated by 90 degrees, why?

Hi,
I am currently programming my GUI on the M4 of the Giga R1 and I have the problem that my GUI is displayed rotated by 90 degrees. When I run the same code on the M7 it appears correctly. Why does it display differently on the M4?
I have also tried the GUI with the function "lv_disp_set_rotation(NULL, LV_DISPLAY_ROTATION_270);" does not work as nothing changes here.

The following call does not work at all on the M4:
"Arduino_H7_Video Display(800, 480, GigaDisplayShield);"

I use lvgl 9.2.2 and Mbed OS 4.2.4

What can I do?


#include <mbed.h>
#include "RPC.h"

#ifdef CORE_CM7
void setupM7() {
  RPC.begin();
  Serial.println("setupM7()");
  delay(100);
}

void loopM7() {
  Serial.println("loopM7()");
  delay(1000);
}
#else
#define LV_CONF_INCLUDE_SIMPLE 1

#include <lvgl.h>
#include <Arduino_GigaDisplay.h>
#include <Arduino_GigaDisplayTouch.h>
#include "Arduino_H7_Video.h"

lv_obj_t* g_pObjButton = NULL, *g_pObjBtnLabel = NULL, *g_pWLANScreen = NULL;

// This doesnt work on M4
// Arduino_H7_Video          Display(800, 480, GigaDisplayShield);

// This works, but the Dispaly is rotated by 90 degrees
Arduino_H7_Video          Display(480, 800, GigaDisplayShield);

Arduino_GigaDisplayTouch  TouchDetector;
GigaDisplayRGB rgb;

static void btn_event_cb1(lv_event_t* e) {
  //Serial.println("btn_event_cb1");
}

void initScanButton() {
  g_pWLANScreen = lv_obj_create(lv_scr_act());
	lv_obj_set_size(g_pWLANScreen, Display.width(), Display.height());
	lv_obj_clear_flag(g_pWLANScreen, LV_OBJ_FLAG_SCROLLABLE);
	lv_obj_center(g_pWLANScreen);

	g_pObjButton = lv_btn_create(g_pWLANScreen);
	lv_obj_set_width(g_pObjButton, 200);
	lv_obj_set_height(g_pObjButton, 80);
	lv_obj_set_x(g_pObjButton, 0);
	lv_obj_set_y(g_pObjButton, 0);
	lv_obj_add_event_cb(g_pObjButton, btn_event_cb1, LV_EVENT_RELEASED, NULL);

	lv_obj_clear_flag(g_pObjButton, LV_OBJ_FLAG_SCROLLABLE);
	lv_obj_set_align(g_pObjButton, LV_ALIGN_CENTER);
	lv_obj_add_flag(g_pObjButton, LV_OBJ_FLAG_SCROLL_ON_FOCUS);     /// Flags
	lv_obj_clear_flag(g_pObjButton, LV_OBJ_FLAG_SCROLLABLE);      /// Flags
	lv_obj_set_style_bg_color(g_pObjButton, lv_color_hex(0xDCDCDC), LV_PART_MAIN | LV_STATE_DEFAULT);
	lv_obj_set_style_bg_opa(g_pObjButton, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
	lv_obj_set_style_border_color(g_pObjButton, lv_color_hex(0xB4B4B4), LV_PART_MAIN | LV_STATE_DEFAULT);
	lv_obj_set_style_border_opa(g_pObjButton, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
	lv_obj_set_style_border_width(g_pObjButton, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
	lv_obj_set_style_text_color(g_pObjButton, lv_color_hex(0x808080), LV_PART_MAIN | LV_STATE_DEFAULT);
	lv_obj_set_style_text_opa(g_pObjButton, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
	lv_obj_set_style_text_align(g_pObjButton, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
	lv_obj_set_style_text_font(g_pObjButton, &lv_font_montserrat_14, LV_PART_MAIN | LV_STATE_DEFAULT);
	g_pObjBtnLabel = lv_label_create(g_pObjButton);
	lv_label_set_text(g_pObjBtnLabel, "Scannen");
	lv_obj_set_style_text_color(g_pObjBtnLabel, lv_color_black(), 0);
	lv_obj_center(g_pObjBtnLabel);
}

void setupM4() {
  RPC.begin();
  Display.begin();
	TouchDetector.begin();
	rgb.begin();

  initScanButton();

}

void loopM4() {
  lv_timer_handler();

}
#endif

void setup() {
#ifdef CORE_CM7
	setupM7();
#else
	setupM4();
#endif
}

void loop() {
#ifdef CORE_CM7
	loopM7();
#else
	loopM4();
#endif

}

Can nobody help?

Show this.

I have deleted your other cross-post @mikemm101.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

This is the correct display, that was created with M7-Core. Here i can create the Display Object with the call:
"Arduino_H7_Video Display(800, 480, GigaDisplayShield);"

But, i want to use the M4-Core to handle my Display Objects. The call:
"Arduino_H7_Video Display(800, 480, GigaDisplayShield);"
doesn't work, the display is black and show nothing.

But if i use the call: "Arduino_H7_Video Display(480, 800, GigaDisplayShield);" (the resolution values are switched), then it shows the display rotated.

In this case i have also tried the GUI with the function
"lv_disp_set_rotation(NULL, LV_DISPLAY_ROTATION_270);"
does not work as nothing changes here.

Have you tried the IMU example? Perhaps the IMU is not initialized (if that can happen)

DroneBotWorkShop shows the IMU example...

Is the M4 booted?
from this link: https://docs-content.arduino.cc/tutorials/giga-r1-wifi/giga-dual-core/

The M7 is referred to as the main processor due its superior hardware features, as well as it is required to run to boot the M4 core (you boot the M4 from within the M7).

Many thanks for the information. I already know the tutorial on giga dual core and RPC. In my example above, I can already see my GUI with the M4. I don't know how the example with the IMU will help me here. I don't want a rotation of my GUI.
I suspect that there is an error in the Arduino_H7_Video Display class. Because when I call
"Arduino_H7_Video Display(480, 800, GigaDisplayShield);" with the M7, my GUI is visible. If I make the same call with the M4, the display remains black. If I now switch the values 480 and 800, I can also see the GUI with the M4, but rotated by 90 degrees.

Can someone else check this error?

Thank you

Maybe this is sufficient information for a Github "pull request" - which I know nothing about - to notify the library author(s). I hope it is, and a solution happens soon. I think @ptillisch knows how this is accomplished, and if it should be done.

Post an issue on Github, possibly this repository.

That repository only contains some example sketches that demonstrate the usage of the GIGA Display Shield.

If it was necessary to demonstrate some special approach to using the Giga Display Shield from programs running on the M4 core, that would be the appropriate place to make a request or proposal. But if this is caused by a bug in the library code, then that is not the relevant repository since it does not contain the library code.

The source code of the "Arduino_H7_Video" library is hosted here:

In order to make all relevant information available to any who are interested in this subject, I'll share a link to formal report @mikemm101 submitted to the Arduino developers:

1 Like

Thanks for sharing. Now the question for me is who will fix this bug and how quickly? I have not yet received an answer to my issue. Have I forgotten something else?

The Arduino company employs a team of developers who fix bugs in the code such as the "Arduino_H7_Video" library which is maintained by the company.

This is free open source software, so any member of the Arduino community is also welcome to submit bug fixes.

In this case, I see that one of our developers has already prepared a fix:

In this case, a fix was produced within nine days.

The fix is still pending as it seems the developer was hoping to get a verification from you:

https://github.com/arduino/ArduinoCore-mbed/issues/1048#issuecomment-2824698135

Hey,
I probably found the error!
Give a spin with this fix #1052 and let me know :slight_smile:
Thanks

Once the fix has been verified, it will be merged into the source code. However, that fix will only be present in the version of the "Arduino Mbed OS Giga Boards" platform that is installed via the Arduino IDE Boards Manager after a new release of the platform has been made.