File tree Expand file tree Collapse file tree 11 files changed +166
-0
lines changed
samples/boards/espressif/ulp/lp_core/echo_ulp Expand file tree Collapse file tree 11 files changed +166
-0
lines changed Original file line number Diff line number Diff line change
1
+ # SPDX-License-Identifier: Apache-2.0
2
+
3
+ cmake_minimum_required (VERSION 3.20.0 )
4
+
5
+ set (REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR} /../echo_ulp_lpcore/zephyr )
6
+
7
+ find_package (Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} )
8
+
9
+ message (STATUS "${CONFIG_BOARD_TARGET} compile as Master in this sample" )
10
+ project (echo_ulp_hpcore )
11
+
12
+ target_sources (app PRIVATE src/main.c )
Original file line number Diff line number Diff line change
1
+ # Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ source "share/sysbuild/Kconfig"
5
+
6
+ config ULP_REMOTE_BOARD
7
+ string
8
+ default "esp32c6_devkitc/esp32c6/lpcore" if $(BOARD) = "esp32c6_devkitc"
Original file line number Diff line number Diff line change
1
+ .. zephyr :code-sample :: echo-ulp
2
+ :name: Echo ULP
3
+
4
+ Leverage Zephyr's UART API to use the LP UART on the ESP32-C6's LP core.
5
+
6
+ Overview
7
+ ********
8
+
9
+ This sample application demonstrates how to use poll-based APIs from the Zephyr
10
+ UART driver subsystem. It reads characters from the LP UART using
11
+ :c:func: `uart_poll_in ` and echoes them back using :c:func: `uart_poll_out `.
12
+
13
+ Building and Flashing
14
+ *********************
15
+
16
+ Build the sample code as follows:
17
+
18
+ .. zephyr-app-commands ::
19
+ :zephyr-app: samples/boards/espressif/ulp/lp_core/echo_ulp
20
+ :board: esp32c6_devkitc/esp32c6/hpcore
21
+ :west-args: --sysbuild
22
+ :goals: build
23
+ :compact:
24
+
25
+ Flash it to the device with the command:
26
+
27
+ .. zephyr-app-commands ::
28
+ :zephyr-app: samples/boards/espressif/ulp/lp_core/echo_ulp
29
+ :board: esp32c6_devkitc/esp32c6/hpcore
30
+ :west-args: --sysbuild
31
+ :goals: flash
32
+ :compact:
33
+
34
+ Sample Output
35
+ =============
36
+
37
+ .. code-block :: console
38
+
39
+ UART echo example started. Type something...
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ &lp_uart {
8
+ status = "okay";
9
+ };
Original file line number Diff line number Diff line change
1
+ CONFIG_ULP_COPROC_ENABLED=y
Original file line number Diff line number Diff line change
1
+ # SPDX-License-Identifier: Apache-2.0
2
+
3
+ cmake_minimum_required (VERSION 3.20.0 )
4
+
5
+ find_package (Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} )
6
+
7
+ message (STATUS "${BOARD} compiles as remote in this sample" )
8
+ project (echo_ulp_lpcore )
9
+
10
+ target_sources (app PRIVATE src/main.c )
Original file line number Diff line number Diff line change
1
+ CONFIG_MAIN_STACK_SIZE=1024
2
+ CONFIG_ISR_STACK_SIZE=64
3
+ CONFIG_IDLE_STACK_SIZE=32
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ #include <stdio.h>
8
+ #include <zephyr/device.h>
9
+ #include <zephyr/drivers/uart.h>
10
+
11
+ #define UART_DEVICE_NODE DT_NODELABEL(lp_uart)
12
+
13
+ int main (void )
14
+ {
15
+ const struct device * uart_dev = DEVICE_DT_GET (UART_DEVICE_NODE );
16
+ char c ;
17
+ int ret = 0 ;
18
+
19
+ printf ("UART echo example started. Type something...\n" );
20
+
21
+ while (1 ) {
22
+ ret = uart_poll_in (uart_dev , & c );
23
+ if (ret == 0 ) {
24
+ /* Echo character back out */
25
+ uart_poll_out (uart_dev , c );
26
+ if (c == '\r' ) {
27
+ uart_poll_out (uart_dev , '\n' );
28
+ }
29
+ }
30
+ }
31
+
32
+ return 0 ;
33
+ }
Original file line number Diff line number Diff line change
1
+ sample :
2
+ name : ESP32-C6 LP_CORE Echo Sample
3
+ tests :
4
+ sample.boards.espressif.ulp.lp_core.echo_ulp :
5
+ platform_allow :
6
+ - esp32c6_devkitc/esp32c6/hpcore
7
+ tags :
8
+ - samples
9
+ sysbuild : true
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ #include <stdio.h>
8
+ #include <zephyr/sys/poweroff.h>
9
+ #include <esp_sleep.h>
10
+ #include <ulp_lp_core.h>
11
+ #include <zephyr/kernel.h>
12
+
13
+ int main (void )
14
+ {
15
+ while (1 ) {
16
+ k_sleep (K_MSEC (1000 ));
17
+ }
18
+
19
+ return 0 ;
20
+ }
You can’t perform that action at this time.
0 commit comments