SPI & SD works but no sound is to hear.

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
Arek
Senior User
Posts: 55
Joined: Thu 2016-09-01 10:58

SPI & SD works but no sound is to hear.

Post by Arek » Mon 2018-07-23 11:20

Hi All,
My VS1010 works with SPI flash and SD card.
In SPI memory is the firmware placed and SD card for audio files only.
Starting in “Runlevel 7” looks well in debugger but no sound is to hear.
What have I overseen?

VS1010C VSOS 4.02
Files:6. Buffers:3.
Runlevel 7
SPIF:c214, 2048K

SD:120 MiB
Patch v15

Hello. Runlevel 7
AMP3 START
4_Vivaldi-The_four_seasons_Winter_.mp3



Code:

Code: Select all

#include <vo_stdio.h>
#include <volink.h>    // Linker directives like DLLENTRY
#include <apploader.h> // RunLibraryFunction etc
#include <timers.h>
#include <vs1010cRom.h>
#include <vo_gpio.h>
#include <vs1010b.h>
#include <playerinfo.h>
#include <string.h>
#include <protocol.h>
#include <stdlib.h>


#define PS0 !GpioReadPin(0x20)
#define PS1 !GpioReadPin(0x21)
#define PS2 !GpioReadPin(0x22)


SETHANDLER(97, MyPlayerCallback)


u_int16 StageNr_Old = 10;
u_int16 StageNr     =  0;

s_int32 samplesToPlay;

u_int16 Reggi  =  0;




u_int16 PlayNamedFile(register const char *filename) {
	player.currentFile = 0;
	strncpy(player.fileSpec,filename,126);
	samplesToPlay = 44100 * 3; //real sample rate is unknown before decoding starts.
	PlayerPlayFile();
}



u_int16 InputsChanged()
{
	if (PS0){ StageNr = 1;} else {StageNr = 0;}
	if (PS1){ StageNr = StageNr + 2;}
	if (PS2){ StageNr = StageNr + 4;}
	
	if ((StageNr != StageNr_Old) & (StageNr <= 7))
	{	
		//StageNr_Old = StageNr;
		return 1;}
	else
	{	return 0;}
}



register const char *MP3File()
{
	switch(StageNr)
	{
	case 0:

		printf("USB Start\n");

		PERIP(GPIO2_DDR) |= (1<<7);        // Data Direction 1: Output
		PERIP(GPIO2_SET_MASK) = (1<<7);    // Set 1 

		RunLib("reboot", "2");	 // start USB SPI [4] flash writer od SD Card [2]

		return "D:0*.MP3";
		break;
		
	case 1:
		//printf("StageNr = 1\n");
		return "D:1*.MP3";
		break;

	case 2:
		//printf("StageNr = 2\n");
		return "D:2*.MP3";
		break;

	case 3:
		//printf("StageNr = 3\n");
		return "D:3*.MP3";
		break;
		
	case 4:
		//printf("StageNr = 4\n");
		return "D:4*.MP3";
		break;

	case 5:
		//printf("StageNr = 5\n");
		return "D:5*.MP3";
		break;

	case 6:
		//printf("StageNr = 6\n");
		return "D:6*.MP3";
		break;

	case 7:
		//printf("StageNr = 7\n");
		return "D:7*.MP3";
		break;

	default:
		return "D:8*.MP3";
		break;	

	} // switch
}




void MyPlayerCallback(AUDIO_DECODER *auDec) //, u_int16 samples) 
{
	if (InputsChanged())
	{
		player.auDec.cs.cancel = 1; //Stop playing current file.

	}
}




/***********************************************/
ioresult main (char *params) 
{
	StageNr_Old = 10;
	printf("AMP3 START\n");

	while(1)
	{ 	
		if (InputsChanged() == 1){
	
			StageNr_Old = StageNr;
			PlayNamedFile(MP3File());
		}
		else
		{
			DelayL(10000);
		}
	}
	

	return S_OK;
}

User avatar
pasi
VLSI Staff
Posts: 1526
Joined: Thu 2010-07-15 16:04

Re: SPI & SD works but no sound is to hear.

