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

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

Post by Arek » Mon 2018-08-06 12:27

Hi,

any ideas?

Again shortly:
I have six players. Programmed with same program (SPI memory) and soundtracks (SD).
Three of them works fine, another three not.

Feedback from VS1010:

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

SD:120 MiB
1_Soundtrack1.mp3 Playing OK

VS1010>reboot 7 Break (enter) and reboot 7 -> Start my program
reboot 7
Reboot at runlevel 7
C#0d1d
VS1010C VSOS 4.02
Files:6. Buffers:3.
Runlevel 7
SPIF:c214, 2048K

SD:120 MiB

Runlevel 7 MyMP3
AMP3 START my program started
StageNr = 4
4_Soundtrack4.mp3 Right title (4) is playing but nothing is to hear


Program is in the first message placed.

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

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

Post by Panu » Fri 2018-08-24 14:11

Hi!

I just wrote a program to print out all kinds of information of the DAC. You can run it to get some information of the hardware. The program is here: viewtopic.php?t=2307&p=12223#p12223

Maybe you can edit your program to run that info utility (RunLib("dacinfo","");) or copy the source code into your program.

A more critical thing is that I don't see the printout of patch loading anywhere in your dumps.
C#0d1d
VS1010C VSOS 4.02
Files:6. Buffers:3.
Runlevel 15
SPIF:ffff, none.
SD:3796 MiB
Patch v15 <----------------- this

VS1010>
If the patch is not loaded, it can lead to file corruption when you write files via USB to the SD card or the SPI flash. You should take care that the patch (boot.dlx) is loaded whenever you connect the USB. For the first run, if your device is empty when you connect the unit and format the flash, write the patch (boot.dlx) to the flash, and then write a dummy file to the flash to finalize the writing of the boot.dlx file. Then reboot your system. When you see the "Patch v15" (or whatever version) printed on the screen, you're better protected against file corruption in the SD card or the flash.

If you boot from SD card, write the patch file (boot.dlx) always to the root of the SD card.

-Panu
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 » Fri 2018-08-24 14:38

Hi Panu,

thanks.

You are rigt. This listing contain no boot file.
(many hours of try/error tests)
But pls see my early message:
Re: SPI & SD works but no sound is to hear.
Post by Arek » Tue 2018-07-24 18:57

with boot.dlx and same problem, look to be irreversible.

regards
am

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

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

Post by Panu » Fri 2018-08-24 14:58

I understand, now you need to go back to that program and add the DacInfo call to see what is going on. But first, reformat the SPI flash (and the SD card if you have programs there) to be sure that all the FAT structures and programs and files are correct and uncorrupted.

You have SD, so have the patch in the SD card so when you format the SPI flash, you can reboot the system and get the patch loaded from the SD before you write to the flash. You're using USB mass storage, right?

-Panu
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-08-27 14:11

Hi Panu,

many thanks.
Attached my listing. Perhaps you see something...



Optically played the sound file as awaiting.
This version played in loop. Playing time is ok.

{
printf("Start DacInfo 1 \n");
RunLib("s:dacinfo.dlx", "");

printf("Start Player \n");
PlayNamedFile(MP3File());
}

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

SD:120 MiB
Patch v15

Runlevel 7 MyMP3
AMP3 START
Start DacInfo
Start DacInfo 1
Global interrupts enabled, Int Encount: 0
Enabled interrupts:
SP1 0x24:0x8d1b, pri 1 -> 0x8d1b
RX0 0x2d:0x9b94, pri 1 -> 0x9b94
TI2 0x30:0x80e9, pri 1 -> 0x80e9
RX2 0x31:0x9bf8, pri 2 -> 0x9bf8
DAC_VOL: 0000
ANA_CF1: 1800, No analog/drivers enabled [L R GBUF DAC]: 0x0
DAC_SRC: 0x80000000, sample rate is about 0.0 Hz
stdaudioout=0x1019 (972e is ROM default)
Write=0x3040 (94c1 is AudioWrite)
AudioBufFree: 0, .wr=0x0, .rd=0x0
Audio Buffer is not initialized!! Trying to bring it up..
Trying again..
Global interrupts enabled, Int Encount: 0
Enabled interrupts:
DAC 0x20:0x923b, pri 2 -> 0x923b
SP1 0x24:0x8d1b, pri 1 -> 0x8d1b
RX0 0x2d:0x9b94, pri 1 -> 0x9b94
TI2 0x30:0x80e9, pri 1 -> 0x80e9
RX2 0x31:0x9bf8, pri 2 -> 0x9bf8
DAC_VOL: 0000
ANA_CF1: 18f0, All analog/drivers enabled [L R GBUF DAC]: 0xf
DAC_SRC: 0x144000, sample rate is about 48000.0 Hz
stdaudioout=0x1019 (972e is ROM default)
Write=0x3040 (94c1 is AudioWrite)
AudioBufFree: 1799, .wr=0x3000, .rd=0x3e0e
Writing something to the audio buffer, hopefully it's not stuck...
AudioBufFree: 2047, .wr=0x3000, .rd=0x3ffe
AudioBufFree: 2047, .wr=0x3000, .rd=0x3ffe
Start DacInfo 2
Start Player
StageNr = 2
2_Soundtrack_2.mp3
Start DacInfo 1
Global interrupts enabled, Int Encount: 0
Enabled interrupts:
DAC 0x20:0x923b, pri 2 -> 0x923b
SP1 0x24:0x8d1b, pri 1 -> 0x8d1b
RX0 0x2d:0x9b94, pri 1 -> 0x9b94
TI2 0x30:0x80e9, pri 1 -> 0x80e9
RX2 0x31:0x9bf8, pri 2 -> 0x9bf8
DAC_VOL: 0000
ANA_CF1: 18f0, All analog/drivers enabled [L R GBUF DAC]: 0xf
DAC_SRC: 0x137599, sample rate is about 44100.0 Hz
stdaudioout=0x1019 (972e is ROM default)
Write=0x3040 (94c1 is AudioWrite)
AudioBufFree: 2047, .wr=0x3000, .rd=0x3ffe
Writing something to the audio buffer, hopefully it's not stuck...
AudioBufFree: 2047, .wr=0x3000, .rd=0x3ffe
AudioBufFree: 2047, .wr=0x3000, .rd=0x3ffe
Start DacInfo 2
Start Player
StageNr = 2
2_Soundtrack_2.mp3
Start DacInfo 1
Global interrupts enabled, Int Encount: 0
Enabled interrupts:
DAC 0x20:0x923b, pri 2 -> 0x923b
SP1 0x24:0x8d1b, pri 1 -> 0x8d1b
RX0 0x2d:0x9b94, pri 1 -> 0x9b94
TI2 0x30:0x80e9, pri 1 -> 0x80e9
RX2 0x31:0x9bf8, pri 2 -> 0x9bf8
DAC_VOL: 0000
ANA_CF1: 18f0, All analog/drivers enabled [L R GBUF DAC]: 0xf
DAC_SRC: 0x137599, sample rate is about 44100.0 Hz
stdaudioout=0x1019 (972e is ROM default)
Write=0x3040 (94c1 is AudioWrite)
AudioBufFree: 2047, .wr=0x3000, .rd=0x3ffe
Writing something to the audio buffer, hopefully it's not stuck...
AudioBufFree: 2047, .wr=0x3000, .rd=0x3ffe
AudioBufFree: 2047, .wr=0x3000, .rd=0x3ffe
Start DacInfo 2
Start Player
StageNr = 2

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

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

