Madelyn T
Published © MIT

Zephyr GUI EV Charger RT1170

Take a ride with our EV demo! GPIO switches, night mode via ADC photoresistor, I2C display, all on the phyCORE-RT1170. πŸš—πŸ”‹βœ¨

IntermediateWork in progress8 hours343
Zephyr GUI EV Charger RT1170

Things used in this project

Hardware components

PHYTEC phyCORE-RT1170 Development Kit
PCM-073.A0, PL1569.0 (MX25 SPI NOR), PBA-C-26.A1, PL1570.1 Comes with: 5V USB-C Power Adapter Micro-USB Cable
×1
NXP RK055HDMIPI4MA0 5.5” LCD Display
NXP I2C display. Do not use ribbon cable with LCD. Display cable comes with LCD.
×1
Ks0028 Keystudio Photoresistor Sensor
This sensor can be easily made with a perf board by connecting a 10K resistor to the ADC line and connecting the other leg of the photoresistor to 5V line. Photoresistor MFG# PDV-P5002 is recommended.
×1
J-Link Segger Base JTAG Device
Needed to flash NOR SPI Flash. V7.88 was used. https://www.segger.com/downloads/jlink/JLink_Linux_V788_x86_64.deb The NXP MCU-Link Debugger tool can also be used instead. https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcu-link-debug-probe:MCU-LINK
×1
J-Link 9-pin Adapter Cable
Needed to connect JTAG device to phyCORE-RT1170 carrier board.
×1
Female/Female Jumper Wires
Female/Female Jumper Wires
Needed to connect phyCORE-RT1170 carrier board to GPIO switches (4) and photoresistor sensor (3). I created a custom cable harness for this to look professional.
×7
Tinned Copper Wire, Solid
Tinned Copper Wire, Solid
(OPTIONAL) Used for 2 small reworks so that only one header needed to be used. Otherwise jumper wires can be used.
×1

Software apps and online services

Zephyr RTOS
Zephyr Project Zephyr RTOS
I used the zephyr-sdk-0.16.8 for this project. I believe the newer versions should work just fine. Getting Started: https://docs.zephyrproject.org/latest/develop/getting_started/index.html
Ubuntu 22.04
Used as Linux Host for Zephyr environment.
GitHub Account
NXP GUI Guider
GUI Guider is a user-friendly graphical user interface development tool from NXP that enables the rapid development of high quality displays with the open-source LVGL graphics library. GUI Guider's drag-and-drop editor makes it easy to utilize the many features of LVGL such as widgets, animations and styles to create a GUI with minimal or no coding at all.

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
(OPTIONAL) If using copper wires to rework for single header use.
Solder Wire, Lead Free
Solder Wire, Lead Free
(OPTIONAL) If using copper wires to rework for single header use.
Solder Flux, Soldering
Solder Flux, Soldering
(OPTIONAL) If using copper wires to rework for single header use.

Story

Read more

Custom parts and enclosures

phyCAR DXF Outline

This shape was used to create the phyCAR PCB outline using kicad 7.0.

Schematics

phyBOARD-RT1170 Carrier Board Schematic

Contact PHYTEC support for full schematics
https://jira.phytec.com/servicedesk/customer/portal/3

phyBOARD-RT1170 Component Placement

This shows the layout of the carrier board.

phyCAR Schematic

This was created in Kicad 7.0.

Code

ev-car-v6-zephyr.tar.gz

C/C++
This file contains the GUI Guider project files that are needed to run the display.
No preview (download only).

ev-car-v6-full-demo.patch

C/C++
Adjusting the device tree for the RT1170 to support the ADC photoresistor sensor.
diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk-pinctrl.dtsi b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk-pinctrl.dtsi
index 4031f2383f3..81f56e5ef69 100644
--- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk-pinctrl.dtsi
+++ b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk-pinctrl.dtsi
@@ -85,64 +85,6 @@
 	pinmux_ptp: pinmux_ptp {
 	};
 