Post by pasi » Tue 2018-07-24 14:13

Does the playing of the file end immediately without playing anything?

Does the mp3 file have an ID3v2 tag?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Arek
Senior User
Posts: 55
Joined: Thu 2016-09-01 10:58

Re: SPI & SD works but no sound is to hear.

Post by Arek » Tue 2018-07-24 18:57

Hi Pasi,

In the other boot mode - "Normal Player" all MP3 files are played correctly.
Better, my early version without SD Card (programm and audio files placed in the SPI memory) works well and played audio files also correct.
Todays feedback from debugger:

VS1010C VSOS 4.02
Files:6. Buffers:3.
Runlevel 7
SPIF:c214, 2048K

SD:120 MiB
Patch v15

Runlevel 7 MyMP3
AMP3 START
4_Sweet_Play_-_FLIGHT.mp3


All looks correctly but nothing is to hear! Ok, two or three "klacks" like dc on/off.

Perhaps shouls i placing any driver or something else in the /sys ?
Or switch Audio On/Off? (Mute is High), Volume?
I don't know.

Hope to find solution

Regards
Arek

User avatar
pasi
VLSI Staff
Posts: 1526
Joined: Thu 2010-07-15 16:04

Re: SPI & SD works but no sound is to hear.

Post by pasi » Wed 2018-07-25 10:45

Can you send or attach the file so I can take a look and Panu has something to test with when he comes back from holiday?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Arek
Senior User
Posts: 55
Joined: Thu 2016-09-01 10:58

Re: SPI & SD works but no sound is to hear.

Post by Arek » Wed 2018-07-25 18:31

Hi,

today something new!

I have sixt players. All exact programmed with identical data. Four full working and two says only "we working" but do nothing. I mean a message from debugger ;)
Checked with oscilloscope the VS analog outputs (pin 60, 62) shows DC only. Plays of course nothing.
Have you noticed problems with VS1010C?

Best regards
AM

Hannu
Senior User
Posts: 45
Joined: Mon 2016-05-30 11:54

Re: SPI & SD works but no sound is to hear.

Post by Hannu » Thu 2018-07-26 7:04

I have some ideas.

Can you play the files with romplayer? Then hit enter and execute your own player. If it works, then it is setup of analog registers.
For working boards, poll that they actually decode the files. like cs.playTimeTotal.

Arek
Senior User
Posts: 55
Joined: Thu 2016-09-01 10:58

Re: SPI & SD works but no sound is to hear.

Post by Arek » Thu 2018-07-26 15:30

Ghost in my office?
PCB#2. Yesterday works, today, after small changes, no more. Same with "yesterday workinkg" firmware.

Short test:
Start auto - playing
break
manual play file - nothing to hear.

C#0d1d
VS1010C VSOS 4.02
Files:6. Buffers:3.
Runlevel 3
SPIF:ffff, none.

SD:120 MiB
1_JekK_-_First.mp3 PLAYING! :D

VS1010>play d:1_JekK_-_First.mp3

play d:1_JekK_-_First.mp3
1_JekK_-_First.mp3 No sound!!! :evil:

VS1010>

Arek
Senior User
Posts: 55
Joined: Thu 2016-09-01 10:58

Re: SPI & SD works but no sound is to hear.

Post by Arek » Thu 2018-07-26 18:23

found one thing.
play d:1_JekK_-_First.mp3
-> after .mp3 was something. see early message.

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

Re: SPI & SD works but no sound is to hear.

Post by Panu » Mon 2018-07-30 22:21

Hmm, if you play from the command line, try to use TAB instead of ENTER to terminate the PLAY command. Does it play then?

-Panu
.
PS you can use one asterisk (*) wildcard in the file name when you give the PLAY coomand. E.g. PLAY D:*.mp3 etc...
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

Arek
Senior User
Posts: 55
Joined: Thu 2016-09-01 10:58

Re: SPI & SD works but no sound is to hear.

Post by Arek » Mon 2018-07-30 23:32

Hi Panu,

there is no difference.
After brake with TAB plays correct. (from cmd line of course)

best regards
am

Post Reply