Hi,
I'm developing a internet radio application using a ESP32 MCU and a VS1053 is decoder.
In general that works fine, I can play various streams in MP3 or AAC (LC) format.
But there is one station which streams in HE-AAC and causes trouble:
It starts playing just fine, but after a random time (1 .. 10s) it stops. When it stops I'm observing the following:
- SCI_STATUS changes to 0xC and than 0x48 (was 0x40)
- HDAT1 changes to 0 (was "AT")
- DREQ is constant high
After that it is no longer possible to decode the stream. If I do a software reset of the VS1053, I can continue decoding the same stream.
For better analyzing I saved a part of the stream (see attach.) which I'm streaming from a server on the local network. Nevertheless I still observe the random lockups even it is always the same data.
So, my question is: Is there any "trick" I have to do, to successfully play HE-AAC files?
Thanks!
output from ffprobe:
Input #0, aac, from '988_FMAAC_orig.aac':
Duration: 00:01:14.89, bitrate: 65 kb/s
Stream #0:0: Audio: aac (HE-AAC), 44100 Hz, stereo, fltp, 65 kb/s
HE-AAC with VS1053
HE-AAC with VS1053
- Attachments
-
- 988_FMAAC_orig.aac
- (598.74 KiB) Downloaded 54 times
Re: HE-AAC with VS1053
Hi,
I can play your file without issues with vs1053b with and without the vs1053b-patches loaded.
The most probable issues are:
- chip select handling. You can only change the chip selects when the SPI is idle. Do you perform SCI reads during playing? Does it start to work if you do not read/write SCI registers during the playback?
- SPI clock speed. What's your SPI speed? It should be below CLKI/4, where CLKI is the internal clock of the vs1053b.
What SCI_CLOCKF value are you using?
I can play your file without issues with vs1053b with and without the vs1053b-patches loaded.
It sounds like vs1053b gets reset from somewhere. It could be an erraneous write to SCI (software reset), or something external.- SCI_STATUS changes to 0xC and than 0x48 (was 0x40)
The most probable issues are:
- chip select handling. You can only change the chip selects when the SPI is idle. Do you perform SCI reads during playing? Does it start to work if you do not read/write SCI registers during the playback?
- SPI clock speed. What's your SPI speed? It should be below CLKI/4, where CLKI is the internal clock of the vs1053b.
What SCI_CLOCKF value are you using?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Re: HE-AAC with VS1053
Hi,
thanks for conforming the stream is ok.
I don't do any SCI reads during playback, I only added it only later for debugging purposes.
Regarding SPI speed: for contol I'm using ~1.4Mhz and for data ~6Mhz[1].
CLOCKF is
Now it plays for a couple of minutes, so it seems to work! Great, Thanks!
I want to use the highest speed possible, so what do you recommand for SPI control, data speed and CLOCKF?
[1]
13:22:20.416 > I (749) VS1003_driver: control spi freq=1403508
13:22:20.416 > I (749) VS1003_driver: data spi freq: 6153846
[2]
WriteSci(vs1003_drv, SCI_CLOCKF, HZ_TO_SC_FREQ(12288000) | SC_MULT_53_35X | SC_ADD_53_10X);
thanks for conforming the stream is ok.
I don't do any SCI reads during playback, I only added it only later for debugging purposes.
Regarding SPI speed: for contol I'm using ~1.4Mhz and for data ~6Mhz[1].
CLOCKF is
Code: Select all
(HZ_TO_SC_FREQ(12288000) | SC_MULT_53_35X | SC_ADD_53_10X) [2]
If I understand it correctly, my SPI speed is to high. I've changed the data SPI speed to- SPI clock speed. What's your SPI speed? It should be below CLKI/4, where CLKI is the internal clock of the vs1053b.
Code: Select all
I (749) VS1003_driver: data spi freq: 2962962
I want to use the highest speed possible, so what do you recommand for SPI control, data speed and CLOCKF?
[1]
13:22:20.416 > I (749) VS1003_driver: control spi freq=1403508
13:22:20.416 > I (749) VS1003_driver: data spi freq: 6153846
[2]
WriteSci(vs1003_drv, SCI_CLOCKF, HZ_TO_SC_FREQ(12288000) | SC_MULT_53_35X | SC_ADD_53_10X);
Re: HE-AAC with VS1053
If you're playing HE-AAC regularly, I would think you're not looking at the lowest possible power consumption, and thus I would suggest always using 5.0x clock instead of 3.5x+1.0x. That would also allow to use higher SPI clock (up to 15MHz instead of 10.5MHz).
You could change CLOCKF and your SPI speed depending on the format, but it might be too complex compared to the benefit.
If you can't get to 10MHz with 3.5x clock, then maybe there is a clock polarity issue. Note that for SCI reads the max clock is CLK/7, i.e. 6MHz with 3.5x clock, and 8.7MHz for 5.0x clock. Until you have written CLOCKF you should use around 1.5MHz (1*12.288MHz/7).
You could change CLOCKF and your SPI speed depending on the format, but it might be too complex compared to the benefit.
If you can't get to 10MHz with 3.5x clock, then maybe there is a clock polarity issue. Note that for SCI reads the max clock is CLK/7, i.e. 6MHz with 3.5x clock, and 8.7MHz for 5.0x clock. Until you have written CLOCKF you should use around 1.5MHz (1*12.288MHz/7).
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Re: HE-AAC with VS1053
I've set CLOCKF to 5.0x, but when playing AAC files 3Mhz SPI speed seems to be the maximum.
When using MP3 I can use SPI speeds > 10Mhz without any issue. It seems there is something special about AAC files ...
When using MP3 I can use SPI speeds > 10Mhz without any issue. It seems there is something special about AAC files ...
Re: HE-AAC with VS1053
(HE-)AAC should not be any different than mp3. It does decode directly from the stream buffer though, so DREQ probably goes up more often.
Check that you don't send more than 32 bytes after checking that DREQ is high.
Are you using the vs1053b-patches package?
Also note that mp3 resynchronizes easily (and is a more robust in decoding), so you don't necessarily notice bit errors and missing (or inserted) bytes.
Check that you don't send more than 32 bytes after checking that DREQ is high.
Are you using the vs1053b-patches package?
Also note that mp3 resynchronizes easily (and is a more robust in decoding), so you don't necessarily notice bit errors and missing (or inserted) bytes.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Re: HE-AAC with VS1053
I've tried a couple of combinations, the following works fine with HE-AAC: SPI speed 6.1Mhz and CLOCKF 3.5x+0.0x.
I've also tried to use the patches package. With the latest version (2.80) nothing works for me (even MP3).
Only the versions up to 2.00 without any extras (vs1053b-patches.plg) seem to work. Not sure what the reason might be ... maybe it has something to do with the size of the plugin.
I've also tried to use the patches package. With the latest version (2.80) nothing works for me (even MP3).
Only the versions up to 2.00 without any extras (vs1053b-patches.plg) seem to work. Not sure what the reason might be ... maybe it has something to do with the size of the plugin.