Denis Bélières
Member
Hello geeks ...
I try to understand how I2S works, and I wrote a very simple program to see an I2S output signal on an oscilloscope. I spent a lot of time reading reference manual "IMXRT1060RM_rev3_annotations.pdf" (I cannot put it under my pillow), and I pruned differents libraries (Paul's and others' ones) to extract the essentials things to configure a 48 kHz output signal on SAI2 port. This signal is monophonic and constant (32 bits word 0xAAAAAAAA). No interrupt, no dma, just testing FIFO status request bit in main loop to place a new 0xAAAAAAAA in the TCSR register. I was happy when I saw awaited 48 kHz SYNC, 3.072 MHz BCLK, and stable TxData : every configurations in my simplest "Config_I2S.h" attached file look correct. (With a very simple clock setting without any computation and without fractionnal system sollicitation).
But in facts, there is something which does not work.
I added an output signal on P0, toggling each time bit 16 = FIFO Request Flag in SAI2_TCSR is one, in the same time I put a new data. I added printing status before writing data (1 = request placed) and after writing data (should be 0 : request granted). It is not 0 after writing. The loop is not synchronised by 48 kHz I2S sample clock, but runs a lot faster, and P0 toggles approximatively at 840 kHz instead of 24 kHz (see signals.jpg).
So, if i try to scan data in a constant array instead of repeating always the same word, data is not output correctly. Same thing if I try to operate with interrupt. The program writes data in TCSR when the FIFO is not ready to accept new data, so this new data is ignored and lot of samples of the array are skipped ...
I have two boards, they produce the same thing.
Where is the error ?
I try to understand how I2S works, and I wrote a very simple program to see an I2S output signal on an oscilloscope. I spent a lot of time reading reference manual "IMXRT1060RM_rev3_annotations.pdf" (I cannot put it under my pillow), and I pruned differents libraries (Paul's and others' ones) to extract the essentials things to configure a 48 kHz output signal on SAI2 port. This signal is monophonic and constant (32 bits word 0xAAAAAAAA). No interrupt, no dma, just testing FIFO status request bit in main loop to place a new 0xAAAAAAAA in the TCSR register. I was happy when I saw awaited 48 kHz SYNC, 3.072 MHz BCLK, and stable TxData : every configurations in my simplest "Config_I2S.h" attached file look correct. (With a very simple clock setting without any computation and without fractionnal system sollicitation).
But in facts, there is something which does not work.
I added an output signal on P0, toggling each time bit 16 = FIFO Request Flag in SAI2_TCSR is one, in the same time I put a new data. I added printing status before writing data (1 = request placed) and after writing data (should be 0 : request granted). It is not 0 after writing. The loop is not synchronised by 48 kHz I2S sample clock, but runs a lot faster, and P0 toggles approximatively at 840 kHz instead of 24 kHz (see signals.jpg).
So, if i try to scan data in a constant array instead of repeating always the same word, data is not output correctly. Same thing if I try to operate with interrupt. The program writes data in TCSR when the FIFO is not ready to accept new data, so this new data is ignored and lot of samples of the array are skipped ...
I have two boards, they produce the same thing.
Where is the error ?
Attachments
Last edited: