48Khz 采樣率,32bit, 2通道, BCLK輸出3.072Mhz。
測(cè)試發(fā)現(xiàn)現(xiàn)象很奇怪,如果BCLK連接的模塊阻抗改變,會(huì)導(dǎo)致正常應(yīng)該輸出48K的LRCK(WS)頻率會(huì)變動(dòng),有時(shí)候變成96Khz,客戶的模塊是專用的ASIC。
客戶反應(yīng),這個(gè)問(wèn)題同樣可以在NXP MIMXRT685-AUD-EVK板子上復(fù)現(xiàn),因?yàn)锳UD-EVK FC2P0_14連接到了外部LED的驅(qū)動(dòng)電路:
如果是官方的代碼配置,不會(huì)復(fù)現(xiàn)問(wèn)題,如果是使用客戶的代碼,能夠復(fù)現(xiàn)問(wèn)題。
如果斷開R397 1_2的電阻,問(wèn)題就不會(huì)復(fù)現(xiàn),連接之后就會(huì)復(fù)現(xiàn)。
所謂復(fù)現(xiàn):測(cè)試P0_15 LRCK采樣率從期望的48Khz變成了96Khz:
所謂不復(fù)現(xiàn):測(cè)試P0_15 LRCK采樣率就是期望的48Khz:
從I2S的構(gòu)架上講,不應(yīng)該出現(xiàn)具體I2S IP的配置因?yàn)橥獠康尿?qū)動(dòng)情況導(dǎo)致不同的輸出頻率,而且官方的代碼直接修改接口和引腳也不會(huì)出現(xiàn),那么問(wèn)題究竟出在哪里呢?
問(wèn)題分析與解決方案經(jīng)過(guò)查看官方SDK的配置和客戶提供的代碼,發(fā)現(xiàn)差別很簡(jiǎn)單,在于pinmux.c對(duì)于P0_14, P0_15的配置,客戶復(fù)現(xiàn)問(wèn)題的配置如下:
const uint32_t port0_pin14_config = (/* Pin is configured as FC2_SCK */
IOPCTL_PIO_FUNC1 |
/* Disable pull-up / pull-down function */
IOPCTL_PIO_PUPD_DI |
/* Enable pull-down function */
IOPCTL_PIO_PULLDOWN_EN |
/* Enables input buffer function */
IOPCTL_PIO_INBUF_EN |
/* Normal mode */
IOPCTL_PIO_SLEW_RATE_NORMAL |
/* Normal drive */
IOPCTL_PIO_FULLDRIVE_DI |
/* Analog mux is disabled */
IOPCTL_PIO_ANAMUX_DI |
/* Pseudo Output Drain is disabled */
IOPCTL_PIO_PSEDRAIN_DI |
/* Input function is not inverted */
IOPCTL_PIO_INV_DI);
/* PORT0 PIN14 (coords: A3) is configured as FC2_SCK */
IOPCTL_PinMuxSet(IOPCTL, 0U, 14U, port0_pin14_config);
const uint32_t port0_pin15_config = (/* Pin is configured as FC2_TXD_SCL_MISO_WS */
IOPCTL_PIO_FUNC1 |
/* Disable pull-up / pull-down function */
IOPCTL_PIO_PUPD_DI |
/* Enable pull-down function */
IOPCTL_PIO_PULLDOWN_EN |
/* Enables input buffer function */
IOPCTL_PIO_INBUF_EN |
/* Normal mode */
IOPCTL_PIO_SLEW_RATE_NORMAL |
/* Normal drive */
IOPCTL_PIO_FULLDRIVE_DI |
/* Analog mux is disabled */
IOPCTL_PIO_ANAMUX_DI |
/* Pseudo Output Drain is disabled */
IOPCTL_PIO_PSEDRAIN_DI |
/* Input function is not inverted */
IOPCTL_PIO_INV_DI);
/* PORT0 PIN15 (coords: A5) is configured as FC2_TXD_SCL_MISO_WS */
IOPCTL_PinMuxSet(IOPCTL, 0U, 15U, port0_pin15_config);
官方不復(fù)現(xiàn)問(wèn)題的配置如下:
const uint32_t port0_pin14_config = (/* Pin is configured as FC2_SCK */
IOPCTL_PIO_FUNC1 |
/* Disable pull-up / pull-down function */
IOPCTL_PIO_PUPD_DI |
/* Enable pull-down function */
IOPCTL_PIO_PULLDOWN_EN |
/* Enables input buffer function */
IOPCTL_PIO_INBUF_EN |
/* Normal mode */
IOPCTL_PIO_SLEW_RATE_NORMAL |
/* Normal drive */
IOPCTL_PIO_FULLDRIVE_EN |
/* Analog mux is disabled */
IOPCTL_PIO_ANAMUX_DI |
/* Pseudo Output Drain is disabled */
IOPCTL_PIO_PSEDRAIN_DI |
/* Input function is not inverted */
IOPCTL_PIO_INV_DI);
/* PORT0 PIN14 (coords: A3) is configured as FC2_SCK */
IOPCTL_PinMuxSet(IOPCTL, 0U, 14U, port0_pin14_config);
const uint32_t port0_pin15_config = (/* Pin is configured as FC2_TXD_SCL_MISO_WS */
IOPCTL_PIO_FUNC1 |
/* Disable pull-up / pull-down function */
IOPCTL_PIO_PUPD_DI |
/* Enable pull-down function */
IOPCTL_PIO_PULLDOWN_EN |
/* Enables input buffer function */
IOPCTL_PIO_INBUF_EN |
/* Normal mode */
IOPCTL_PIO_SLEW_RATE_NORMAL |
/* Normal drive */
IOPCTL_PIO_FULLDRIVE_EN |
/* Analog mux is disabled */
IOPCTL_PIO_ANAMUX_DI |
/* Pseudo Output Drain is disabled */
IOPCTL_PIO_PSEDRAIN_DI |
/* Input function is not inverted */
IOPCTL_PIO_INV_DI);
/* PORT0 PIN15 (coords: A5) is configured as FC2_TXD_SCL_MISO_WS */
IOPCTL_PinMuxSet(IOPCTL, 0U, 15U, port0_pin15_config);
實(shí)際上,只要BCLK P0_14的引腳配置為FULL drive即可。
可以看到,如果配置為Full output driver,驅(qū)動(dòng)能力是normal輸出的兩倍。所以,問(wèn)題出在BCLK的引腳驅(qū)動(dòng)能力這塊。
然而,推薦客戶改變驅(qū)動(dòng)能力的方式,縱然可以輸出正確的48Khz采樣率波形,客戶并不接受,認(rèn)為高驅(qū)動(dòng)能力也代表著功耗的加大,而他們的產(chǎn)品是對(duì)功耗要求極高的,必須要在普通驅(qū)動(dòng)能力下解決問(wèn)題。所以進(jìn)一步分析波形,通過(guò)使用高采樣率的示波器20Gsa/s,2G探頭抓取出問(wèn)題時(shí)候的BCLK,可以發(fā)現(xiàn)有一些毛刺:
通過(guò)內(nèi)部的溝通,也認(rèn)為這個(gè)BCLK毛刺是導(dǎo)致問(wèn)題的原因。這里需要注意的是,有些示波器,如果采樣率低可能抓不到這個(gè)毛刺,還有些探頭,阻抗比較小,導(dǎo)致探頭加上到BCLK,直接問(wèn)題消失的情況,所以建議使用高阻抗探頭,比如1M歐,1G采樣率以上的探頭即可抓到。
由于客戶不接受驅(qū)動(dòng)能力的改變,所以這里還可以考慮改變斜率,讓上升下降變緩,濾掉毛刺區(qū)域,改變配置如下:
const uint32_t port0_pin14_config = (/* Pin is configured as FC2_SCK */
IOPCTL_PIO_FUNC1 |
/* Disable pull-up / pull-down function */
IOPCTL_PIO_PUPD_DI |
/* Enable pull-down function */
IOPCTL_PIO_PULLDOWN_EN |
/* Enables input buffer function */
IOPCTL_PIO_INBUF_EN |
/* Normal mode */
IOPCTL_PIO_SLEW_RATE_SLEW|//0X80|// IOPCTL_PIO_SLEW_RATE_NORMAL |
/* Normal drive */
IOPCTL_PIO_FULLDRIVE_DI |
/* Analog mux is disabled */
IOPCTL_PIO_ANAMUX_DI |
/* Pseudo Output Drain is disabled */
IOPCTL_PIO_PSEDRAIN_DI |
/* Input function is not inverted */
IOPCTL_PIO_INV_DI);
/* PORT0 PIN14 (coords: A3) is configured as FC2_SCK */
IOPCTL_PinMuxSet(IOPCTL, 0U, 14U, port0_pin14_config);
const uint32_t port0_pin15_config = (/* Pin is configured as FC2_TXD_SCL_MISO_WS */
IOPCTL_PIO_FUNC1 |
/* Disable pull-up / pull-down function */
IOPCTL_PIO_PUPD_DI |
/* Enable pull-down function */
IOPCTL_PIO_PULLDOWN_EN |
/* Enables input buffer function */
IOPCTL_PIO_INBUF_EN |
/* Normal mode */
IOPCTL_PIO_SLEW_RATE_NORMAL |
/* Normal drive */
IOPCTL_PIO_FULLDRIVE_DI |
/* Analog mux is disabled */
IOPCTL_PIO_ANAMUX_DI |
/* Pseudo Output Drain is disabled */
IOPCTL_PIO_PSEDRAIN_DI |
/* Input function is not inverted */
IOPCTL_PIO_INV_DI);
/* PORT0 PIN15 (coords: A5) is configured as FC2_TXD_SCL_MISO_WS */
IOPCTL_PinMuxSet(IOPCTL, 0U, 15U, port0_pin15_config);
測(cè)試結(jié)果如下:
可以看到波形很光滑,毛刺消失,輸出也是穩(wěn)定的48Khz,滿足客戶不改變驅(qū)動(dòng)能力的要求。
小結(jié)
在使用i.MX RT600 FC2做I2S的時(shí)候,為了BCLK不受外部電路影響,從而影響到WS的波形頻率,建議引腳配置以下二選一:
1.使用Full output drive,提高驅(qū)動(dòng)能力2.使用慢slewrate,濾掉BCLK上升下降小毛刺
最后,特別感謝NXP 蘇州SE團(tuán)隊(duì) James Fan 在該解決方案上提供的大力支持!作者:周晶晶
-
mcu
+關(guān)注
關(guān)注
146文章
17357瀏覽量
352794 -
恩智浦
+關(guān)注
關(guān)注
14文章
5884瀏覽量
108471 -
WS
+關(guān)注
關(guān)注
0文章
3瀏覽量
9958 -
i.MX
+關(guān)注
關(guān)注
1文章
49瀏覽量
35707 -
I2S
+關(guān)注
關(guān)注
1文章
66瀏覽量
42094
原文標(biāo)題:i.MX RT600 BCLK受干擾影響WS頻率解決方案
文章出處:【微信號(hào):NXP_SMART_HARDWARE,微信公眾號(hào):恩智浦MCU加油站】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論