Forum Discussion
Altera_Forum
Honored Contributor
20 years agoSPI and an Audio codec
Hello, all
I want to use SPI core to control TLV320AIC23, which is an audio codec. Now, the problem is According to the document of Altera Embeded Peripherals Handbook, SPI core availible in SOPC Builder just supports data which width is 8-bit or less, but the width of registers of the audio codec is 9-bits. Is there any way to solve this problem? Thanks.2 Replies
- Altera_Forum
Honored Contributor
Hi eltonlaonong,
> but the width of registers of the audio codec is 9-bits And the address is only 7-bits ... so you end up with 1st octet: A6-A5-A4-A3-A2-A1-A0-D8 2nd octet: D7-D6-D5-D4-D3-D2-D1-D0 Regards, --Scott - Altera_Forum
Honored Contributor
Bear in mind that the 8-bit limit is only for the Altera HAL SPI driver. If you don't mind talking straight to your SPI hardware, you can use any word size up to 16 bits (set in SOPC Builder).
One other limit to the HAL SPI driver is that it either writes a byte and ignores the byte shifted in, or writes a 0 out and reads the byte shifted in; it can't read and write on the same transaction. FYI, I have used the SPI peripheral several times, and the HAL driver 0 of those times. It's really a pretty simple peripheral to drive directly; initialize it by setting two or three registers, then read and write when the status bits tell you to.