SAI clock is not running at expected speed

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

SAI clock is not running at expected speed

676 次查看
mttjcksn
Contributor II

Hi all, 

Using the RT1170EVK and SDK v2.15, I'm seeing the SAI produce a bit clock & FS clock that is double what is expected. Master clock is correct.

You can see in my SAI peripheral config, the input clock is 12.288MHz, bit clock is 3.072MHz and FS clock is 48kHz.

 

mttjcksn_1-1711885534185.png

When I debug, I can see the correct values being passed in (See on the left)

mttjcksn_0-1711885442388.png

 

But when I measure the output, MCLK is correct and FS clock is 96kHz.

mttjcksn_5-1711885979430.png

 

mttjcksn_4-1711885955249.png

 

What could be causing this? I'm not changing any settings in my application code, just calling:

 

BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();

SAI_TransferTxCreateHandleEDMA(SAI1_PERIPHERAL, &saiTxHandle, nullptr, NULL, &DMA0_CH0_Handle);

SAI_TransferTxSetConfigEDMA(SAI1_PERIPHERAL, &saiTxHandle, &SAI1_Tx_config);

sai_transfer_t xfer;
xfer.data = reinterpret_cast<uint8_t *>(txBuff);
xfer.dataSize = BUFFER_SIZE * sizeof(uint32_t);
SAI_TransferSendEDMA(SAI1_PERIPHERAL, &saiTxHandle, &xfer)

 

 

Thanks,

Matt

 

 

0 项奖励
回复
4 回复数

645 次查看
mttjcksn
Contributor II
Minor update: I've noticed that if I lower the SAI1 source clock to 6.144MHz, the bit clk and fs clk will be correct. This would indicate that the master clock cannot be divided down enough to provide the required rate, but looking at the DIV field in the TCR2 register, the rates I have given above should be achievable?
0 项奖励
回复

588 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @mttjcksn ,

 

May I have the steps to reproduce this issue? Was this test based on some SAI demo or custom application? Please kindly clarify.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复

583 次查看
mttjcksn
Contributor II

Hi,

I generated a bare-bones C++ project using the MCUXpresso IDE and MCUXpresso SDK v2.15.

I then exported as an archive and imported as a gcc toolchain project using the visual studio code extension and made the manual adjustments to get it to build properly with cmake.

Then using the config tool I added the SAI peripheral driver and configured the clock as shown in my original post.

I've managed to get it to work but it doesn't really make sense as to how this solved the issue...
I stepped through the driver where it writes the DIV field in the TCR2, and I see it writing the correct value, but the clock output is wrong. I then manually set the TCR2 register in my application code, and the clock becomes correct. I then remove the code where I manually set TCR2, and it stays correct.

Maybe a caching issue somewhere? I honestly have no idea. But it certainly didn't work out of the box for me! 


Matt

 

0 项奖励
回复

562 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @mttjcksn ,

 

Is it possible to have the register values of the SAI module after initialization ?  We may help to check if FS and BCLK were configured correctly in your case.

 

Thanks for your patience !

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复