My goal is to use the MQS (so from SAI3 as I understand) to generate some mono 8 bit sounds
I'm basing my code off of the sai_interrupt demo from the MCUXpresso SDK.
Could you explain why exactly these clock dividers were selected for the demo?
/* Select Audio/Video PLL (786.48 MHz) as sai1 clock source */
#define DEMO_SAI1_CLOCK_SOURCE_SELECT (2U)
/* Clock pre divider for sai1 clock source */
#define DEMO_SAI1_CLOCK_SOURCE_PRE_DIVIDER (0U)
/* Clock divider for sai1 clock source */
#define DEMO_SAI1_CLOCK_SOURCE_DIVIDER (63U)
/* Get frequency of sai1 clock */
#define DEMO_SAI_CLK_FREQ (CLOCK_GetFreq(kCLOCK_AudioPllClk) / (DEMO_SAI1_CLOCK_SOURCE_DIVIDER + 1U) / (DEMO_SAI1_CLOCK_SOURCE_PRE_DIVIDER + 1U))
What are the requirements for the SAI CLK Frequency when used for MQS (specifically for 16KHz sample rate)?
What I've found on my board - we have GPIO_B0_00 (as an MQS Audio Out pin) connected to an audio amp & speaker, and it seeems that instead of the above (0 and 63) divider values, I have to use any one of the following predivider & divider combos to get sound right:
(42 & 2, 33 & 2, 25 & 2, etc)...
When I say sound right - the pitch/tone matches what I see in Matlab or Audacity BUT the volume is very quiet.
If I use an off pitch / horrible pitch divider/predivider combo, the volume will get louder and be more audible, but the pitch / sound itself is awful.
Is there an explanation somewhere behind properly setting the dividers and how this affects pitch & volume?
Thanks