The K70 reference manual states for TCR5.FBT (first-bit transmitted):
12–8
FBT
First bit shifted
Configures the bit index for the first bit transmitted for each word in the frame. If configured for MSB First,
the index of the next bit transmitted is one less than the current bit transmitted. If configured for LSB First,
the index of the next bit transmitted is one more than the current bit transmitted. The value written should
be greater than or equal to the word width when configured for MSB First. The value written should be
less than or equal to 31-word width when configured for LSB First.
I am using 32-bit I2S words and data_bits is 32. The sai_int_ksai.c driver that I'm using (MQX v4.0.x) shows
i2s_ptr->TCR5 |= I2S_TCR5_FBT(data_bits);
Yet this field is only 5-bits wide. As such, when using 32-bit words, my output from my amplifier looks like a square wave (not good!). Yet, if I change this value to be
i2s_ptr->TCR5 |= I2S_TCR5_FBT(data_bits-1);
My audio is output correctly (from what I can tell, there's other issues that I'm tracking down). Well, at least it's a symmetrical sine wave but loaded with glitches and seems noisy for some reason.
Further down in sai_int_ksai.c is the equivalent receive channel RCR5.FBT which is listed as (data_bits-1).
How does one honour the reference manual's description for this register that indicates that "The value written should be greater than or equal to the word width when configured for MSB First" when I'm outputting a 32-bit word with 32-bit data?
Thanks,
Scott
Solved! Go to Solution.
Hi Scott,
It is implied that the count begins at 0. Therefore, bit 32 would be entered as 31. Looking at sai_int_ksai.c, all the other writes to fields in I2S_TCR5 & I2S_RCR5 are correct with data_bits - 1. Thank you for pointing this out.
Best regards,
Martyn
Hi Scott,
It is implied that the count begins at 0. Therefore, bit 32 would be entered as 31. Looking at sai_int_ksai.c, all the other writes to fields in I2S_TCR5 & I2S_RCR5 are correct with data_bits - 1. Thank you for pointing this out.
Best regards,
Martyn