-	pinmux_enet1g: pinmux_enet1g {
-		group0 {
-			pinmux = <&iomuxc_gpio_disp_b1_11_enet_1g_tx_clk_io>,	// ENET_RGMII_TXC
-				<&iomuxc_gpio_disp_b1_01_enet_1g_rx_clk>;	// ENET_RGMII_RXC
-			bias-disable;
-			drive-strength = "high";
-			slew-rate = "fast";
-			input-enable;
-		};
-		group1 {
-			pinmux = <&iomuxc_gpio_disp_b1_09_enet_1g_tdata00>,	// ENET_RGMII_TXD0
-				<&iomuxc_gpio_disp_b1_08_enet_1g_tdata01>,	// ENET_RGMII_TXD1
-				<&iomuxc_gpio_disp_b1_07_enet_1g_tdata02>,	// ENET_RGMII_TXD2
-				<&iomuxc_gpio_disp_b1_06_enet_1g_tdata03>,	// ENET_RGMII_TXD3
-				<&iomuxc_gpio_disp_b1_10_enet_1g_tx_en>;	// ENET_RGMII_TX_EN
-			drive-strength = "high";
-			bias-pull-up;
-			slew-rate = "fast";
-		};
-		group2 {
-			pinmux = <&iomuxc_gpio_disp_b1_02_enet_1g_rdata00>,	// ENET_RGMII_RXD0
-				<&iomuxc_gpio_disp_b1_03_enet_1g_rdata01>,	// ENET_RGMII_RXD1
-				<&iomuxc_gpio_disp_b1_04_enet_1g_rdata02>,	// ENET_RGMII_RXD2
-				<&iomuxc_gpio_disp_b1_05_enet_1g_rdata03>,	// ENET_RGMII_RXD3
-				<&iomuxc_gpio_disp_b1_00_enet_1g_rx_en>;	// ENET_RGMII_RX_EN
-			drive-strength = "high";
-			bias-pull-down;
-			slew-rate = "fast";
-			input-enable;
-		};
-	};
-
-	pinmux_enet1g_mdio: pinmux_enet1g_mdio {
-		group0 {
-			pinmux = <&iomuxc_gpio_disp_b2_13_gpio11_io14>;	// ETHPHY_RST_B
-			drive-strength = "high";
-			bias-pull-down;
-			slew-rate = "slow";
-		};
-		group1 {
-			pinmux = <&iomuxc_gpio_disp_b2_12_gpio_mux5_io13>;	// RGMII1_PHY_INTB
-			drive-strength = "high";
-			bias-pull-down;
-			slew-rate = "fast";
-			input-enable;
-		};
-		group2 {
-			pinmux = <&iomuxc_gpio_emc_b2_19_enet_1g_mdc>,	// ENET_RGMII_MDC
-				<&iomuxc_gpio_emc_b2_20_enet_1g_mdio>;		// ENET_RGMII_MDIO
-			drive-strength = "high";
-			bias-pull-down;
-			slew-rate = "fast";
-		};
-	};
-
-	pinmux_enet1g_ptp: pinmux_enet1g_ptp {
-	};
-
 	pinmux_flexcan3: pinmux_flexcan3 {
 		group0 {
 			pinmux = <&iomuxc_lpsr_gpio_lpsr_01_can3_rx>,
@@ -203,17 +145,20 @@
 
 	pinmux_lpadc0: pinmux_lpadc0 {
 		group0 {
-			pinmux = <&iomuxc_gpio_ad_06_adc1_ch0a>;
+			pinmux = <&iomuxc_gpio_ad_13_adc1_ch3b>, 
+				 <&iomuxc_gpio_ad_06_adc1_ch0a>;
 			drive-strength = "high";
 			bias-pull-down;
 			slew-rate = "fast";
 		};
+
 	};
 
+
 	pinmux_lpi2c1: pinmux_lpi2c1 {
 		group0 {
 			pinmux = <&iomuxc_gpio_ad_08_lpi2c1_scl>,
-				<&iomuxc_gpio_ad_09_lpi2c1_sda>;
+			         <&iomuxc_gpio_ad_09_lpi2c1_sda>;
 			drive-strength = "normal";
 			drive-open-drain;
 			slew-rate = "fast";
@@ -224,8 +169,8 @@
 	/* Connected to FXOS8700 */
 	pinmux_lpi2c5: pinmux_lpi2c5 {
 		group0 {
-			pinmux = <&iomuxc_lpsr_gpio_lpsr_05_lpi2c5_scl>,
-				<&iomuxc_lpsr_gpio_lpsr_04_lpi2c5_sda>;
+			pinmux = <&iomuxc_lpsr_gpio_lpsr_09_lpi2c5_scl>,
+				<&iomuxc_lpsr_gpio_lpsr_08_lpi2c5_sda>;
 			drive-strength = "normal";
 			drive-open-drain;
 			slew-rate = "fast";
diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi
index 072c1b18f1e..73793d05e75 100644
--- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi
+++ b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi
@@ -5,7 +5,6 @@
  */
 
 #include "mimxrt1170_evk-pinctrl.dtsi"
-#include <nxp/nxp_rt1170.dtsi>
 #include <zephyr/dt-bindings/input/input-event-codes.h>
 
 / {
@@ -13,6 +12,8 @@
 		led0 = &green_led;
 		led1 = &red_led;
 		sw0 = &user_button;
+		sw00 = &user_button_00;
+		sw01 = &user_button_01;
 		magn0 = &fxos8700;
 		accel0 = &fxos8700;
 		sdhc0 = &usdhc1;
@@ -22,23 +23,37 @@
 	leds {
 		compatible = "gpio-leds";
 		green_led: led-1 {
-			gpios = <&gpio9 3 GPIO_ACTIVE_HIGH>;
-			label = "User LED D6";
+			gpios = <&gpio13 12 GPIO_ACTIVE_HIGH>;
+			label = "Green LED D8";
 		};
 
 		red_led: led-2 {
-			gpios = <&gpio9 25 GPIO_ACTIVE_LOW>;
-			label = "User LED D34";
+			gpios = <&gpio13 11 GPIO_ACTIVE_HIGH>;
+			label = "Red LED D7";
 		};
 	};
 
 	gpio_keys {
 		compatible = "gpio-keys";
 		user_button: button-1 {
-			label = "User SW7";
-			gpios = <&gpio13 0 GPIO_ACTIVE_HIGH>;
+			label = "User Button";
+			gpios = <&gpio10 2 GPIO_ACTIVE_HIGH>;
 			zephyr,code = <INPUT_KEY_0>;
 		};
+		user_button_00: button-00 {
+			label = "User Button 00";
+//			gpios = <&gpio13 7 GPIO_ACTIVE_HIGH>;
+//			gpios = <&gpio10 1 GPIO_ACTIVE_HIGH>;	
+			gpios = <&gpio12 6 GPIO_ACTIVE_HIGH>;		
+			zephyr,code = <INPUT_KEY_1>;
+		};
+		user_button_01: button-01 {
+			label = "User Button 01";
+//			gpios = <&gpio13 8 GPIO_ACTIVE_HIGH>;
+//			gpios = <&gpio11 1 GPIO_ACTIVE_HIGH>;
+			gpios = <&gpio12 7 GPIO_ACTIVE_HIGH>;
+			zephyr,code = <INPUT_KEY_2>;
+		};
 	};
 
 	pwmleds {
@@ -87,6 +102,14 @@
 	status = "okay";
 };
 
+&user_button_00 {
+	status = "okay";
+};
+
+&user_button_01 {
+	status = "okay";
+};
+
 &green_led {
 	status = "okay";
 };
@@ -126,34 +149,6 @@
 	pinctrl-names = "default";
 };
 
-&enet1g_mac {
-	status = "disabled";
-	pinctrl-0 = <&pinmux_enet1g>;
-	pinctrl-names = "default";
-	phy-handle = <&enet1g_phy>;
-	phy-connection-type = "rgmii";
-	zephyr,random-mac-address;
-};
-
-&enet1g_mdio {
-	status = "disabled";
-	pinctrl-0 = <&pinmux_enet1g_mdio>;
-	pinctrl-names = "default";
-	enet1g_phy: phy@1 {
-		compatible = "realtek,rtl8211f";
-		reg = <1>;
-		status = "disabled";
-		reset-gpios = <&gpio11 14 GPIO_ACTIVE_HIGH>;
-		int-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
-	};
-};
-
-&enet1g_ptp_clock {
-	status = "disabled";
-	pinctrl-0 = <&pinmux_enet1g_ptp>;
-	pinctrl-names = "default";
-};
-
 &csi {
 	pinctrl-0 = <&pinmux_csi>;
 	pinctrl-names = "default";
@@ -200,6 +195,11 @@
 	pinctrl-names = "default";
 };
 
+/*&lpadc1 {
+        pinctrl-0 = <&pinmux_lpadc1>;
+        pinctrl-names = "default";
+};*/
+
 &flexspi {
 	pinctrl-0 = <&pinmux_flexspi1>;
 	pinctrl-names = "default";
@@ -219,7 +219,7 @@
 	reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(16)>;
 	is25wp128: is25wp128@0 {
 		compatible = "nxp,imx-flexspi-nor";
-		size = <DT_SIZE_M(16*8)>;
+		size = <134217728>;
 		reg = <0>;
 		spi-max-frequency = <133000000>;
 		status = "okay";
@@ -236,20 +236,20 @@
 				label = "mcuboot";
 				reg = <0x00000000 DT_SIZE_K(128)>;
 			};
-			/* The MCUBoot swap-move algorithm uses the last 3 sectors
-			 * of the primary slot0 for swap status and move.
+			/* Note slot 0 has one additional sector,
+			 * this is intended for use with the swap move algorithm
 			 */
 			slot0_partition: partition@20000 {
 				label = "image-0";
-				reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>;
+				reg = <0x00020000 0x301000>;
 			};
-			slot1_partition: partition@723000 {
+			slot1_partition: partition@321000 {
 				label = "image-1";
-				reg = <0x00723000 DT_SIZE_M(7)>;
+				reg = <0x00321000 0x300000>;
 			};
-			storage_partition: partition@E23000 {
+			storage_partition: partition@621000 {
 				label = "storage";
-				reg = <0x00E23000 (DT_SIZE_M(2) - DT_SIZE_K(140))>;
+				reg = <0x00621000 DT_SIZE_K(1984)>;
 			};
 		};
 	};
diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm4.yaml b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm4.yaml
deleted file mode 100644
index 87788b3a015..00000000000
--- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm4.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Copyright (c) 2021, NXP
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-
-identifier: mimxrt1170_evk/mimxrt1176/cm4
-name: NXP MIMXRT1170-EVK CM4
-type: mcu
-arch: arm
-toolchain:
-  - zephyr
-  - gnuarmemb
-  - xtools
-ram: 128
-flash: 128
-supported:
-  - dma
-  - gpio
-  - i2c
-  - pwm
-vendor: nxp
diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm4_B.overlay b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm4_B.overlay
deleted file mode 100644
index b65621ee632..00000000000
--- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm4_B.overlay
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2023 NXP
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-/ {
-	chosen {
-		/delete-property/ zephyr,flash-controller;
-		/delete-property/ zephyr,code-partition;
-	};
-
-	aliases {
-		/delete-property/ magn0;
-		/delete-property/ accel0;
-	};
-};
-
-&flexspi {
-	/* RT1170 EVKB uses a different QSPI flash chip */
-	/delete-node/ is25wp128@0;
-	status = "okay";
-	reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(64)>;
-	w25q512nw:w25q512nw@0 {
-		compatible = "nxp,imx-flexspi-nor";
-		size = <DT_SIZE_M(64*8)>;
-		reg = <0>;
-		spi-max-frequency = <133000000>;
-		status = "okay";
-		jedec-id = [ef 60 20];
-		erase-block-size = <4096>;
-		write-block-size = <1>;
-
-		partitions {
-			compatible = "fixed-partitions";
-			#address-cells = <1>;
-			#size-cells = <1>;
-
-			boot_partition: partition@0 {
-				label = "mcuboot";
-				reg = <0x00000000 DT_SIZE_K(128)>;
-			};
-			/* The MCUBoot swap-move algorithm uses the last 3 sectors
-			 * of the primary slot0 for swap status and move.
-			 */
-			slot0_partition: partition@20000 {
-				label = "image-0";
-				reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>;
-			};
-			slot1_partition: partition@723000 {
-				label = "image-1";
-				reg = <0x00723000 DT_SIZE_M(7)>;
-			};
-			storage_partition: partition@E23000 {
-				label = "storage";
-				reg = <0x00E23000 (DT_SIZE_M(50) - DT_SIZE_K(140))>;
-			};
-		};
-	};
-};
-
-&lpspi1 {
-	dmas = <&edma_lpsr0 0 36>, <&edma_lpsr0 1 37>;
-	dma-names = "rx", "tx";
-	status = "okay";
-};
-
-&lpi2c5 {
-	/* FXOS accelerometer is not present in this board */
-	/delete-node/ fxos8700@1f;
-};
-
-/* Disable ethernet, as PHY is not supported */
-&enet {
-	status = "disabled";
-};
diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm4_B.yaml b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm4_B.yaml
deleted file mode 100644
index da1f36a162c..00000000000
--- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm4_B.yaml
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright 2023 NXP
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-
-identifier: mimxrt1170_evk@B/mimxrt1176/cm4
-name: NXP MIMXRT1170-EVKB CM4
-type: mcu
-arch: arm
-toolchain:
-  - zephyr
-  - gnuarmemb
-  - xtools
-ram: 128
-flash: 128
-supported:
-  - dma
-  - gpio
-  - i2c
-  - spi
-  - pwm
-vendor: nxp
diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.dts b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.dts
index 95eff6eb715..86258d2dcb5 100644
--- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.dts
+++ b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.dts
@@ -8,6 +8,7 @@
 
 #include <nxp/nxp_rt11xx_cm7.dtsi>
 #include "mimxrt1170_evk.dtsi"
+#include <zephyr/dt-bindings/display/panel.h>
 
 / {
 	model = "NXP MIMXRT1170-EVK board";
@@ -28,6 +29,7 @@
 		zephyr,flash-controller = &is25wp128;
 		zephyr,flash = &is25wp128;
 		zephyr,code-partition = &slot0_partition;
+		zephyr,display = &lcdif;
 		zephyr,cpu1-region = &ocram;
 		zephyr,ipc = &mailbox_a;
 	};
@@ -61,7 +63,29 @@
 	};
 };
 
-zephyr_lcdif: &lcdif {};
+zephyr_lcdif: &lcdif {
+	status = "okay";
+	backlight-gpios = <&gpio9 29 GPIO_ACTIVE_HIGH>;
+	pixel-format = <PANEL_PIXEL_FORMAT_BGR_565>;
+	width = <720>;
+	height = <1280>;
+	data-bus-width = "24-bit";
+
+	display-timings {
+		compatible = "zephyr,panel-timing";
+		hsync-len = <8>;
+		hfront-porch = <32>;
+		hback-porch = <32>;
+		vsync-len = <2>;
+		vfront-porch = <16>;
+		vback-porch = <14>;
+		hsync-active = <0>;
+		vsync-active = <0>;
+		de-active = <1>;
+		pixelclk-active = <0>;
+		clock-frequency = <62346240>;
+	};
+};
 
 zephyr_mipi_dsi: &mipi_dsi {
 	dphy-ref-frequency = <24000000>;
@@ -96,6 +120,10 @@ nxp_mipi_i2c: &lpi2c5 {
 	status = "okay";
 };
 
+/*&lpadc1 {
+        status = "okay";
+};*/
+
 &usdhc1 {
 	status = "okay";
 	detect-dat3;
diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.yaml b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.yaml
deleted file mode 100644
index c7e846adf6a..00000000000
--- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Copyright (c) 2021, NXP
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-
-identifier: mimxrt1170_evk/mimxrt1176/cm7
-name: NXP MIMXRT1170-EVK CM7
-type: mcu
-arch: arm
-toolchain:
-  - zephyr
-  - gnuarmemb
-  - xtools
-ram: 256
-flash: 16384
-supported:
-  - adc
-  - counter
-  - can
-  - dma
-  - gpio
-  - hwinfo
-  - i2c
-  - mipi_dsi
-  - netif:eth
-  - pwm
-  - spi
-  - usb_device
-  - watchdog
-vendor: nxp
diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7_B.overlay b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7_B.overlay
deleted file mode 100644
index f88f99fba5c..00000000000
--- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7_B.overlay
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2023 NXP
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-/ {
-	chosen {
-		zephyr,flash = &w25q512nw;
-		zephyr,flash-controller = &w25q512nw;
-		zephyr,flash = &w25q512nw;
-		zephyr,code-partition = &slot0_partition;
-	};
-
-	aliases {
-		/delete-property/ magn0;
-		/delete-property/ accel0;
-	};
-};
-
-&flexspi {
-	/* RT1170 EVKB uses a different QSPI flash chip */
-	/delete-node/ is25wp128@0;
-	status = "okay";
-	reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(64)>;
-	w25q512nw:w25q512nw@0 {
-		compatible = "nxp,imx-flexspi-nor";
-		size = <DT_SIZE_M(64*8)>;
-		reg = <0>;
-		spi-max-frequency = <133000000>;
-		status = "okay";
-		jedec-id = [ef 60 20];
-		erase-block-size = <4096>;
-		write-block-size = <1>;
-
-		partitions {
-			compatible = "fixed-partitions";
-			#address-cells = <1>;
-			#size-cells = <1>;
-
-			boot_partition: partition@0 {
-				label = "mcuboot";
-				reg = <0x00000000 DT_SIZE_K(128)>;
-			};
-			/* The MCUBoot swap-move algorithm uses the last 3 sectors
-			 * of the primary slot0 for swap status and move.
-			 */
-			slot0_partition: partition@20000 {
-				label = "image-0";
-				reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>;
-			};
-			slot1_partition: partition@723000 {
-				label = "image-1";
-				reg = <0x00723000 DT_SIZE_M(7)>;
-			};
-			storage_partition: partition@E23000 {
-				label = "storage";
-				reg = <0x00E23000 (DT_SIZE_M(50) - DT_SIZE_K(140))>;
-			};
-		};
-	};
-};
-
-&lpi2c5 {
-	/* FXOS accelerometer is not present in this board */
-	/delete-node/ fxos8700@1f;
-};
-
-&enet_mdio {
-	/delete-node/ phy@0;
-
-	phy: phy@0 {
-		compatible = "ethernet-phy";
-		reg = <0>;
-		status = "okay";
-	};
-};
diff --git a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7_B.yaml b/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7_B.yaml
deleted file mode 100644
index 5cdfdf97c87..00000000000
--- a/boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7_B.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Copyright 2023 NXP
-#
-# SPDX-License-Identifier: Apache-2.0
-#
-
-identifier: mimxrt1170_evk@B/mimxrt1176/cm7
-name: NXP MIMXRT1170-EVKB CM7
-type: mcu
-arch: arm
-toolchain:
-  - zephyr
-  - gnuarmemb
-  - xtools
-ram: 65536
-flash: 65536
-supported:
-  - adc
-  - counter
-  - can
-  - dma
-  - gpio
-  - hwinfo
-  - i2c
-  - mipi_dsi
-  - spi
-  - usb_device
-  - watchdog
-vendor: nxp
diff --git a/samples/drivers/adc/adc_dt/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay b/samples/drivers/adc/adc_dt/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay
index b07fe80528b..d8fe5a337d5 100644
--- a/samples/drivers/adc/adc_dt/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay
+++ b/samples/drivers/adc/adc_dt/boards/mimxrt1170_evk_mimxrt1176_cm7_A.overlay
@@ -10,7 +10,7 @@
 / {
 	zephyr,user {
 		/* adjust channel number according to pinmux in board.dts */
-		io-channels = <&lpadc0 0>;
+		io-channels = <&lpadc0 0>, <&lpadc0 1>;
 	};
 };
 
@@ -27,9 +27,20 @@
 		reg = <0>;
 		zephyr,gain = "ADC_GAIN_1";
 		zephyr,reference = "ADC_REF_EXTERNAL0";
-		zephyr,vref-mv = <1800>;
+		zephyr,vref-mv = <5000>;
 		zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_TICKS, 7)>;
 		zephyr,resolution = <12>;
-		zephyr,input-positive = <MCUX_LPADC_CH0A>;
+		zephyr,input-positive = <MCUX_LPADC_CH3B>;
 	};
+
+        channel@1 {
+                reg = <1>;
+                zephyr,gain = "ADC_GAIN_1";
+                zephyr,reference = "ADC_REF_EXTERNAL0";
+                zephyr,vref-mv = <5000>;
+                zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_TICKS, 7)>;
+                zephyr,resolution = <12>;
+                zephyr,input-positive = <MCUX_LPADC_CH0A>;
+        };
+
 };
diff --git a/samples/drivers/adc/adc_dt/boards/mimxrt1170_evk_mimxrt1176_cm7_B.overlay b/samples/drivers/adc/adc_dt/boards/mimxrt1170_evk_mimxrt1176_cm7_B.overlay
index 598639cc0e6..8dfcaa24c3f 100644
--- a/samples/drivers/adc/adc_dt/boards/mimxrt1170_evk_mimxrt1176_cm7_B.overlay
+++ b/samples/drivers/adc/adc_dt/boards/mimxrt1170_evk_mimxrt1176_cm7_B.overlay
@@ -9,7 +9,7 @@
 / {
 	zephyr,user {
 		/* adjust channel number according to pinmux in board.dts */
-		io-channels = <&lpadc0 0>;
+		io-channels = <&lpadc0 0>, <&lpadc0 1>;
 	};
 };
 
@@ -26,7 +26,7 @@
 		reg = <0>;
 		zephyr,gain = "ADC_GAIN_1";
 		zephyr,reference = "ADC_REF_EXTERNAL0";
-		zephyr,vref-mv = <1800>;
+		zephyr,vref-mv = <5000>;
 		zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_TICKS, 7)>;
 		zephyr,resolution = <12>;
 		zephyr,input-positive = <MCUX_LPADC_CH0A>;
diff --git a/samples/subsys/display/lvgl/CMakeLists.txt b/samples/subsys/display/lvgl/CMakeLists.txt
index f2f9a2689f1..d7f614ebf52 100644
--- a/samples/subsys/display/lvgl/CMakeLists.txt
+++ b/samples/subsys/display/lvgl/CMakeLists.txt
@@ -1,9 +1,11 @@
-# SPDX-License-Identifier: Apache-2.0
-
-cmake_minimum_required(VERSION 3.20.0)
-
-find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
-project(lvgl)
-
-FILE(GLOB app_sources src/*.c)
-target_sources(app PRIVATE ${app_sources})
+# SPDX-License-Identifier: Apache-2.0
+
+cmake_minimum_required(VERSION 3.20.0)
+
+find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
+project(gui_guider)
+
+FILE(GLOB_RECURSE app_sources src/main.c src/generated/*.c src/custom/*.c)
+target_include_directories(app PRIVATE src/generated src/custom src/generated/guider_customer_fonts src/generated/guider_fonts src/generated/images)
+target_sources(app PRIVATE ${app_sources})
+target_compile_definitions(app PRIVATE LV_LVGL_H_INCLUDE_SIMPLE)
diff --git a/samples/subsys/display/lvgl/prj.conf b/samples/subsys/display/lvgl/prj.conf
index 41c0eca6e70..d4fe5a60851 100644
--- a/samples/subsys/display/lvgl/prj.conf
+++ b/samples/subsys/display/lvgl/prj.conf
@@ -1,19 +1,18 @@
-CONFIG_LV_Z_MEM_POOL_SIZE=16384
-CONFIG_LV_Z_SHELL=y
-CONFIG_MAIN_STACK_SIZE=2048
-
-CONFIG_DISPLAY=y
-CONFIG_DISPLAY_LOG_LEVEL_ERR=y
-
-CONFIG_LOG=y
-CONFIG_SHELL=y
-
-CONFIG_LVGL=y
-CONFIG_LV_MEM_CUSTOM=y
-CONFIG_LV_USE_LOG=y
-CONFIG_LV_USE_LABEL=y
-CONFIG_LV_USE_BTN=y
-CONFIG_LV_USE_ARC=y
-CONFIG_LV_USE_IMG=y
-CONFIG_LV_USE_MONKEY=y
-CONFIG_LV_FONT_MONTSERRAT_14=y
+CONFIG_LV_Z_MEM_POOL_SIZE=16384
+CONFIG_MAIN_STACK_SIZE=2048
+
+CONFIG_DISPLAY=y
+CONFIG_DISPLAY_LOG_LEVEL_ERR=y
+
+CONFIG_LOG=y
+
+CONFIG_LVGL=y
+CONFIG_LV_MEM_CUSTOM=y
+CONFIG_LV_USE_LOG=y
+CONFIG_LV_USE_LABEL=y
+CONFIG_LV_USE_BTN=y
+CONFIG_LV_USE_IMG=y
+CONFIG_LV_FONT_MONTSERRAT_14=y
+
+CONFIG_ADC=y
+
diff --git a/samples/subsys/display/lvgl/src/main.c b/samples/subsys/display/lvgl/src/main.c
index 2fca16023ad..21d1cafe034 100644
--- a/samples/subsys/display/lvgl/src/main.c
+++ b/samples/subsys/display/lvgl/src/main.c
@@ -1,156 +1,270 @@
-/*
- * Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
+#include <inttypes.h>
+#include <stddef.h>
+#include <stdint.h>
 #include <zephyr/device.h>
 #include <zephyr/devicetree.h>
+#include <zephyr/drivers/adc.h>
 #include <zephyr/drivers/display.h>
+#include <zephyr/kernel.h>
+#include <zephyr/sys/printk.h>
+#include <zephyr/sys/util.h>
+#include <zephyr/logging/log.h>
 #include <zephyr/drivers/gpio.h>
 #include <lvgl.h>
 #include <stdio.h>
 #include <string.h>
-#include <zephyr/kernel.h>
-#include <lvgl_input_device.h>
 
-#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
-#include <zephyr/logging/log.h>
+#include "../generated/gui_guider.h"
+#include "../generated/events_init.h"
+
 LOG_MODULE_REGISTER(app);
 
-static uint32_t count;
+lv_ui guider_ui;
 
-#ifdef CONFIG_GPIO
-static struct gpio_dt_spec button_gpio = GPIO_DT_SPEC_GET_OR(
-		DT_ALIAS(sw0), gpios, {0});
-static struct gpio_callback button_callback;
+#define ADC_THRESHOLD_MV 2000
 
-static void button_isr_callback(const struct device *port,
-				struct gpio_callback *cb,
-				uint32_t pins)
-{
-	ARG_UNUSED(port);
-	ARG_UNUSED(cb);
-	ARG_UNUSED(pins);
+// ADC channel setup
+static const struct adc_dt_spec adc_chan1 =
+    ADC_DT_SPEC_GET_BY_IDX(DT_PATH(zephyr_user), 0);
 
-	count = 0;
-}
-#endif /* CONFIG_GPIO */
+// Button configuration from devicetree aliases
+#define SW0_NODE    DT_ALIAS(sw0)
+#if !DT_NODE_HAS_STATUS(SW0_NODE, okay)
+#error "Unsupported board: sw0 devicetree alias is not defined"
+#endif
+#define SW00_NODE    DT_ALIAS(sw00)
+#if !DT_NODE_HAS_STATUS(SW00_NODE, okay)
+#error "Unsupported board: sw00 devicetree alias is not defined"
+#endif
+#define SW01_NODE    DT_ALIAS(sw01)
+#if !DT_NODE_HAS_STATUS(SW01_NODE, okay)
+#error "Unsupported board: sw01 devicetree alias is not defined"
+#endif
 
-#ifdef CONFIG_LV_Z_ENCODER_INPUT
-static const struct device *lvgl_encoder =
-	DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_lvgl_encoder_input));
-#endif /* CONFIG_LV_Z_ENCODER_INPUT */
+// Button and LED setup
+static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET_OR(SW0_NODE, gpios, {0});
+static const struct gpio_dt_spec button_00 = GPIO_DT_SPEC_GET_OR(SW00_NODE, gpios, {0});
+static const struct gpio_dt_spec button_01 = GPIO_DT_SPEC_GET_OR(SW01_NODE, gpios, {0});
+static struct gpio_callback button_cb_data;
+static struct gpio_callback button_00_cb_data;
+static struct gpio_callback button_01_cb_data;
 
-#ifdef CONFIG_LV_Z_KEYPAD_INPUT
-static const struct device *lvgl_keypad =
-	DEVICE_DT_GET(DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_lvgl_keypad_input));
-#endif /* CONFIG_LV_Z_KEYPAD_INPUT */
+// Button press callback functions
+void button_pressed(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
+{
+    printk("Button pressed at %" PRIu32 "\n", k_cycle_get_32());
+}
 
-static void lv_btn_click_callback(lv_event_t *e)
+void button_00_pressed(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
 {
-	ARG_UNUSED(e);
+    printk("Button_00 pressed at %" PRIu32 "\n", k_cycle_get_32());
+}
 
-	count = 0;
+void button_01_pressed(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
+{
+    printk("Button_01 pressed at %" PRIu32 "\n", k_cycle_get_32());
 }
 
 int main(void)
 {
-	char count_str[11] = {0};
-	const struct device *display_dev;
-	lv_obj_t *hello_world_label;
-	lv_obj_t *count_label;
-
-	display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
-	if (!device_is_ready(display_dev)) {
-		LOG_ERR("Device not ready, aborting test");
-		return 0;
-	}
+    // Display device setup
+    const struct device *display_dev;
+    int ret;
 
-#ifdef CONFIG_GPIO
-	if (gpio_is_ready_dt(&button_gpio)) {
-		int err;
-
-		err = gpio_pin_configure_dt(&button_gpio, GPIO_INPUT);
-		if (err) {
-			LOG_ERR("failed to configure button gpio: %d", err);
-			return 0;
-		}
-
-		gpio_init_callback(&button_callback, button_isr_callback,
-				   BIT(button_gpio.pin));
-
-		err = gpio_add_callback(button_gpio.port, &button_callback);
-		if (err) {
-			LOG_ERR("failed to add button callback: %d", err);
-			return 0;
-		}
-
-		err = gpio_pin_interrupt_configure_dt(&button_gpio,
-						      GPIO_INT_EDGE_TO_ACTIVE);
-		if (err) {
-			LOG_ERR("failed to enable button callback: %d", err);
-			return 0;
-		}
-	}
-#endif /* CONFIG_GPIO */
-
-#ifdef CONFIG_LV_Z_ENCODER_INPUT
-	lv_obj_t *arc;
-	lv_group_t *arc_group;
-
-	arc = lv_arc_create(lv_scr_act());
-	lv_obj_align(arc, LV_ALIGN_CENTER, 0, -15);
-	lv_obj_set_size(arc, 150, 150);
-
-	arc_group = lv_group_create();
-	lv_group_add_obj(arc_group, arc);
-	lv_indev_set_group(lvgl_input_get_indev(lvgl_encoder), arc_group);
-#endif /* CONFIG_LV_Z_ENCODER_INPUT */
-
-#ifdef CONFIG_LV_Z_KEYPAD_INPUT
-	lv_obj_t *btn_matrix;
-	lv_group_t *btn_matrix_group;
-	static const char *const btnm_map[] = {"1", "2", "3", "4", ""};
-
-	btn_matrix = lv_btnmatrix_create(lv_scr_act());
-	lv_obj_align(btn_matrix, LV_ALIGN_CENTER, 0, 70);
-	lv_btnmatrix_set_map(btn_matrix, (const char **)btnm_map);
-	lv_obj_set_size(btn_matrix, 100, 50);
-
-	btn_matrix_group = lv_group_create();
-	lv_group_add_obj(btn_matrix_group, btn_matrix);
-	lv_indev_set_group(lvgl_input_get_indev(lvgl_keypad), btn_matrix_group);
-#endif /* CONFIG_LV_Z_KEYPAD_INPUT */
-
-	if (IS_ENABLED(CONFIG_LV_Z_POINTER_KSCAN) || IS_ENABLED(CONFIG_LV_Z_POINTER_INPUT)) {
-		lv_obj_t *hello_world_button;
-
-		hello_world_button = lv_btn_create(lv_scr_act());
-		lv_obj_align(hello_world_button, LV_ALIGN_CENTER, 0, -15);
-		lv_obj_add_event_cb(hello_world_button, lv_btn_click_callback, LV_EVENT_CLICKED,
-				    NULL);
-		hello_world_label = lv_label_create(hello_world_button);
-	} else {
-		hello_world_label = lv_label_create(lv_scr_act());
-	}
+    display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
+    if (!device_is_ready(display_dev)) {
+        LOG_ERR("Device not ready, aborting test");
+        return 0;
+    }
+
+    // Initialize UI
+    setup_ui(&guider_ui);
+    events_init(&guider_ui);
+
+    lv_task_handler();
+    display_blanking_off(display_dev);
+
+    // Initialize buttons
+    if (!gpio_is_ready_dt(&button)) {
+        printk("Error: button device %s is not ready\n", button.port->name);
+        return 0;
+    }
+
+    if (!gpio_is_ready_dt(&button_00)) {
+        printk("Error: button_00 device %s is not ready\n", button_00.port->name);
+        return 0;
+    }
+
+    if (!gpio_is_ready_dt(&button_01)) {
+        printk("Error: button_01 device %s is not ready\n", button_01.port->name);
+        return 0;
+    }
+
+    // Configure buttons as input and set up interrupts
+    ret = gpio_pin_configure_dt(&button, GPIO_INPUT);
+    if (ret != 0) {
+        printk("Error %d: failed to configure %s pin %d\n", ret, button.port->name, button.pin);
+        return 0;
+    }
 
-	lv_label_set_text(hello_world_label, "Hello world!");
-	lv_obj_align(hello_world_label, LV_ALIGN_CENTER, 0, 0);
+    ret = gpio_pin_interrupt_configure_dt(&button, GPIO_INT_EDGE_TO_ACTIVE);
+    if (ret != 0) {
+        printk("Error %d: failed to configure interrupt on %s pin %d\n", ret, button.port->name, button.pin);
+        return 0;
+    }
 
-	count_label = lv_label_create(lv_scr_act());
-	lv_obj_align(count_label, LV_ALIGN_BOTTOM_MID, 0, 0);
+    ret = gpio_pin_configure_dt(&button_00, GPIO_INPUT);
+    if (ret != 0) {
+        printk("Error %d: failed to configure %s pin %d\n", ret, button_00.port->name, button_00.pin);
+        return 0;
+    }
 
+    ret = gpio_pin_interrupt_configure_dt(&button_00, GPIO_INT_EDGE_TO_ACTIVE);
+    if (ret != 0) {
+        printk("Error %d: failed to configure interrupt on %s pin %d\n", ret, button_00.port->name, button_00.pin);
+        return 0;
+    }
+
+    ret = gpio_pin_configure_dt(&button_01, GPIO_INPUT);
+    if (ret != 0) {
+        printk("Error %d: failed to configure %s pin %d\n", ret, button_01.port->name, button_01.pin);
...

This file has been truncated, please download it to see its full contents.

phycore_rt1170.tar.gz

C/C++
This file needs to be extracted to the Zephyr directory, zephyr/boards/phytec , to enable the RT1170 carrier board.
No preview (download only).

Credits

Madelyn T
7 projects β€’ 8 followers

Comments