You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have found alarm sample under counters folder but I think it is not really interrupt. It is a callback from OS after interrupt occured.
I wanted to implement real interrupt, there is not really a lot of examples. I have read technical reference manual of esp32c6-devkit-1 to teeth. Timer itself is working. If someone knows why mine is not working, it will be appreciated, thanks in advance.
Can we implement this using zephyr framework fully?
(.venv) aslan@thinkpad:~/zephyrproject/zephyr$ west build --sysbuild -p -b esp32c6_devkitc samples/drivers/counter/alarm && west flash && west espressif monitor
-- west build: making build dir /home/aslan/zephyrproject/zephyr/build pristine
-- west build: generating a build system
Loading Zephyr module(s) (Zephyr base): sysbuild_default
-- Found Python3: /home/aslan/zephyrproject/.venv/bin/python3 (found suitable version "3.10.12", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /home/aslan/.cache/zephyr
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: esp32c6_devkitc, qualifiers: esp32c6
Parsing /home/aslan/zephyrproject/zephyr/share/sysbuild/Kconfig
Loaded configuration '/home/aslan/zephyrproject/zephyr/build/_sysbuild/empty.conf'
Merged configuration '/home/aslan/zephyrproject/zephyr/build/_sysbuild/empty.conf'
Configuration saved to '/home/aslan/zephyrproject/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/aslan/zephyrproject/zephyr/build/_sysbuild/autoconf.h'
--
*****************************
* Running CMake for mcuboot *
*****************************
Loading Zephyr default modules (Zephyr base).
-- Application: /home/aslan/zephyrproject/bootloader/mcuboot/boot/zephyr
-- CMake version: 3.22.1
-- Found Python3: /home/aslan/zephyrproject/.venv/bin/python (found suitable version "3.10.12", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /home/aslan/.cache/zephyr
-- Zephyr version: 4.0.99 (/home/aslan/zephyrproject/zephyr)
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: esp32c6_devkitc, qualifiers: esp32c6
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.17.0 (/home/aslan/zephyr-sdk-0.17.0)
-- Found toolchain: zephyr 0.17.0 (/home/aslan/zephyr-sdk-0.17.0)
-- Found Dtc: /home/aslan/zephyr-sdk-0.17.0/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/aslan/zephyrproject/zephyr/boards/espressif/esp32c6_devkitc/esp32c6_devkitc.dts
-- Found devicetree overlay: /home/aslan/zephyrproject/bootloader/mcuboot/boot/zephyr/app.overlay
-- Generated zephyr.dts: /home/aslan/zephyrproject/zephyr/build/mcuboot/zephyr/zephyr.dts
-- Generated pickled edt: /home/aslan/zephyrproject/zephyr/build/mcuboot/zephyr/edt.pickle
-- Generated devicetree_generated.h: /home/aslan/zephyrproject/zephyr/build/mcuboot/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: /home/aslan/zephyrproject/zephyr/build/mcuboot/zephyr/dts.cmake
warning: BOOT_MAX_IMG_SECTORS (defined at
/home/aslan/zephyrproject/bootloader/mcuboot/boot/zephyr/Kconfig:463) was assigned the value '512'
but got the value ''. Check these unsatisfied dependencies: (!BOOT_MAX_IMG_SECTORS_AUTO) (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_BOOT_MAX_IMG_SECTORS and/or look up
BOOT_MAX_IMG_SECTORS in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.
Parsing /home/aslan/zephyrproject/bootloader/mcuboot/boot/zephyr/Kconfig
Loaded configuration '/home/aslan/zephyrproject/zephyr/boards/espressif/esp32c6_devkitc/esp32c6_devkitc_defconfig'
Merged configuration '/home/aslan/zephyrproject/bootloader/mcuboot/boot/zephyr/prj.conf'
Merged configuration '/home/aslan/zephyrproject/bootloader/mcuboot/boot/zephyr/socs/esp32c6.conf'
Merged configuration '/home/aslan/zephyrproject/zephyr/build/mcuboot/zephyr/.config.sysbuild'
Configuration saved to '/home/aslan/zephyrproject/zephyr/build/mcuboot/zephyr/.config'
Kconfig header saved to '/home/aslan/zephyrproject/zephyr/build/mcuboot/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: /home/aslan/zephyr-sdk-0.17.0/riscv64-zephyr-elf/riscv64-zephyr-elf/bin/ld.bfd (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/aslan/zephyr-sdk-0.17.0/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc
ESP-IDF path: /home/aslan/zephyrproject/modules/hal/espressif
esptool path: /home/aslan/zephyrproject/modules/hal/espressif/tools/esptool_py/esptool.py
check_callgraph using: /home/aslan/zephyrproject/modules/hal/espressif/tools/ci/check_callgraph.py
-- Using ccache: /usr/bin/ccache
Calculated maximum number of sectors: 464
-- Configuring done
-- Generating done
-- Build files have been written to: /home/aslan/zephyrproject/zephyr/build/mcuboot
--
***************************
* Running CMake for alarm *
***************************
Loading Zephyr default modules (Zephyr base).
-- Application: /home/aslan/zephyrproject/zephyr/samples/drivers/counter/alarm
-- CMake version: 3.22.1
-- Found Python3: /home/aslan/zephyrproject/.venv/bin/python (found suitable version "3.10.12", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /home/aslan/.cache/zephyr
-- Zephyr version: 4.0.99 (/home/aslan/zephyrproject/zephyr)
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: esp32c6_devkitc, qualifiers: esp32c6
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.17.0 (/home/aslan/zephyr-sdk-0.17.0)
-- Found toolchain: zephyr 0.17.0 (/home/aslan/zephyr-sdk-0.17.0)
-- Found Dtc: /home/aslan/zephyr-sdk-0.17.0/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/aslan/zephyrproject/zephyr/boards/espressif/esp32c6_devkitc/esp32c6_devkitc.dts
-- Found devicetree overlay: /home/aslan/zephyrproject/zephyr/samples/drivers/counter/alarm/boards/esp32c6_devkitc.overlay
-- Generated zephyr.dts: /home/aslan/zephyrproject/zephyr/build/alarm/zephyr/zephyr.dts
-- Generated pickled edt: /home/aslan/zephyrproject/zephyr/build/alarm/zephyr/edt.pickle
-- Generated devicetree_generated.h: /home/aslan/zephyrproject/zephyr/build/alarm/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: /home/aslan/zephyrproject/zephyr/build/alarm/zephyr/dts.cmake
warning: MCUBOOT_UPDATE_FOOTER_SIZE (defined at subsys/dfu/Kconfig:55) was assigned the value
'0x1000' but got the value ''. Check these unsatisfied dependencies: MCUBOOT_IMG_MANAGER (=n),
IMG_MANAGER (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MCUBOOT_UPDATE_FOOTER_SIZE and/or look up
MCUBOOT_UPDATE_FOOTER_SIZE in the menuconfig/guiconfig interface. The Application Development
Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
might be helpful too.
Parsing /home/aslan/zephyrproject/zephyr/samples/drivers/counter/alarm/Kconfig
Loaded configuration '/home/aslan/zephyrproject/zephyr/boards/espressif/esp32c6_devkitc/esp32c6_devkitc_defconfig'
Merged configuration '/home/aslan/zephyrproject/zephyr/samples/drivers/counter/alarm/prj.conf'
Merged configuration '/home/aslan/zephyrproject/zephyr/build/alarm/zephyr/.config.sysbuild'
Configuration saved to '/home/aslan/zephyrproject/zephyr/build/alarm/zephyr/.config'
Kconfig header saved to '/home/aslan/zephyrproject/zephyr/build/alarm/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: /home/aslan/zephyr-sdk-0.17.0/riscv64-zephyr-elf/riscv64-zephyr-elf/bin/ld.bfd (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/aslan/zephyr-sdk-0.17.0/riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc
-- Using ccache: /usr/bin/ccache
-- Including signing script: /home/aslan/zephyrproject/zephyr/cmake/mcuboot.cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /home/aslan/zephyrproject/zephyr/build/alarm
-- Configuring done
-- Generating done
-- Build files have been written to: /home/aslan/zephyrproject/zephyr/build
-- west build: building application
[9/16] Performing build step for 'alarm'
[1/211] Preparing syscall dependency handling
[10/211] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.0.99 (/home/aslan/zephyrproject/zephyr), build: 15488be6af4b
[211/211] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
mcuboot_hdr: 32 B 32 B 100.00%
metadata: 80 B 96 B 83.33%
FLASH: 133236 B 8388480 B 1.59%
sram0_0_seg: 32032 B 425224 B 7.53%
irom0_0_seg: 13796 B 8 MB 0.16%
drom0_0_seg: 2292 B 8 MB 0.03%
lp_ram_seg: 0 GB 16 KB 0.00%
IDT_LIST: 0 GB 8 KB 0.00%
Generating files from /home/aslan/zephyrproject/zephyr/build/alarm/zephyr/zephyr.elf for board: esp32c6_devkitc
[11/16] Performing build step for 'mcuboot'
[1/244] Preparing syscall dependency handling
[11/244] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.0.99 (/home/aslan/zephyrproject/zephyr), build: 15488be6af4b
[244/244] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
iram_seg: 40090 B 48 KB 81.56%
iram_loader_seg: 4246 B 12 KB 34.55%
dram_seg: 35680 B 40 KB 87.11%
IDT_LIST: 0 GB 8 KB 0.00%
Generating files from /home/aslan/zephyrproject/zephyr/build/mcuboot/zephyr/zephyr.elf for board: esp32c6_devkitc
esptool.py v4.7.0
Creating esp32c6 image...
Merged 8 ELF sections
Successfully created esp32c6 image.
[16/16] Completed 'mcuboot'
-- west flash: rebuilding
[0/6] Performing build step for 'alarm'
[1/9] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.0.99 (/home/aslan/zephyrproject/zephyr), build: f747a8343915
[9/9] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
mcuboot_hdr: 32 B 32 B 100.00%
metadata: 80 B 96 B 83.33%
FLASH: 133236 B 8388480 B 1.59%
sram0_0_seg: 32032 B 425224 B 7.53%
irom0_0_seg: 13796 B 8 MB 0.16%
drom0_0_seg: 2292 B 8 MB 0.03%
lp_ram_seg: 0 GB 16 KB 0.00%
IDT_LIST: 0 GB 8 KB 0.00%
Generating files from /home/aslan/zephyrproject/zephyr/build/alarm/zephyr/zephyr.elf for board: esp32c6_devkitc
[1/6] Performing build step for 'mcuboot'
[2/13] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.0.99 (/home/aslan/zephyrproject/zephyr), build: f747a8343915
[13/13] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
iram_seg: 40090 B 48 KB 81.56%
iram_loader_seg: 4246 B 12 KB 34.55%
dram_seg: 35680 B 40 KB 87.11%
IDT_LIST: 0 GB 8 KB 0.00%
Generating files from /home/aslan/zephyrproject/zephyr/build/mcuboot/zephyr/zephyr.elf for board: esp32c6_devkitc
esptool.py v4.7.0
Creating esp32c6 image...
Merged 8 ELF sections
Successfully created esp32c6 image.
[6/6] Completed 'mcuboot'
-- west flash: using runner esp32
-- runners.esp32: reset after flashing requested
-- runners.esp32: Flashing esp32 chip on None (921600bps)
esptool.py v4.7.0
Found 34 serial ports
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP32-C6
Chip is ESP32-C6 (QFN40) (revision v0.0)
Features: WiFi 6, BT 5, IEEE802.15.4
Crystal is 40MHz
MAC: 40:4c:ca:ff:fe:4e:08:90
BASE MAC: 40:4c:ca:4e:08:90
MAC_EXT: ff:fe
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 8MB
Flash will be erased from 0x00000000 to 0x0000dfff...
SHA digest in image updated
Wrote 65536 bytes at 0x00000000 in 0.9 seconds (604.3 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
-- west flash: using runner esp32
-- runners.esp32: reset after flashing requested
-- runners.esp32: Flashing esp32 chip on None (921600bps)
esptool.py v4.7.0
Found 33 serial ports
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP32-C6
Chip is ESP32-C6 (QFN40) (revision v0.0)
Features: WiFi 6, BT 5, IEEE802.15.4
Crystal is 40MHz
MAC: 40:4c:ca:ff:fe:4e:08:90
BASE MAC: 40:4c:ca:4e:08:90
MAC_EXT: ff:fe
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 8MB
Flash will be erased from 0x00020000 to 0x00040fff...
Wrote 147456 bytes at 0x00020000 in 1.7 seconds (699.3 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP32-C6
--- idf_monitor on /dev/ttyUSB0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x40851d08,len:0x275c
load:0x4085be00,len:0x9ba4
load:0x40867d08,len:0x1098
entry 0x4085e72c
I (40) soc_init: MCUboot 2nd stage bootloader
I (40) soc_init: compile time Jan 21 2025 19:44:31
I (40) spi_flash: detected chip: gd
I (41) spi_flash: flash io: dio
W (43) spi_flash: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (55) soc_init: chip revision: v0.0
I (58) flash_init: SPI Speed : 80MHz
I (62) flash_init: SPI Mode : DIO
I (66) flash_init: SPI Flash Size : 8MB
I (69) soc_random: Enabling RNG early entropy source
I (74) soc_random: Disabling RNG early entropy source
I (79) boot: Jumping to the main image...
I (118) spi_flash: flash io: dio
[esp32c6] [INF] Image index: 0, Swap type: none
[esp32c6] [INF] Loading image 0 - slot 0 from flash, area id: 1
[esp32c6] [INF] Application start=40800d4ah
[esp32c6] [INF] DRAM segment: paddr=00024be0h, vaddr=40804b70h, size=00b34h ( 2868) load
[esp32c6] [INF] IRAM segment: paddr=00020080h, vaddr=40800000h, size=04b60h ( 19296) load
I (151) boot: DROM segment: paddr=00040000h, vaddr=42800000h, size=00900h ( 2304) map
I (151) boot: IROM segment: paddr=00030000h, vaddr=42000000h, size=035E4h ( 13796) map
I (166) soc_random: Disabling RNG early entropy source
I (166) boot: Jumping to the main image...
I (199) heap_runtime: ESP heap runtime init at 0x40807d20 size 466 kB.
*** Booting Zephyr OS build f747a8343915 ***
Counter alarm sample
Set alarm in 2 sec (80000000 ticks)
0
40
81
121
162
202
243
284
324
365
405
446
486
527
568
608
649
689
730
771
!!! Alarm !!!
Now: 2
Set alarm in 4 sec (160000000 ticks)
811
852
892
933
973
1014
1055
1095
1136
1176
1217
1257
1298
1339
1379
1420
1460
1501
1542
1582
1623
1663
Traceback (most recent call last):
File "/home/aslan/zephyrproject/zephyr/../modules/hal/espressif/tools/idf_monitor/idf_monitor.py", line 354, in <module>
main()
File "/home/aslan/zephyrproject/zephyr/../modules/hal/espressif/tools/idf_monitor/idf_monitor.py", line 345, in main
monitor.main_loop()
File "/home/aslan/zephyrproject/zephyr/../modules/hal/espressif/tools/idf_monitor/idf_monitor.py", line 154, in main_loop
self._main_loop()
File "/home/aslan/zephyrproject/zephyr/../modules/hal/espressif/tools/idf_monitor/idf_monitor.py", line 258, in _main_loop
super()._main_loop()
File "/home/aslan/zephyrproject/zephyr/../modules/hal/espressif/tools/idf_monitor/idf_monitor.py", line 194, in _main_loop
self.serial_handler.handle_commands(data, self.target, self.run_make, self.console_reader,
File "/home/aslan/zephyrproject/modules/hal/espressif/tools/idf_monitor/idf_monitor_base/serial_handler.py", line 163, in handle_commands
console_reader.stop()
File "/home/aslan/zephyrproject/modules/hal/espressif/tools/idf_monitor/idf_monitor_base/stoppable_thread.py", line 67, in stop
self._cancel()
File "/home/aslan/zephyrproject/modules/hal/espressif/tools/idf_monitor/idf_monitor_base/console_reader.py", line 97, in _cancel
fcntl.ioctl(self.console.fd, termios.TIOCSTI, b'\0')
OSError: [Errno 5] Input/output error
FATAL ERROR: command exited with status 1: /home/aslan/zephyrproject/.venv/bin/python3 /home/aslan/zephyrproject/zephyr/../modules/hal/espressif/tools/idf_monitor/idf_monitor.py -p /dev/ttyUSB0 -b 115200 /home/aslan/zephyrproject/zephyr/build/alarm/zephyr/zephyr.elf --eol CRLF
(.venv) aslan@thinkpad:~/zephyrproject/zephyr$ ^C
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
https://github.com/aslansq/zephyr/pull/1/files <<--- see my changes here
I have found alarm sample under counters folder but I think it is not really interrupt. It is a callback from OS after interrupt occured.
I wanted to implement real interrupt, there is not really a lot of examples. I have read technical reference manual of esp32c6-devkit-1 to teeth. Timer itself is working. If someone knows why mine is not working, it will be appreciated, thanks in advance.
Can we implement this using zephyr framework fully?
Beta Was this translation helpful? Give feedback.
All reactions