Skip to content

Commit e3cf105

Browse files
committed
Merge branch 'feat/allow_setting_rmt_group_prescale' into 'master'
refactor(rmt): set group clock prescale dynamically Closes IDFGH-13921 See merge request espressif/esp-idf!34640
2 parents 07ce83a + 555bfd8 commit e3cf105

File tree

15 files changed

+167
-51
lines changed

15 files changed

+167
-51
lines changed

components/esp_driver_rmt/src/rmt_common.c

Lines changed: 81 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -158,12 +158,64 @@ void rmt_release_group_handle(rmt_group_t *group)
158158
}
159159
}
160160

161-
esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t clk_src)
161+
#if !SOC_RMT_CHANNEL_CLK_INDEPENDENT
162+
static esp_err_t s_rmt_set_group_prescale(rmt_channel_t *chan, uint32_t expect_resolution_hz, uint32_t *ret_channel_prescale)
163+
{
164+
uint32_t periph_src_clk_hz = 0;
165+
rmt_group_t *group = chan->group;
166+
int group_id = group->group_id;
167+
168+
ESP_RETURN_ON_ERROR(esp_clk_tree_src_get_freq_hz(group->clk_src, ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, &periph_src_clk_hz), TAG, "get clock source freq failed");
169+
170+
uint32_t group_resolution_hz = 0;
171+
uint32_t group_prescale = 0;
172+
uint32_t channel_prescale = 0;
173+
174+
if (group->resolution_hz == 0) {
175+
while (++group_prescale <= RMT_LL_GROUP_CLOCK_MAX_INTEGER_PRESCALE) {
176+
group_resolution_hz = periph_src_clk_hz / group_prescale;
177+
channel_prescale = (group_resolution_hz + expect_resolution_hz / 2) / expect_resolution_hz;
178+
// use the first value found during the search that satisfies the division requirement (highest frequency)
179+
if (channel_prescale > 0 && channel_prescale <= RMT_LL_CHANNEL_CLOCK_MAX_PRESCALE) {
180+
break;
181+
}
182+
}
183+
} else {
184+
group_prescale = periph_src_clk_hz / group->resolution_hz;
185+
channel_prescale = (group->resolution_hz + expect_resolution_hz / 2) / expect_resolution_hz;
186+
}
187+
188+
ESP_RETURN_ON_FALSE(group_prescale > 0 && group_prescale <= RMT_LL_GROUP_CLOCK_MAX_INTEGER_PRESCALE, ESP_ERR_INVALID_ARG, TAG,
189+
"group prescale out of the range");
190+
ESP_RETURN_ON_FALSE(channel_prescale > 0 && channel_prescale <= RMT_LL_CHANNEL_CLOCK_MAX_PRESCALE, ESP_ERR_INVALID_ARG, TAG,
191+
"channel prescale out of the range");
192+
193+
// group prescale is shared by all rmt_channel, only set once. use critical section to avoid race condition.
194+
bool prescale_conflict = false;
195+
group_resolution_hz = periph_src_clk_hz / group_prescale;
196+
portENTER_CRITICAL(&group->spinlock);
197+
if (group->resolution_hz == 0) {
198+
group->resolution_hz = group_resolution_hz;
199+
RMT_CLOCK_SRC_ATOMIC() {
200+
rmt_ll_set_group_clock_src(group->hal.regs, chan->channel_id, group->clk_src, group_prescale, 1, 0);
201+
rmt_ll_enable_group_clock(group->hal.regs, true);
202+
}
203+
} else {
204+
prescale_conflict = (group->resolution_hz != group_resolution_hz);
205+
}
206+
portEXIT_CRITICAL(&group->spinlock);
207+
ESP_RETURN_ON_FALSE(!prescale_conflict, ESP_ERR_INVALID_ARG, TAG,
208+
"group resolution conflict, already is %"PRIu32" but attempt to %"PRIu32"", group->resolution_hz, group_resolution_hz);
209+
ESP_LOGD(TAG, "group (%d) clock resolution:%"PRIu32"Hz", group_id, group->resolution_hz);
210+
*ret_channel_prescale = channel_prescale;
211+
return ESP_OK;
212+
}
213+
#endif // SOC_RMT_CHANNEL_CLK_INDEPENDENT
214+
215+
esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t clk_src, uint32_t expect_channel_resolution)
162216
{
163217
esp_err_t ret = ESP_OK;
164218
rmt_group_t *group = chan->group;
165-
int channel_id = chan->channel_id;
166-
uint32_t periph_src_clk_hz = 0;
167219
bool clock_selection_conflict = false;
168220
// check if we need to update the group clock source, group clock source is shared by all channels
169221
portENTER_CRITICAL(&group->spinlock);
@@ -173,7 +225,7 @@ esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t
173225
clock_selection_conflict = (group->clk_src != clk_src);
174226
}
175227
portEXIT_CRITICAL(&group->spinlock);
176-
ESP_RETURN_ON_FALSE(!clock_selection_conflict, ESP_ERR_INVALID_STATE, TAG,
228+
ESP_RETURN_ON_FALSE(!clock_selection_conflict, ESP_ERR_INVALID_ARG, TAG,
177229
"group clock conflict, already is %d but attempt to %d", group->clk_src, clk_src);
178230

179231
// TODO: [clk_tree] to use a generic clock enable/disable or acquire/release function for all clock source
@@ -185,10 +237,6 @@ esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t
185237
}
186238
#endif // SOC_RMT_SUPPORT_RC_FAST
187239

