-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
boards: shield: Support touch for the NXP LCD-PAR-S035 LCD on MCXN947 #75353
Conversation
Hello @groncarolonxp, and thank you very much for your first pull request to the Zephyr project! |
The PR has been tested on |
@groncarolonxp you've verified the orientation on LVGL as well? |
@PetervdPerk-NXP you are absolutely right To have the second demo show the button I had to add
I have a doubt that is in general correct: what do you think? Myabe something like
would be acceptable? |
13a4f8b
to
e67eff9
Compare
It seems to match what do in other LCD touchscreen overlays as well zephyr/boards/shields/rk043fn66hs_ctg/Kconfig.defconfig Lines 8 to 10 in 3bcaa6f
Maybe @danieldegrasse could shed a light on this. |
&flexcomm2_lpi2c2 { | ||
status = "okay"; | ||
gt911_lcd_par_s035: gt911-lcd_par_s035@5d { | ||
compatible = "goodix,gt911"; | ||
reg = <0x5d>; | ||
irq-gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; | ||
alt-addr = <0x14>; | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally there should be no board specific overlay? If the shield as a touch controller, it should be in the shield overlay. The irq-gpios should also be made generic and rely on a GPIO nexus so that "gpio4 6" is not hard-coded but instead references a physical pin on whatever connector is used to interface the shield with the board.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for you comment: that was our first take and we added the GPIO in the dtsi of the board and the refenced in the shield overlay.
The issue is that on MCXn974 the reset pin of the LCD and the touch controller are shared so we would end up ( i fear) having to write this specific overlay anyway.
To be more clear: a generic implementation would not have
alt-addr = <0x14>;
but another GPIO for reset that cannot be specified for MCX
That is why we ended up with this solution and given it is board specific we specified the GPIO directly here.
We can put the GPIO into the mcx dts(i) and reference it here, but we would still need this specif board overlay.
Do you see my point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's one thing to have a board specific overlay for what's really unique to the board, but it's another to have the entire definition associated with the touch controller be 100% board specific. This kind of defeats the purpose of having shields in the first place :)
As the physical interface between the shield and the host board is a 28-pin FlexIO header, this header should be defined as a GPIO nexus, all the boards having such a connector (ex. MCXN947) should indicate what actual GPIOs are routed to each of the 28-pins, and the (generic) shield overlay should then once and for all indicate that the reset pin is pin #7 of the GPIO Nexus, as this will always be true.
Similarly, and sorry that I didn't catch it yesterday, the generic shield overlay should not make any mention of flexcomm2_lpi2c2
, which is board specific, but instead attach the touch controller to something like flexio_i2c
, which each board would define similarly to how boards with arduino headers inidcate which I2C bug is exposed as arduino_i2c
.
BTW: it would be great if someone from NXP could also send a PR adding Arduino and MikroE headers definition for the FRDM MCXN947, i.e. something similar to
zephyr/boards/nxp/lpcxpresso55s06/lpcxpresso55s06_common.dtsi
Lines 68 to 117 in 763dba5
mikrobus_header: mikrobus-connector { | |
compatible = "mikro-bus"; | |
#gpio-cells = <2>; | |
gpio-map-mask = <0xffffffff 0xffffffc0>; | |
gpio-map-pass-thru = <0 0x3f>; | |
gpio-map = <0 0 &gpio0 16 0>, /* AN */ | |
/* Not a GPIO */ /* RST */ | |
<2 0 &gpio1 1 0>, /* CS */ | |
<3 0 &gpio1 2 0>, /* SCK */ | |
<4 0 &gpio1 3 0>, /* MISO */ | |
<5 0 &gpio0 26 0>, /* MOSI */ | |
/* +3.3V */ | |
/* GND */ | |
<6 0 &gpio1 5 0>, /* PWM */ | |
<7 0 &gpio0 28 0>, /* INT */ | |
<8 0 &gpio1 10 0>, /* RX */ | |
<9 0 &gpio1 11 0>, /* TX */ | |
<10 0 &gpio0 24 0>, /* SCL */ | |
<11 0 &gpio0 25 0>; /* SDA */ | |
/* +5V */ | |
/* GND */ | |
}; | |
arduino_header: arduino-connector { | |
compatible = "arduino-header-r3"; | |
#gpio-cells = <2>; | |
gpio-map-mask = <0xffffffff 0xffffffc0>; | |
gpio-map-pass-thru = <0 0x3f>; | |
gpio-map = <0 0 &gpio0 16 0>, /* A0 */ | |
<1 0 &gpio0 23 0>, /* A1 */ | |
<2 0 &gpio0 9 0>, /* A2 */ | |
<3 0 &gpio0 0 0>, /* A3 */ | |
<4 0 &gpio0 13 0>, /* A4 */ | |
<5 0 &gpio0 14 0>, /* A5 */ | |
<6 0 &gpio1 10 0>, /* D0 */ | |
<7 0 &gpio1 11 0>, /* D1 */ | |
<8 0 &gpio0 15 0>, /* D2 */ | |
<9 0 &gpio0 23 0>, /* D3 */ | |
<10 0 &gpio0 22 0>, /* D4 */ | |
<11 0 &gpio0 19 0>, /* D5 */ | |
<12 0 &gpio0 18 0>, /* D6 */ | |
<13 0 &gpio0 2 0>, /* D7 */ | |
<14 0 &gpio0 10 0>, /* D8 */ | |
<15 0 &gpio0 25 0>, /* D9 */ | |
<16 0 &gpio1 1 0>, /* D10 */ | |
<17 0 &gpio0 26 0>, /* D11 */ | |
<18 0 &gpio1 3 0>, /* D12 */ | |
<19 0 &gpio1 2 0>; /* D13 */ | |
}; | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot fot the pointers!
I will write it in that way and push it when ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kartben I hope I got it more as it should ( I will split the commit into more reasonable chunks as soon as the content is right) :)
e67eff9
to
f5bf20b
Compare
gt911_lcd_par_s035: gt911-lcd_par_s035@5d { | ||
compatible = "goodix,gt911"; | ||
reg = <0x5d>; | ||
irq-gpios = <&nxp_flexio_connector 0 GPIO_ACTIVE_HIGH>; // INT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks wrong irq-gpios
is an phandle-array
now the 2nd assignment overrules the first one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right!
NXP LCD-PAR-S035 LCD supports touch: enable it The reset pin of the LCD and the touch controller are shared so we set alt-addr to select GT911 I2C address by probing Co-authored-by: Pascal Mareau <[email protected]> Co-authored-by: Guido Roncarolo <[email protected] Signed-off-by: Guido Roncarolo <[email protected]>
f5bf20b
to
82fcb0d
Compare
&flexio_i2c { | ||
status = "okay"; | ||
gt911_lcd_par_s035: gt911-lcd_par_s035@5d { | ||
compatible = "goodix,gt911"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to duplicate the full definition here, you can just delete the reset-gpios
property and add alt-addr
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping here- still need to drop these extra properties. We really just need something like this:
>911_lcd_par_s035 {
/delete-property/ reset-gpios;
alt-addr = <0x14>;
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Daniel,
I think that these commits
b38a4cc Dominik Lau Fri Sep 27 10:17:05 2024 +0200 boards: added touch controller to the /chosen
node
f8f70c2 Daniel DeGrasse Mon Aug 26 15:58:32 2024 +0000 boards: shields: lcd_par_s035: enable reset gpio within input module
3604aba Daniel DeGrasse Mon Sep 23 09:29:43 2024 -0500 shields: lcd_par_s035: rename nxp_flexio_lcd to zephyr_mipi_dbi_parallel
already introduce the touch on S035 LCD so this PR might not be very relevant anymore
I tested on 4.0.0 tag
west build -b frdm_mcxn947/mcxn947/cpu0 zephyr/samples/subsys/input/input_dump -- -DSHIELD=lcd_par_s035_8080
input_dump works OK
Input sample started
I: input event: dev=gt911-lcd_par_s035@5d type= 3 code= 0 value=27
I: input event: dev=gt911-lcd_par_s035@5d type= 3 code= 1 value=28
But lvgl demo
west build -b frdm_mcxn947/mcxn947/cpu0 zephyr/samples/subsys/display/lvgl -- -DSHIELD=lcd_par_s035_8080
has a button that is not clickable
I suspect, as we had tried the prio trick too, that when both display and touch are used it does not
work as espected.
Could you please test and confirm, to rule out I am doing something stupid ? :)
Thnaks !!
g.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locally when I build and flash samples/subsys/display/lvgl
on 4.0.0 like so: west build -p always -b frdm_mcxn947/mcxn947/cpu0 samples/subsys/display/lvgl --shield=lcd_par_s035_8080
, I see a button and can click it.
Maybe check what cmake prints for your Zephyr version?
Zephyr version: 4.0.0 (/home/danieldegrasse/zephyr/zephyrproject/zephyr)
is what I see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Daniel!
I changed display and it indeed works :)
Thnaks so much
I think we can close this PR here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'm going to leave it up to @groncarolonxp to close the PR (which I assume is also you- just for future reference, please try to engage with just one github account, it makes things easier to follow)
@@ -52,14 +52,26 @@ | |||
status = "disabled"; | |||
}; | |||
}; | |||
|
|||
nxp_flexio_connector: flexio-connector { | |||
compatible = "gpio-nexus"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be defining a custom compatible for the flexio connector, and adding a pin map in the dt binding. See here for an example for the 6 pin FPC touch connector present on NXP RT10xx EVKs:
following assignments: |
Also, should we be defining additional pins beyond the INT and RESET? The FlexIO connector is 28 pins in total, and many can be used as GPIOs, right?
Generally the approach taken is to define all pins for the interface in the binding file, and only define the pins that are actually in use as GPIOs in the devicetree for the board. A good example of this would be the 40 pin parallel LCD connector on the RT10xx boards:
1 LED backlight cathode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the suggestion!
duly applied
Signed-off-by: Guido Roncarolo <[email protected]>
Signed-off-by: Guido Roncarolo <[email protected]>
Binding is in the correct folder, my bad.
@@ -4,6 +4,11 @@ | |||
if SHIELD_LCD_PAR_S035 | |||
if LVGL | |||
|
|||
# Configure LVGL to use touchscreen with KSCAN API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Configure LVGL to use touchscreen with KSCAN API | |
# Configure LVGL to use touchscreen with INPUT API |
&flexio_i2c { | ||
status = "okay"; | ||
gt911_lcd_par_s035: gt911-lcd_par_s035@5d { | ||
compatible = "goodix,gt911"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping here- still need to drop these extra properties. We really just need something like this:
>911_lcd_par_s035 {
/delete-property/ reset-gpios;
alt-addr = <0x14>;
};
@groncarolonxp will you be coming back to this PR? |
I'll close the PR as agreed as it is not relevent anymore |
Deleting this as the support is already integrated |
NXP LCD-PAR-S035 LCD supports touch: enable it
The reset pin of the LCD and the touch controller are shared so we set alt-addr to select GT911 I2C address by probing