QUERY · ISSUE
ESP32_C3: timer_group: timer_init(271): HW TIMER NUM ERROR
bugport-esp32
from machine import*
tim = Timer(-1)
tim.init(period=1000,callback = lambda t:print('rtos'))
E (6078630) timer_group: timer_init(271): HW TIMER NUM ERROR
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: (-258, 'ESP_ERR_INVALID_ARG')
I found out that virtual timer is not available in ESP32_C3 chip.
CANDIDATE · PULL REQUEST
esp32/machine_timer: Restrict timer numbers for ESP32C6 to 0 and 1.
port-esp32
Summary
The ESP32C6 has only one timer in each of the two groups, like the ESP32C3.
Add also a check for valid timer numbers.
Addresses the issue #16438 raised by @mattklapman.
Testing
Tested with an ESP32C6 generic board and a ESP32 Generic board.