@@ -318,8 +318,8 @@ void i2s_hal_tdm_set_tx_slot(i2s_hal_context_t *hal, bool is_slave, const i2s_ha
318318 uint32_t msk = slot_cfg -> tdm .slot_mask ;
319319 /* Get the maximum slot number */
320320 cnt = 32 - __builtin_clz (msk );
321- /* There should be at least 2 slots in total even for mono mode */
322- cnt = cnt < 2 ? 2 : cnt ;
321+ /* Except PCM short format (ws_width = 1), there should be at least 2 slots in total even for mono mode */
322+ cnt = (( cnt < 2 ) && ( slot_cfg -> tdm . ws_width != 1 )) ? 2 : cnt ;
323323 uint32_t total_slot = slot_cfg -> tdm .total_slot > cnt ? slot_cfg -> tdm .total_slot : cnt ;
324324 i2s_ll_tx_reset (hal -> dev );
325325 i2s_ll_tx_set_slave_mod (hal -> dev , is_slave ); //TX Slave
@@ -352,8 +352,8 @@ void i2s_hal_tdm_set_rx_slot(i2s_hal_context_t *hal, bool is_slave, const i2s_ha
352352 uint32_t msk = slot_cfg -> tdm .slot_mask ;
353353 /* Get the maximum slot number */
354354 cnt = 32 - __builtin_clz (msk );
355- /* There should be at least 2 slots in total even for mono mode */
356- cnt = cnt < 2 ? 2 : cnt ;
355+ /* Except PCM short format (ws_width = 1), there should be at least 2 slots in total even for mono mode */
356+ cnt = (( cnt < 2 ) && ( slot_cfg -> tdm . ws_width != 1 )) ? 2 : cnt ;
357357 uint32_t total_slot = slot_cfg -> tdm .total_slot > cnt ? slot_cfg -> tdm .total_slot : cnt ;
358358 i2s_ll_rx_reset (hal -> dev );
359359 i2s_ll_rx_set_slave_mod (hal -> dev , is_slave ); //RX Slave
0 commit comments