File tree Expand file tree Collapse file tree 11 files changed +178
-0
lines changed
samples/boards/espressif/ulp/lp_core/interrupt_ulp Expand file tree Collapse file tree 11 files changed +178
-0
lines changed 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
+ cmake_minimum_required (VERSION 3.20.0 )
5
+
6
+ set (REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR} /../interrupt_ulp_lpcore/zephyr )
7
+
8
+ find_package (Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} )
9
+
10
+ message (STATUS "${CONFIG_BOARD_TARGET} compile as Master in this sample" )
11
+ project (interrupt_ulp_hpcore )
12
+
13
+ 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 :: interrupt-ulp
2
+ :name: Interrupt ULP
3
+
4
+ HP Core interrupt LP Core.
5
+
6
+ Overview
7
+ ********
8
+
9
+ This sample shows how to trigger LP Core interrupt from the HP core.
10
+
11
+ Building and Flashing
12
+ *********************
13
+
14
+ Build the sample code as follows:
15
+
16
+ .. zephyr-app-commands ::
17
+ :zephyr-app: samples/boards/espressif/ulp/lp_core/interrupt_ulp
18
+ :board: esp32c6_devkitc/esp32c6/hpcore
19
+ :west-args: --sysbuild
20
+ :goals: build
21
+ :compact:
22
+
23
+ Flash it to the device with the command:
24
+
25
+ .. zephyr-app-commands ::
26
+ :zephyr-app: samples/boards/espressif/ulp/lp_core/interrupt_ulp
27
+ :board: esp32c6_devkitc/esp32c6/hpcore
28
+ :west-args: --sysbuild
29
+ :goals: flash
30
+ :compact:
31
+
32
+ Sample Output
33
+ =============
34
+
35
+ Console output on the HP core:
36
+
37
+ .. code-block :: console
38
+
39
+ Triggering ULP interrupt...
40
+ Triggering ULP interrupt...
41
+ Triggering ULP interrupt...
42
+ Triggering ULP interrupt...
43
+ Triggering ULP interrupt...
44
+
45
+ Console output on the LP core:
46
+
47
+ .. code-block :: console
48
+
49
+ LP PMU interrupt received: 0
50
+ LP PMU interrupt received: 1
51
+ LP PMU interrupt received: 2
52
+ LP PMU interrupt received: 3
53
+ LP PMU interrupt received: 4
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
+ # Copyright (c) 2025 Espressif Systems (Shanghai) Co., Ltd.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ cmake_minimum_required (VERSION 3.20.0 )
5
+
6
+ find_package (Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} )
7
+
8
+ message (STATUS "${BOARD} compiles as remote in this sample" )
9
+ project (interrupt_ulp_lpcore )
10
+
11
+ target_sources (app PRIVATE src/main.c )
Original file line number Diff line number Diff line change
1
+ # nothing here
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 "ulp_lp_core_utils.h"
9
+ #include "ulp_lp_core_interrupts.h"
10
+
11
+ volatile uint32_t lp_core_pmu_intr_count ;
12
+
13
+ void ulp_lp_core_lp_pmu_intr_handler (void )
14
+ {
15
+ ulp_lp_core_sw_intr_clear ();
16
+ lp_core_pmu_intr_count ++ ;
17
+ printf ("LP PMU interrupt received: %d\n" , lp_core_pmu_intr_count );
18
+ }
19
+
20
+ int main (void )
21
+ {
22
+ lp_core_pmu_intr_count = 0 ;
23
+ ulp_lp_core_intr_enable ();
24
+ ulp_lp_core_sw_intr_enable (true);
25
+
26
+ while (1 ) {
27
+ /* Wait forever, handling interrupts */
28
+ asm volatile ("wfi" );
29
+ }
30
+ return 0 ;
31
+ }
Original file line number Diff line number Diff line change
1
+ sample :
2
+ name : ESP32-C6 LP_CORE Interrupt Sample
3
+ tests :
4
+ sample.boards.espressif.ulp.lp_core.interrupt_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 <ulp_lp_core.h>
9
+ #include <zephyr/kernel.h>
10
+
11
+ int main (void )
12
+ {
13
+ while (1 ) {
14
+ printf ("Triggering ULP interrupt...\n" );
15
+ ulp_lp_core_sw_intr_trigger ();
16
+ k_sleep (K_MSEC (1000 ));
17
+ }
18
+
19
+ return 0 ;
20
+ }
You can’t perform that action at this time.
0 commit comments