Support needed for VS1063a: Not able to play mp3 from web radio

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
Post Reply
rameshkrsah
User
Posts: 1
Joined: Thu 2017-12-28 9:00

Support needed for VS1063a: Not able to play mp3 from web radio

Post by rameshkrsah »

Hi, I am using an ESP8266 with RTOS-SDK and VS1063a chip for streaming mp3 from web stations. The configuration of the VS chip works without any problem, which is confirmed by the fact that after Writing to SCI registers, I read them and the values are same. I then perform the Sine test and followed by sending a hello sound packet, which plays without any errors.

But when feeding the stream packets from the internet, I am only getting cracking and distortions. I have implemented a linked list for storing of packets received from the Internet and a separate task to send the packets to VS using hardware SPI at 10 MHZ. I am not using any plugin because after using plugins, even Sine test fails and there is no sound at all.

I configure the VS with following settings, with separate GPIO lines for XCS and XCDS:
SCI_MODE :: 0x822
SCI_CLOCKF :: 0xFC30
SCI_VOL :: 0x5050

And the read to the SCI registers yields:
SCI_MODE, address 0x0 value 0x822
SCI_STATUS, address 0x1 value 0x68
SCI_BASS, address 0x2 value 0x0
SCI_CLOCKF, address 0x3 value 0xFC30
SCI_DECODE_TIME, address 0x4 value 0x0
SCI_AUDATA, address 0x5 value 0x1F40
SCI_WRAM, address 0x6 value 0x0
SCI_WRAMADDR, address 0x7 value 0x0
SCI_HDAT0, address 0x8 value 0x0
SCI_HDAT1, address 0x9 value 0x0
SCI_AIADDR, address 0xA value 0x0
SCI_VOL, address 0xB value 0x5050
SCI_AICTRL0, address 0xC value 0x0
SCI_AICTRL1, address 0xD value 0x0
SCI_AICTRL2, address 0xE value 0x0
SCI_AICTRL3, address 0xF value 0x0

Sending Sine test packet gives HDAT0 = 0x0 HDAT1 = 0x0 and AUDATA = 0x7D00 and sending the hello packet gives HDAT0 = 0x42C0, HDAT1 = 0xFFF2 and AUDATA = 0x5622 respectively. But with mp3 stream packet I get both HDAT0 and HDAT1 0x00 most of the time and AUDATA = 0xAC45.

I have also verified the MOSI and SCK signals in oscilloscope and everything seems good. I also tried the CPOL and CPHA combinations but no success.

Also, here the HTTP GET and RESPONSE packet from the web station I am using:
Total Size:101
X 47 45 54 20 2F 6A 61 7A 7A 2D 31 32 38 2E 6D 70 GET /jazz-128.mp
X 33 20 48 54 54 50 2F 31 2E 31 0D 0A 48 4F 53 54 3 HTTP/1.1..HOST
X 3A 20 6E 61 73 68 65 31 2E 68 6F 73 74 69 6E 67 : nashe1.hosting
X 72 61 64 69 6F 2E 72 75 0D 0A 43 6F 6E 6E 65 63 radio.ru..Connec
X 74 69 6F 6E 3A 20 6B 65 65 70 2D 61 6C 69 76 65 tion: keep-alive
X 0A 0D 52 61 6E 67 65 3A 20 62 79 74 65 73 3D 30 ..Range: bytes=0