188-
// get clock source frequency
189-
ESP_RETURN_ON_ERROR(esp_clk_tree_src_get_freq_hz((soc_module_clk_t)clk_src, ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, &periph_src_clk_hz),
190-
TAG, "get clock source frequency failed");
191-
192240
#if CONFIG_PM_ENABLE
193241
// if DMA is not used, we're using CPU to push the data to the RMT FIFO
194242
// if the CPU frequency goes down, the transfer+encoding scheme could be unstable because CPU can't fill the data in time
@@ -203,19 +251,40 @@ esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t
203251
}
204252
#endif // SOC_RMT_SUPPORT_APB
205253

206-
sprintf(chan->pm_lock_name, "rmt_%d_%d", group->group_id, channel_id); // e.g. rmt_0_0
254+
sprintf(chan->pm_lock_name, "rmt_%d_%d", group->group_id, chan->channel_id); // e.g. rmt_0_0
207255
ret = esp_pm_lock_create(pm_lock_type, 0, chan->pm_lock_name, &chan->pm_lock);
208256
ESP_RETURN_ON_ERROR(ret, TAG, "create pm lock failed");
209257
#endif // CONFIG_PM_ENABLE
210258

211259
esp_clk_tree_enable_src((soc_module_clk_t)clk_src, true);
212-
// no division for group clock source, to achieve highest resolution
260+
uint32_t real_div;
261+
#if SOC_RMT_CHANNEL_CLK_INDEPENDENT
262+
uint32_t periph_src_clk_hz = 0;
263+
// get clock source frequency
264+
ESP_RETURN_ON_ERROR(esp_clk_tree_src_get_freq_hz((soc_module_clk_t)clk_src, ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED, &periph_src_clk_hz),
265+
TAG, "get clock source frequency failed");
213266
RMT_CLOCK_SRC_ATOMIC() {
214-
rmt_ll_set_group_clock_src(group->hal.regs, channel_id, clk_src, 1, 1, 0);
267+
rmt_ll_set_group_clock_src(group->hal.regs, chan->channel_id, clk_src, 1, 1, 0);
215268
rmt_ll_enable_group_clock(group->hal.regs, true);
216269
}
217270
group->resolution_hz = periph_src_clk_hz;
218271
ESP_LOGD(TAG, "group clock resolution:%"PRIu32, group->resolution_hz);
272+
real_div = (group->resolution_hz + expect_channel_resolution / 2) / expect_channel_resolution;
273+
#else
274+
// set division for group clock source, to achieve highest resolution while guaranteeing the channel resolution.
275+
ESP_RETURN_ON_ERROR(s_rmt_set_group_prescale(chan, expect_channel_resolution, &real_div), TAG, "set rmt group prescale failed");
276+
#endif // SOC_RMT_CHANNEL_CLK_INDEPENDENT
277+
278+
if (chan->direction == RMT_CHANNEL_DIRECTION_TX) {
279+
rmt_ll_tx_set_channel_clock_div(group->hal.regs, chan->channel_id, real_div);
280+
} else {
281+
rmt_ll_rx_set_channel_clock_div(group->hal.regs, chan->channel_id, real_div);
282+
}
283+
// resolution lost due to division, calculate the real resolution
284+
chan->resolution_hz = group->resolution_hz / real_div;
285+
if (chan->resolution_hz != expect_channel_resolution) {
286+
ESP_LOGW(TAG, "channel resolution loss, real=%"PRIu32, chan->resolution_hz);
287+
}
219288
return ret;
220289
}
221290

