IDF版本5.0,硬件ESP32
我在components\driver\i2s.c里增加2个变量
volatile int i2s_rx_count = 0;
volatile int i2s_tx_count = 0;
在static void IRAM_ATTR i2s_intr_handler_default(void *arg)中
在if ((status & I2S_INTR_OUT_EOF) && p_i2s->tx) 中i2s_tx_count++;
在if ((status & I2S_INTR_IN_SUC_EOF) && p_i2s->rx) 中i2s_rx_count++;
然后在examples\peripherals\i2s\i2s_adc_dac的main中注释了xTaskCreate(adc_read_task, "ADC read task", 2048, NULL, 5, NULL);防止该线程影响测试,
在i2s_adc_enable(EXAMPLE_I2S_NUM);后每隔一秒打印一次i2s_tx_count和i2s_rx_count
I (1351) ad/da: i2s_rx_count = 31
I (1351) ad/da: i2s_tx_count = 31
I (2351) ad/da: i2s_rx_count = 62
I (2351) ad/da: i2s_tx_count = 62
I (3351) ad/da: i2s_rx_count = 93
I (3351) ad/da: i2s_tx_count = 94
I (4351) ad/da: i2s_rx_count = 124
I (4351) ad/da: i2s_tx_count = 125
I (5351) ad/da: i2s_rx_count = 155
I (5351) ad/da: i2s_tx_count = 156
I (6351) ad/da: i2s_rx_count = 186
I (6351) ad/da: i2s_tx_count = 187
I (7351) ad/da: i2s_rx_count = 217
I (7351) ad/da: i2s_tx_count = 219
I (8351) ad/da: i2s_rx_count = 248
I (8351) ad/da: i2s_tx_count = 250
I (9351) ad/da: i2s_rx_count = 279
I (9351) ad/da: i2s_tx_count = 281
I (10351) ad/da: i2s_rx_count = 310
I (10351) ad/da: i2s_tx_count = 312
I (11351) ad/da: i2s_rx_count = 341
I (11351) ad/da: i2s_tx_count = 344
I (12351) ad/da: i2s_rx_count = 372
I (12351) ad/da: i2s_tx_count = 375
I (13351) ad/da: i2s_rx_count = 403
I (13351) ad/da: i2s_tx_count = 406
I (14351) ad/da: i2s_rx_count = 434
I (14351) ad/da: i2s_tx_count = 438
I (15351) ad/da: i2s_rx_count = 465
I (15351) ad/da: i2s_tx_count = 469
I (16351) ad/da: i2s_rx_count = 496
I (16351) ad/da: i2s_tx_count = 500
I (17351) ad/da: i2s_rx_count = 527
I (17351) ad/da: i2s_tx_count = 531
I (18351) ad/da: i2s_rx_count = 558
I (18351) ad/da: i2s_tx_count = 563
I (19351) ad/da: i2s_rx_count = 589
I (19351) ad/da: i2s_tx_count = 594
I (20351) ad/da: i2s_rx_count = 620
I (20351) ad/da: i2s_tx_count = 625
I (21351) ad/da: i2s_rx_count = 651
I (21351) ad/da: i2s_tx_count = 657
I (22351) ad/da: i2s_rx_count = 682
I (22351) ad/da: i2s_tx_count = 688
RX和TX的计数差距随时间增加会误差越大,
如果在I2S_basic中测试RX和TX的计数就没有误差,偶尔误差1应该是打印的间隔误差
ESP32的I2S_ADC_DAC速率不一样
Re: ESP32的I2S_ADC_DAC速率不一样
测试是ADC采样时钟有抖动,且总体比DAC时钟慢1/125到1/126之间
Re: ESP32的I2S_ADC_DAC速率不一样
修改了官方的库的一个BUG,ADC和DAC的速率一样的了,但是速率都变成默认值的1/8
Re: ESP32的I2S_ADC_DAC速率不一样
你好,请问你这边具体做了什么修改呢,可以提交到 GitHub 的issue上
Re: ESP32的I2S_ADC_DAC速率不一样
我在I2S_LL.H中讲lcd_en修改为0,早上又看了数据手册,LCD_EN在LCD模式,CAMERA模式和AD/DA模式都是要置位的,
I2S_LL.H里配置AD/DA使能的函数和数据手册上不一样,
I2S_LL.H里配置AD/DA使能的函数和数据手册上不一样,
Re: ESP32的I2S_ADC_DAC速率不一样
这个应该是硬件问题,只要I2S_LCD_EN置1就会出现收发中断次数不一样,无解
Re: ESP32的I2S_ADC_DAC速率不一样
有一个大概的猜测:
在不使用ADC/DAC时,全双工下,时钟信号是TX为master,RX为slave,TX和RX内部共享时钟信号,TX同时为RX和外部codec提供时钟信号,使得所有时钟同步
而在ADC/DAC模式下,TX和RX都是master,内部不共享时钟信号,导致时钟并不完全同步。
在不使用ADC/DAC时,全双工下,时钟信号是TX为master,RX为slave,TX和RX内部共享时钟信号,TX同时为RX和外部codec提供时钟信号,使得所有时钟同步
而在ADC/DAC模式下,TX和RX都是master,内部不共享时钟信号,导致时钟并不完全同步。
Who is online
Users browsing this forum: No registered users and 41 guests