Total Size:601
X 48 54 54 50 2F 31 2E 30 20 32 30 30 20 4F 4B 0D HTTP/1.0 200 OK.
X 0A 41 63 63 65 70 74 2D 52 61 6E 67 65 73 3A 20 .Accept-Ranges:
X 6E 6F 6E 65 0D 0A 43 6F 6E 74 65 6E 74 2D 54 79 none..Content-Ty
X 70 65 3A 20 61 75 64 69 6F 2F 6D 70 65 67 0D 0A pe: audio/mpeg..
X 69 63 79 2D 62 72 3A 31 32 38 0D 0A 69 63 65 2D icy-br:128..ice-
X 61 75 64 69 6F 2D 69 6E 66 6F 3A 20 63 68 61 6E audio-info: chan
X 6E 65 6C 73 3D 32 3B 73 61 6D 70 6C 65 72 61 74 nels=2;samplerat
X 65 3D 34 34 31 30 30 3B 62 69 74 72 61 74 65 3D e=44100;bitrate=
X 31 32 38 0D 0A 69 63 79 2D 62 72 3A 31 32 38 0D 128..icy-br:128.
X 0A 69 63 79 2D 64 65 73 63 72 69 70 74 69 6F 6E .icy-description
X 3A 53 74 72 65 61 6D 20 74 72 61 6E 73 63 6F 64 :Stream transcod
X 65 72 20 62 61 73 65 64 20 6F 6E 20 6C 69 71 75 er based on liqu
X 69 64 73 6F 61 70 0D 0A 69 63 79 2D 67 65 6E 72 idsoap..icy-genr
X 65 3A 76 61 72 69 6F 75 73 0D 0A 69 63 79 2D 6E e:various..icy-n
X 61 6D 65 3A 6A 61 7A 7A 6D 6D 78 0D 0A 69 63 79 ame:jazzmmx..icy
X 2D 70 75 62 3A 31 0D 0A 69 63 79 2D 75 72 6C 3A -pub:1..icy-url:
X 68 74 74 70 3A 2F 2F 6E 61 73 68 65 31 2E 68 6F http://nashe1.ho
X 73 74 69 6E 67 72 61 64 69 6F 2E 72 75 3A 38 30 stingradio.ru:80
X 2F 6A 61 7A 7A 2D 32 35 36 0D 0A 53 65 72 76 65 /jazz-256..Serve
X 72 3A 20 49 63 65 63 61 73 74 20 32 2E 33 2E 33 r: Icecast 2.3.3
X 2D 6B 68 31 31 0D 0A 43 61 63 68 65 2D 43 6F 6E -kh11..Cache-Con
X 74 72 6F 6C 3A 20 6E 6F 2D 63 61 63 68 65 2C 20 trol: no-cache,
X 6E 6F 2D 73 74 6F 72 65 0D 0A 50 72 61 67 6D 61 no-store..Pragma
X 3A 20 6E 6F 2D 63 61 63 68 65 0D 0A 41 63 63 65 : no-cache..Acce
X 73 73 2D 43 6F 6E 74 72 6F 6C 2D 41 6C 6C 6F 77 ss-Control-Allow
X 2D 4F 72 69 67 69 6E 3A 20 2A 0D 0A 41 63 63 65 -Origin: *..Acce
X 73 73 2D 43 6F 6E 74 72 6F 6C 2D 41 6C 6C 6F 77 ss-Control-Allow
X 2D 48 65 61 64 65 72 73 3A 20 4F 72 69 67 69 6E -Headers: Origin
X 2C 20 41 63 63 65 70 74 2C 20 58 2D 52 65 71 75 , Accept, X-Requ
X 65 73 74 65 64 2D 57 69 74 68 2C 20 43 6F 6E 74 ested-With, Cont
X 65 6E 74 2D 54 79 70 65 0D 0A 41 63 63 65 73 73 ent-Type..Access
X 2D 43 6F 6E 74 72 6F 6C 2D 41 6C 6C 6F 77 2D 4D -Control-Allow-M
X 65 74 68 6F 64 73 3A 20 47 45 54 2C 20 4F 50 54 ethods: GET, OPT
X 49 4F 4E 53 2C 20 48 45 41 44 0D 0A 43 6F 6E 6E IONS, HEAD..Conn
X 65 63 74 69 6F 6E 3A 20 63 6C 6F 73 65 0D 0A 45 ection: close..E
X 78 70 69 72 65 73 3A 20 4D 6F 6E 2C 20 32 36 20 xpires: Mon, 26
X 4A 75 6C 20 31 39 39 37 20 30 35 3A 30 30 3A 30 Jul 1997 05:00:0
X 30 20 47 4D 54 0D 0A 0D 0A 0 GMT....

If someone could point out what could be possibly wrong with this and why I am getting the distortions, it would help me a lot.
User avatar
pasi
VLSI Staff
Posts: 2122
Joined: Thu 2010-07-15 16:04

Re: Support needed for VS1063a: Not able to play mp3 from web radio

Post by pasi »

rameshkrsah wrote: Thu 2017-12-28 10:53 I have implemented a linked list for storing of packets received from the Internet and a separate task to send the packets to VS using hardware SPI at 10 MHZ.
Are you also handling the reordering of packets if they arrive in the wrong order?
rameshkrsah wrote: Thu 2017-12-28 10:53 I am not using any plugin because after using plugins, even Sine test fails and there is no sound at all.
This may be an indication that there is something wrong with your SCI read or SCI/SDI write routines. Check the clock polarity.

CLOCKF=0xFC30 is not an issue with mp3, but with WMA/AAC it might produce a 7.0x clock, which is higher than the maximum spec. The datasheet suggests CLOCKF=0xb000, or just go for CLOCKF=0xe000. (You can leave the XTAL part 0 because you use 12.288MHz XTALI.)
rameshkrsah wrote: Thu 2017-12-28 10:53 Also, here the HTTP GET and RESPONSE packet from the web station I am using:
Are you stripping away all of the protocol data and encapsulation? You should only be sending the actual mp3 data to vs1063a. If there are any non-zero bytes between mp3 frames, the mp3 decoder restarts decoding and you lose audio.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
User avatar
Panu
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

Re: Support needed for VS1063a: Not able to play mp3 from web radio

Post by Panu »

Does the stream contain ICY-Metadata? Do you strip it?

[Edit] I can see in the headers that it does. Find "ICY-Metaint" equals something in the headers. You need to strip away the ICY metadata packet at those byte intervals.

-Panu
Post Reply