The attached code can be used as a reference to test SPORT connections on newly designed board with ADSP SC58x/ ADSP-2158x processors.
The code does the following:
- It configures one half SPORT as transmitter to generate the bit clock and frame sync internally. While the other half SPORT is configured as receiver which accepts the external clock and frame sync along with the data from the former one routed through the DAI connections.
- The half SPORTs are configured in I2S mode of operation. The data transfer between the two half SPORTs is through auto-buffered DMA flow mode.
- The code tests for two types of data patterns:
- Last byte as 0xA: this is to check whether the SPORT transmit data comes out well along with the clock and frame sync when probed using a scope.
- Random data: this is to make sure that the transmitted data is received properly when routed back to the SPORT half configured as receiver.
- Inside the SPORT RX DMA done ISR, it toggles a GPIO signal to indicate that the SPORT RX DMA interrupt is coming as expected.
How to modify the code for customized system requirements:
- In the existing code, the SPORT signals are brought on to the DAI0 pins 5, 6 and 7(as shown in the below screenshot). Based upon the requirement and availability, the SRU connections can be modified such that these signals can be brought to any other DAI0/DAI1 pins.
- The existing code uses SPORT0A as transmitter and SPORT0B as receiver. The SPORTs used can be modified to any other combination of half SPORTs either from DAI0 and DAI1.
How to test that the code works?
- To make sure that the SPORT signals are coming out on the DAI pins as expected, probe the DAI pins corresponding to clock, data, and frame sync. To make sure that a known data (e.g. 0xA as last byte of the frame in this case) is transferred for easy probing, use the definition “Fixed_data”(see below screenshot)
The below screenshot shows how the SPORT signals should look like
- For a quick sanity check that the SPORT receiver is able to receive the data from the DAI pins as expected, one can look at compare the transmit and receive data (in random data format) by looking at the CCES memory window as shown in the screenshot below: