I am trying to use the SPORT with PCG to control and read ADC. I set the PCG as the SPORT clock and FS, and they work as I set, and I can see the ADC sending out data at the SO line. But when I read it through the SPORT, I found the data not correct.
In my code writen by C, I still use the method of polling the receive buffer status (I am trying to use interrupt way, but that needs some time to me). And I read the data line three times and put them in DM for checking in the code. For easy to check the timing of the reading, I use a DAI port to set a pulse once I read the data line.
Following is the timing of reading the three data.
In the diagram, the blue trace is 12-bit ADC output(the value is AD5 or AD6), the green trace is ADC clock, the yellow tarce is the ADC's converter control (FS), the purpul one is the pulse I issued after read a data.
You can see in the diagram that the reading time is not correct (except the first one), and the three read data in the memory were:0x00000D50, 0x00000000, and 0x0000000.
Maybe the configuration for the SPORT with PCG not correct in the code, but I can't figure out where it is.
Would you please check it for me?
Attached is the code for your consideration.
Thanks a lot,