Post by Panu » Mon 2018-08-27 19:53

I found something very strange
Write=0x3040
This is basically impossible, there's no connected memory at that address. stdaudioout object seems corrupted.

There must be some memory corruption going on after loading the patch... do you have any other version of the patch you could try?

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

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

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

Post by Panu » Mon 2018-08-27 20:04

Ok, I think I have found the problem, or at least I have a strong suspicion that I have found it. It seems like you set a handler for the PlayerCallback in your program, but then your program gets unloaded from memory. At that point, the PlayerCallback points to free memory and is probably overwritten at some time, thus corrupting your PlayerCallback function, and at that time most anything can happen.

Add this function to your program so that it's not unloaded at exit. Your program is only loaded once, right?

Code: Select all

void fini(void) {
	u_int16 *thisLib = loadedLib[loadedLibs-1];
	loadedLibs++;
	thisLib[2] = heap[0];
	thisLib[3] = heap[1];
	thisLib[4] = heap[2];
}
-Panu
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-08-27 21:14

Hi Panu,

thanks.

Yes, program is loaded once.
Used PlayerCallback (player.auDec.cs.cancel = 1;) works correct.
Program stopped "playing" current file, change sound file and "played" a new one also correct.
With "play" i mean writing only without sound.

Code: Select all

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

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-08-28 9:49

Hi,

with "heap" I get an error message.
Build started. Project: MyMP3_01, configuration: Emulation-Debug

lcc -g -hhw_desc -O6 -fsmall-code -DDEBUG -Iinclude -IC:\VLSI\VSIDE\libvs1010 -o Emulation-Debug\main.o C:\XXXXProjekte\mp3\MyMP3_01\MyMP3_01\main.c

C:\ProjekteXXXX\mp3\MyMP3_01\MyMP3_01\main.c (243) Warning 153: a type cast into a shorter type
optimizing (594): 451 441.441.438.438.438
Successfully compiled 9424 lines (330 in source) with 1 warning.
C 438 CF 0 X 286 Y 0 F 0
link1010b1 -k -m mem_user -p stb2d -t MyMP3_01 vs1010fixedabs.o Emulation-Debug\main.o -o Emulation-Debug\MyMP3_01.coff -L. -Llib -LC:\VLSI\VSIDE\libvs1010 -lc

?_heap? ERROR: "_heap" is needed but not found anywhere.
Total words: I 975, X 286, Y 0.
ERROR: "_heap" is needed but not found anywhere.
ERROR: "_heap" is needed but not found anywhere.
C:\VLSI\VSIDE\bin\make.exe: *** [Emulation-Debug/MyMP3_01.coff] Error 8


of course, apploader.h is at the top of my program. And not corrupted
Line 47: extern u_int16 heap[3];
Line 96: extern u_int16 heap[3];

Code: Select all

#include <vo_stdio.h>
#include <volink.h>    // Linker directives
#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>

#include <lowlevels.h>
#include <audio.h>
#include <vs1010bRom.h>

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

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

Post by Panu » Tue 2018-08-28 10:27

Hi again,

Ok, you need to link your program as rom-specific to get access to all the symbols such as "heap". Now you're linking the program with
vs1010fixedabs.o, you must change this to vs1010c_romabs.o.

The change can be made in the "linker" options under "project options" in VSIDE.

You're using VS1010C, right? Vs1010c_romabs.o is probably already in your project directory..?

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

Post Reply