VS1010B I2S Audio In to Audio Out

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
Locked
User avatar
Panu
VLSI Staff
Posts: 2428
Joined: Tue 2010-06-22 13:43

VS1010B I2S Audio In to Audio Out

Post by Panu » Mon 2017-07-31 16:09

Hi!

For the VS1010B Developer Board, here is a small program that loops audio from line in to line out.

The developer board has a LINE IN connector, which is connected to an I2S AD converter (AK5358B). This small program configures the I2S port of the VS1010 to get samples from that AD converter and feed them to the output.

Code: Select all

#include <vo_stdio.h>
#include <vs1010b.h>
#include <audiofs.h>
#include <vo_gpio.h>

ioresult main (char *params) {

	static s_int32 sampleRate = 48000;
	ioctl(stdaudioout, IOCTL_AUDIO_SET_ORATE, &sampleRate);
	ioctl(stdaudioout, IOCTL_AUDIO_SET_OCHANNELS, (IOCTL_ARGUMENT)2);

	printf("Looping..\n");	
	GpioSetAsPeripheral(0x28); //DI
	GpioSetAsPeripheral(0x29); //DO
	GpioSetAsPeripheral(0x2a); //BCK
	GpioSetAsPeripheral(0x2b); //FRM
	GpioSetAsPeripheral(0x02); //12M
	PERIP(I2S_CF) = 0;
	// Reconfigure I2S. FS96K yields 48K when used in 32bit mode.
	PERIP(I2S_CF) = I2S_CF_MASTER | I2S_CF_ENA | I2S_CF_ENAMCK | I2S_CF_FS96K | I2S_CF_32B; 

	while(1) { //Audio copy loop
		static u_int16 abuf[2];
		while(!(PERIP(I2S_CF) & I2S_CF_RXLFULL)) {
			//Wait for incoming data sample
		}
		abuf[0] = PERIP(I2S_LEFT);
		abuf[1] = PERIP(I2S_RIGHT);
		stdaudioout->op->Write(stdaudioout, abuf, 0, 4);
	}
		
	return S_OK;
}
The program is a bit quick-and-crude as it runs in a busy loop and copies samples one by one. An interrupt based solution would be more elegant, and I hope to find soon time to make it.

To use the program, you'll unfortunately need to reconfigure the solder jumpers JMP1 and JMP2 to their "B" position so that the AK chip is set to be a slave (CKS0, CKS1 and CKS2 pins all at ground). Also, connect the jumper JP3 to power up the ADC LDO.

-Panu
Attachments
arch-Loop10b-2017-07-31-17-01-Busyloop.zip
VS1010B ROM-specific VSOS application that loops sound from line in to analog out using I2S.
(12.76 KiB) Downloaded 17 times
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

HanjinData
User
Posts: 3
Joined: Wed 2017-11-29 11:04

Re: VS1003B SPI Audio In to Audio Out

Post by HanjinData » Wed 2017-11-29 11:32

Hello Everyone;
I am using the VS1003b SPI Audio IN-Audio Out board. I followed the reference source code of VLSI which is available pdf file(http://www.vlsi.fi/fileadmin/software/V ... 03_aec.pdf) but it is not properly working. When I used Audio IN using LINE connector and Output Audio (speaker sound) is not clear. Sound output is coming but not clear. I am searching the VS1003b SPI Audio in-Audio out sample code. And I request for correct source code if someone has. I hope, I will get reply. Thank you.


HanjinData
Korea/South
http://www.smartkits.co.kr

User avatar
Panu
VLSI Staff
Posts: 2428
Joined: Tue 2010-06-22 13:43

Re: VS1010B I2S Audio In to Audio Out

Post by Panu » Thu 2017-12-07 15:15

Hi!

This is a duplicate post. Please go to:
viewtopic.php?f=13&t=2191&p=11569#p11569
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

Locked