components/esp_driver_rmt/src/rmt_private.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -19,6 +19,7 @@
1919
#include "hal/rmt_hal.h"
2020
#include "hal/dma_types.h"
2121
#include "hal/cache_ll.h"
22+
#include "hal/hal_utils.h"
2223
#include "esp_intr_alloc.h"
2324
#include "esp_heap_caps.h"
2425
#include "esp_clk_tree.h"
@@ -113,7 +114,7 @@ struct rmt_group_t {
113114
portMUX_TYPE spinlock; // to protect per-group register level concurrent access
114115
rmt_hal_context_t hal; // hal layer for each group
115116
rmt_clock_source_t clk_src; // record the group clock source, group clock is shared by all channels
116-
uint32_t resolution_hz; // resolution of group clock
117+
uint32_t resolution_hz; // resolution of group clock. clk_src_hz / prescale = resolution_hz
117118
uint32_t occupy_mask; // a set bit in the mask indicates the channel is not available
118119
rmt_tx_channel_t *tx_channels[SOC_RMT_TX_CANDIDATES_PER_GROUP]; // array of RMT TX channels
119120
rmt_rx_channel_t *rx_channels[SOC_RMT_RX_CANDIDATES_PER_GROUP]; // array of RMT RX channels
@@ -219,17 +220,18 @@ rmt_group_t *rmt_acquire_group_handle(int group_id);
219220
void rmt_release_group_handle(rmt_group_t *group);
220221

221222
/**
222-
* @brief Set clock source for RMT peripheral
223+
* @brief Set clock source and resolution for RMT peripheral
223224
*
224225
* @param chan RMT channel handle
225226
* @param clk_src Clock source
227+
* @param expect_channel_resolution Expected channel resolution
226228
* @return
227229
* - ESP_OK: Set clock source successfully
228230
* - ESP_ERR_NOT_SUPPORTED: Set clock source failed because the clk_src is not supported
229231
* - ESP_ERR_INVALID_STATE: Set clock source failed because the clk_src is different from other RMT channel
230232
* - ESP_FAIL: Set clock source failed because of other error
231233
*/
232-
esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t clk_src);
234+
esp_err_t rmt_select_periph_clock(rmt_channel_handle_t chan, rmt_clock_source_t clk_src, uint32_t expect_channel_resolution);
233235

