Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS1053b AAC & WMA internal frequency is too high #80

Open
enjoyneering opened this issue Aug 25, 2019 · 4 comments
Open

VS1053b AAC & WMA internal frequency is too high #80

enjoyneering opened this issue Aug 25, 2019 · 4 comments

Comments

@enjoyneering
Copy link

enjoyneering commented Aug 25, 2019

VS1053_WriteRegister(SPI_CLOCKF,0xB8,0x00); // SC_MULT = x1, SC_ADD= x1

Because all VS1053 registers are 16-bit the SPI_CLOCKF value is 0xB800=0b1011 1000 0000 0000 where 15..13-bits is clock multiplier, 12..11-bits addition to multiplier (see p.43):

SC_MULT=0b1010 0000 0000 0000=0xA000= x4.0 not x1
SC_ADD=0b0001 1000 0000 0000=0x1800= x2.0 not x1

The equation for internal clock CLKI at normal speed: CLKI = XTALI x SC_MULT = 12.288 x 4.0 = 49.152MHz. It is OK, because the maximum VS1053 frequency is 55.3MHz (see. p7)
But when chip is trying to decode AAC & WMA it may automatically choose to use addition to multiplier SC_ADD. The equation for internal clock at boost speed: CLKI = XTALI x (SC_MULT + SC_ADD) = 12.288 x (4.0 + 2.0)=73.728MHz with recommended maximum 55.3MHz!!!

Recommended SC_MULT=x3.5, SC_ADD=x1 (SCI_CLOCKF=0x8800)

VS1053_WriteRegister(SPI_CLOCKF,0x88,0x00); // SC_MULT = x3.5, SC_ADD = x1

Do not forget your SDI speed is CLKI/4=49.152/4=12.288MHz & SCI speed is CLKI/7=49.152/7=7.02MHz

@karawin
Copy link
Owner

karawin commented Aug 25, 2019

ok thanks. i will modify it.

@karawin
Copy link
Owner

karawin commented Aug 25, 2019

You mean?
VS1053_WriteRegister(SPI_CLOCKF,0x88,0x00); SC_MULT = x3,5, SC_ADD= x1

@enjoyneering
Copy link
Author

enjoyneering commented Aug 25, 2019

Yes 0x88 not 0xB88. But 0x88, 00 will work only for 12.288MHz crystal oscillator aka XTALI. The full equation for different crystals is more complicated & you have to change 2 registers, not one.

I'm working on new VS1053 driver for your awesome project. Will share it some time next month.

P.S. The VS1053 can work with crystal oscillator 12-13MHz & 24-26MHz with some limitations. The recommend frequency is 12.288MHz. It gives you the highest sample rate 48KHz=12.288/256

@enjoyneering
Copy link
Author

sorry for off topic

loop Delay(1) in vs1053.h, how much is it in usec or msec? thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants