mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-11-03 14:01:53 +00:00 
			
		
		
		
	i2s: fix write failure issue in slave mode
This commit is contained in:
		@@ -327,6 +327,14 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, i2s_bits_per_sample_t b
 | 
			
		||||
        return ESP_ERR_INVALID_ARG;
 | 
			
		||||
    }
 | 
			
		||||
    p_i2s_obj[i2s_num]->sample_rate = rate;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Due to hardware issue, bck division on ESP32/ESP32-S2 should be greater than 8 in slave mode
 | 
			
		||||
     * So the factor need to be an appropriate value
 | 
			
		||||
     */
 | 
			
		||||
    if ((p_i2s_obj[i2s_num]->mode & I2S_MODE_SLAVE) && !p_i2s_obj[i2s_num]->use_apll) {
 | 
			
		||||
        factor = 64 * bits;
 | 
			
		||||
    }
 | 
			
		||||
    double clkmdiv = (double)I2S_BASE_CLK / (rate * factor);
 | 
			
		||||
 | 
			
		||||
    if (clkmdiv > 256) {
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@ typedef enum {
 | 
			
		||||
typedef enum {
 | 
			
		||||
    // In order to keep compatibility, remain the old definitions and introduce new definitions,
 | 
			
		||||
    I2S_COMM_FORMAT_STAND_I2S   = 0X01, /*!< I2S communication I2S Philips standard, data launch at second BCK*/
 | 
			
		||||
    I2S_COMM_FORMAT_STAND_MSB   = 0X03, /*!< I2S communication MSB alignment standard, data launch at first BCK*/
 | 
			
		||||
    I2S_COMM_FORMAT_STAND_MSB   = 0X02, /*!< I2S communication MSB alignment standard, data launch at first BCK*/
 | 
			
		||||
    I2S_COMM_FORMAT_STAND_PCM_SHORT  = 0x04, /*!< PCM Short standard, also known as DSP mode. The period of synchronization signal (WS) is 1 bck cycle.*/
 | 
			
		||||
    I2S_COMM_FORMAT_STAND_PCM_LONG   = 0x0C, /*!< PCM Long standard. The period of synchronization signal (WS) is channel_bit*bck cycles.*/
 | 
			
		||||
    I2S_COMM_FORMAT_STAND_MAX, /*!< standard max*/
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user