234236
/**
235237
* @brief Set interrupt priority to RMT group

components/esp_driver_rmt/src/rmt_rx.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -276,16 +276,9 @@ esp_err_t rmt_new_rx_channel(const rmt_rx_channel_config_t *config, rmt_channel_
276276
ESP_GOTO_ON_ERROR(ret, err, TAG, "install rx interrupt failed");
277277
}
278278

279-
// select the clock source
280-
ESP_GOTO_ON_ERROR(rmt_select_periph_clock(&rx_channel->base, config->clk_src), err, TAG, "set group clock failed");
281-
// set channel clock resolution, find the divider to get the closest resolution
282-
uint32_t real_div = (group->resolution_hz + config->resolution_hz / 2) / config->resolution_hz;
283-
rmt_ll_rx_set_channel_clock_div(hal->regs, channel_id, real_div);
284-
// resolution loss due to division, calculate the real resolution
285-
rx_channel->base.resolution_hz = group->resolution_hz / real_div;
286-
if (rx_channel->base.resolution_hz != config->resolution_hz) {
287-
ESP_LOGW(TAG, "channel resolution loss, real=%"PRIu32, rx_channel->base.resolution_hz);
288-
}
279+
rx_channel->base.direction = RMT_CHANNEL_DIRECTION_RX;
280+
// select the clock source and set clock resolution
281+
ESP_GOTO_ON_ERROR(rmt_select_periph_clock(&rx_channel->base, config->clk_src, config->resolution_hz), err, TAG, "set clock resolution failed");
289282

290283
rx_channel->filter_clock_resolution_hz = group->resolution_hz;
291284
// On esp32 and esp32s2, the counting clock used by the RX filter always comes from APB clock
@@ -323,7 +316,6 @@ esp_err_t rmt_new_rx_channel(const rmt_rx_channel_config_t *config, rmt_channel_
323316
// initialize other members of rx channel
324317
portMUX_INITIALIZE(&rx_channel->base.spinlock);
325318
atomic_init(&rx_channel->base.fsm, RMT_FSM_INIT);
326-
rx_channel->base.direction = RMT_CHANNEL_DIRECTION_RX;
327319
rx_channel->base.hw_mem_base = &RMTMEM.channels[channel_id + RMT_RX_CHANNEL_OFFSET_IN_GROUP].symbols[0];
328320
// polymorphic methods
329321
rx_channel->base.del = rmt_del_rx_channel;

components/esp_driver_rmt/src/rmt_tx.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -331,16 +331,9 @@ esp_err_t rmt_new_tx_channel(const rmt_tx_channel_config_t *config, rmt_channel_
331331
ESP_GOTO_ON_ERROR(rmt_tx_init_dma_link(tx_channel, config), err, TAG, "install tx DMA failed");
332332
}
333333
#endif
334-
// select the clock source
335-
ESP_GOTO_ON_ERROR(rmt_select_periph_clock(&tx_channel->base, config->clk_src), err, TAG, "set group clock failed");
336-
// set channel clock resolution, find the divider to get the closest resolution
337-
uint32_t real_div = (group->resolution_hz + config->resolution_hz / 2) / config->resolution_hz;
338-
rmt_ll_tx_set_channel_clock_div(hal->regs, channel_id, real_div);
339-
// resolution lost due to division, calculate the real resolution
340-
tx_channel->base.resolution_hz = group->resolution_hz / real_div;
341-
if (tx_channel->base.resolution_hz != config->resolution_hz) {
342-
ESP_LOGW(TAG, "channel resolution loss, real=%"PRIu32, tx_channel->base.resolution_hz);
343-
}
334+
tx_channel->base.direction = RMT_CHANNEL_DIRECTION_TX;
335+
// select the clock source and set clock resolution
336+
ESP_GOTO_ON_ERROR(rmt_select_periph_clock(&tx_channel->base, config->clk_src, config->resolution_hz), err, TAG, "set clock resolution failed");
344337

345338
rmt_ll_tx_set_mem_blocks(hal->regs, channel_id, tx_channel->base.mem_block_num);
346339
// set limit threshold, after transmit ping_pong_symbols size, an interrupt event would be generated
@@ -376,7 +369,6 @@ esp_err_t rmt_new_tx_channel(const rmt_tx_channel_config_t *config, rmt_channel_
376369

377370
portMUX_INITIALIZE(&tx_channel->base.spinlock);
378371
atomic_init(&tx_channel->base.fsm, RMT_FSM_INIT);
379-
tx_channel->base.direction = RMT_CHANNEL_DIRECTION_TX;
380372
tx_channel->base.hw_mem_base = &RMTMEM.channels[channel_id + RMT_TX_CHANNEL_OFFSET_IN_GROUP].symbols[0];
381373
// polymorphic methods
382374
tx_channel->base.del = rmt_del_tx_channel;

components/esp_driver_rmt/test_apps/rmt/main/test_rmt_common.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -155,3 +155,34 @@ TEST_CASE("rmt interrupt priority", "[rmt]")
155155
TEST_ESP_OK(rmt_del_channel(rx_channel));
156156
TEST_ESP_OK(rmt_del_channel(another_rx_channel));
157157
}
158+
159+
#if !SOC_RMT_CHANNEL_CLK_INDEPENDENT
160+
TEST_CASE("rmt multiple channels with different resolution", "[rmt]")
161+
{
162+
rmt_tx_channel_config_t tx_channel_cfg = {
163+
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
164+
.gpio_num = TEST_RMT_GPIO_NUM_A,
165+
.clk_src = RMT_CLK_SRC_DEFAULT,
166+
.resolution_hz = 20 * 1000, // 20KHz
167+
.trans_queue_depth = 1,
168+
};
169+
rmt_channel_handle_t tx_channel = NULL;
170+
rmt_rx_channel_config_t rx_channel_cfg = {
171+
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
172+
.gpio_num = TEST_RMT_GPIO_NUM_B,
173+
.clk_src = RMT_CLK_SRC_DEFAULT,
174+
.resolution_hz = 40 * 1000 * 1000, // 40MHz
175+
};
176+
rmt_channel_handle_t rx_channel = NULL;
177+
178+
TEST_ESP_OK(rmt_new_tx_channel(&tx_channel_cfg, &tx_channel));
179+
180+
TEST_ESP_ERR(ESP_ERR_INVALID_ARG, rmt_new_rx_channel(&rx_channel_cfg, &rx_channel));
181+
rx_channel_cfg.resolution_hz = 1 * 1000 * 1000; // 1MHz
182+
183+
TEST_ESP_OK(rmt_new_rx_channel(&rx_channel_cfg, &rx_channel));
184+
185+
TEST_ESP_OK(rmt_del_channel(tx_channel));
186+
TEST_ESP_OK(rmt_del_channel(rx_channel));
187+
}
188+
#endif //SOC_RMT_CHANNEL_CLK_INDEPENDENT

components/hal/esp32/include/hal/rmt_ll.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/

components/hal/esp32c3/include/hal/rmt_ll.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -37,6 +37,11 @@ extern "C" {
3737
#define RMT_LL_MAX_FILTER_VALUE 255
3838
#define RMT_LL_MAX_IDLE_VALUE 32767
3939

40+
// Maximum values due to limited register bit width
41+
#define RMT_LL_CHANNEL_CLOCK_MAX_PRESCALE 256
42+
#define RMT_LL_GROUP_CLOCK_MAX_INTEGER_PRESCALE 256
43+
#define RMT_LL_GROUP_CLOCK_MAX_FRACTAL_PRESCALE 64
44+
4045
typedef enum {
4146
RMT_LL_MEM_OWNER_SW = 0,
4247
RMT_LL_MEM_OWNER_HW = 1,

components/hal/esp32c5/include/hal/rmt_ll.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -38,6 +38,11 @@ extern "C" {
3838
#define RMT_LL_MAX_FILTER_VALUE 255
3939
#define RMT_LL_MAX_IDLE_VALUE 32767
4040

41+
// Maximum values due to limited register bit width
42+
#define RMT_LL_CHANNEL_CLOCK_MAX_PRESCALE 256
43+
#define RMT_LL_GROUP_CLOCK_MAX_INTEGER_PRESCALE 256
44+
#define RMT_LL_GROUP_CLOCK_MAX_FRACTAL_PRESCALE 64
45+
4146
typedef enum {
4247
RMT_LL_MEM_OWNER_SW = 0,
4348
RMT_LL_MEM_OWNER_HW = 1,

components/hal/esp32c6/include/hal/rmt_ll.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -38,6 +38,11 @@ extern "C" {
3838
#define RMT_LL_MAX_FILTER_VALUE 255
3939
#define RMT_LL_MAX_IDLE_VALUE 32767
4040

41+
// Maximum values due to limited register bit width
42+
#define RMT_LL_CHANNEL_CLOCK_MAX_PRESCALE 256
43+
#define RMT_LL_GROUP_CLOCK_MAX_INTEGER_PRESCALE 256
44+
#define RMT_LL_GROUP_CLOCK_MAX_FRACTAL_PRESCALE 64
45+
4146
typedef enum {
4247
RMT_LL_MEM_OWNER_SW = 0,
4348
RMT_LL_MEM_OWNER_HW = 1,

components/hal/esp32h2/include/hal/rmt_ll.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -38,6 +38,11 @@ extern "C" {
3838
#define RMT_LL_MAX_FILTER_VALUE 255
3939
#define RMT_LL_MAX_IDLE_VALUE 32767
4040

41+
// Maximum values due to limited register bit width
42+
#define RMT_LL_CHANNEL_CLOCK_MAX_PRESCALE 256
43+
#define RMT_LL_GROUP_CLOCK_MAX_INTEGER_PRESCALE 256
44+
#define RMT_LL_GROUP_CLOCK_MAX_FRACTAL_PRESCALE 64
45+
4146
typedef enum {
4247
RMT_LL_MEM_OWNER_SW = 0,
4348
RMT_LL_MEM_OWNER_HW = 1,

0 commit comments

Comments
 (0)