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 */
@@ -208,9 +208,9 @@ TEST_CASE("rmt rx nec with carrier", "[rmt]")
208208#if SOC_RMT_SUPPORT_RX_PINGPONG
209209#define TEST_RMT_SYMBOLS 10000 // a very long frame, contains 10000 symbols
210210
211- static void pwm_bit_bang (int gpio_num )
211+ static void pwm_bit_bang (int gpio_num , int count )
212212{
213- for (int i = 0 ; i < TEST_RMT_SYMBOLS ; i ++ ) {
213+ for (int i = 0 ; i < count ; i ++ ) {
214214 gpio_set_level (gpio_num , 1 );
215215 esp_rom_delay_us (50 );
216216 gpio_set_level (gpio_num , 0 );
@@ -231,7 +231,7 @@ static bool test_rmt_partial_receive_done(rmt_channel_handle_t channel, const rm
231231 return high_task_wakeup == pdTRUE ;
232232}
233233
234- static void test_rmt_partial_receive (size_t mem_block_symbols , bool with_dma , rmt_clock_source_t clk_src )
234+ static void test_rmt_partial_receive (size_t mem_block_symbols , int test_symbols_num , bool with_dma , rmt_clock_source_t clk_src )
235235{
236236 uint32_t const test_rx_buffer_symbols = 128 ; // the user buffer is small, it can't hold all the received symbols
237237 rmt_symbol_word_t * receive_user_buf = heap_caps_aligned_calloc (64 , test_rx_buffer_symbols , sizeof (rmt_symbol_word_t ),
@@ -280,11 +280,11 @@ static void test_rmt_partial_receive(size_t mem_block_symbols, bool with_dma, rm
280280 TEST_ESP_OK (rmt_receive (rx_channel , receive_user_buf , test_rx_buffer_symbols * sizeof (rmt_symbol_word_t ), & rx_config ));
281281
282282 // simulate input signal by GPIO
283- pwm_bit_bang (TEST_RMT_GPIO_NUM_A );
283+ pwm_bit_bang (TEST_RMT_GPIO_NUM_A , test_symbols_num );
284284
285285 TEST_ASSERT_NOT_EQUAL (0 , ulTaskNotifyTake (pdFALSE , pdMS_TO_TICKS (2000 )));
286286 printf ("received %zu symbols\r\n" , test_user_data .received_symbol_num );
287- TEST_ASSERT_EQUAL (TEST_RMT_SYMBOLS , test_user_data .received_symbol_num );
287+ TEST_ASSERT_EQUAL (test_symbols_num , test_user_data .received_symbol_num );
288288 // verify the received data
289289 for (int i = 0 ; i < 10 ; i ++ ) {
290290 printf ("{%d:%d},{%d:%d}\r\n" , receive_user_buf [i ].level0 , receive_user_buf [i ].duration0 , receive_user_buf [i ].level1 , receive_user_buf [i ].duration1 );
@@ -303,11 +303,19 @@ static void test_rmt_partial_receive(size_t mem_block_symbols, bool with_dma, rm
303303
304304TEST_CASE ("rmt rx long frame partially" , "[rmt]" )
305305{
306- test_rmt_partial_receive (SOC_RMT_MEM_WORDS_PER_CHANNEL , false, RMT_CLK_SRC_DEFAULT );
306+ test_rmt_partial_receive (SOC_RMT_MEM_WORDS_PER_CHANNEL , TEST_RMT_SYMBOLS , false, RMT_CLK_SRC_DEFAULT );
307307#if SOC_RMT_SUPPORT_DMA
308- test_rmt_partial_receive (256 , true, RMT_CLK_SRC_DEFAULT );
308+ test_rmt_partial_receive (256 , TEST_RMT_SYMBOLS , true, RMT_CLK_SRC_DEFAULT );
309309#endif
310310}
311+
312+ TEST_CASE ("rmt rx boundary conditions" , "[rmt]" )
313+ {
314+ test_rmt_partial_receive (SOC_RMT_MEM_WORDS_PER_CHANNEL , SOC_RMT_MEM_WORDS_PER_CHANNEL - 1 , false, RMT_CLK_SRC_DEFAULT );
315+ test_rmt_partial_receive (SOC_RMT_MEM_WORDS_PER_CHANNEL , SOC_RMT_MEM_WORDS_PER_CHANNEL , false, RMT_CLK_SRC_DEFAULT );
316+ test_rmt_partial_receive (SOC_RMT_MEM_WORDS_PER_CHANNEL , SOC_RMT_MEM_WORDS_PER_CHANNEL + 1 , false, RMT_CLK_SRC_DEFAULT );
317+ }
318+
311319#endif // SOC_RMT_SUPPORT_RX_PINGPONG
312320
313321TEST_RMT_CALLBACK_ATTR
0 commit comments