VS1063: uart not working in encoding/codec mode

Designing hardware that uses VLSI Solution's devices as slave codecs such as an external MP3 decoder chip for a host microcontroller.
Post Reply
Ayron
User
Posts: 2
Joined: Fri 2024-05-03 14:17

VS1063: uart not working in encoding/codec mode

Post by Ayron »

In my application I need to run the VS1063 in codec mode. LPCM data is read from UART, processed and sent back via SDI. My problem is, the VS1063 doesn't send anything through the UART.
Clock input frequency is 12.288MHz. Audio input is connected to Line1, Output only the left channel. The initialization procedure is the following:

Code: Select all

void codec2_reset()
{
	/* reset codec */
	codec2_set_register(SCI_MODE, SM_RESET);

	/* configure codec */
	codec2_set_register(SCI_MODE, SM_LAYER12 | SM_SDINEW | SM_LINE1);

	/* Clock */
	codec2_set_register(SCI_CLOCKF, 0xc000);

	/* Deactivate AAC and WMA.
	 * These codecs won't be supported until
	 * the patents have expired.
	 */
	codec2_write_memory(PARAM_config1, CFG1_NOAAC | CFG1_NOWMA);
	codec2_write_memory(PARAM_playMode, 5) /* mono + VU-Meter */;

	/* baud rate */
	codec2_write_memory(PARAM_ENCODING_txUartDiv, 36); /* 1.536 MBaud */

	/* Volume */
	codec2_set_register(SCI_VOL, 0xfe);
}
When it comes to starting codec mode, the following procedure is executed:

Code: Select all

			codec2_load_patches();
			codec2_write_memory(PARAM_ENCODING_txUartDiv, 36); /* 1.536 MBaud */
			codec2_set_register(SCI_AICTRL0, params->samplerate);
			codec2_set_register(SCI_AICTRL1, 1024); /* Gain = 1 */
			/* codec mode, UART, no RIFF, PCM, left channel */
			codec2_set_register(SCI_AICTRL3, 0xa412);
			codec2_set_register(SCI_MODE, codec2_get_register(SCI_MODE) |SM_ENCODE | SM_LINE1);
			codec2_set_register(SCI_AIADDR, 0x50);
The samplerate is 48000 samples/sec.
After that, nothing happens. UART_TX stays high. When not setting bit 15 in SCI_AICTRL3, audio is passed through, but still nothing on the UART.
I've connected a logic analyzer to all the signals and captured the data sent to the VS1013.

SCI-data captured during init:

Code: Select all

00000000   02 00 00 04  02 00 48 02  02 03 C0 00  02 07 1E 03  ......H.........
00000010   02 06 C0 00  02 07 1E 09  02 06 00 05  02 07 1E 2A  ...............*
00000020   02 06 00 24  02 0B 00 FE                            ...$....
SCI-data captured on codec mode start:

Code: Select all

00000000   02 0B 00 FE  02 07 80 50  02 06 00 00  02 06 00 00  .......P........
00000010   02 06 00 06  02 06 81 55  02 06 3D 00  02 06 00 24  .......U..=....$
00000020   02 06 00 01  02 06 36 95  02 06 F4 00  02 06 55 40  ......6.......U@
...
00007380   02 06 C0 1C  02 06 00 02  02 06 00 02  02 06 00 00  ................
00007390   02 06 C0 1B  02 0A 00 50  02 07 1E 2A  02 06 00 24  .......P...*...$
000073A0   02 0C BB 80  02 0D 04 00  02 0F A4 12  03 00 00 00  ................
000073B0   02 00 58 02  02 0A 00 50  02 07 1E 0C  03 06 00 00  ..X....P........
I've already verified the patch data equals the data produced from the snipped in vs1063a-patches.plg. Patch package version is 2.5.
User avatar
pasi
VLSI Staff
Posts: 2167
Joined: Thu 2010-07-15 16:04

Re: VS1063: uart not working in encoding/codec mode

Post by pasi »

Software reset doesn't clear the whole parametric_x structure. During encoder setup you should also disable flow control by writing 0 to 0x1e2c txPauseGpio.

You can read SCI_HDAT1 to see if there is data available. If there is, then flow control is probably active and the reason UART doesn't transmit anything.

Edit: See also viewtopic.php?p=5235
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Ayron
User
Posts: 2
Joined: Fri 2024-05-03 14:17

Re: VS1063: uart not working in encoding/codec mode

Post by Ayron »

Setting txPauseGpio to 0 resolved the problem. Thanks!
Post Reply