Using VS1053 ADC for voltage measurement etc.

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.

Using VS1053 ADC for voltage measurement etc.

Postby pasi » Wed 2010-08-18 16:06

Sometimes you want to measure analog voltages, for example the battery voltage or ambient illumination or perhaps background noise level and adjust display or playback parameters accordingly. But your microcontroller may not have analog to digital converters. In this case you can take advantage of the two ADC's of vs1053.

Even if you use recording from mic, you can use the line input channel for your own purposes.

You don't need to upload any software to vs1053. You can turn on the ADC and read values through the SCI interface. Note that the ADC (and audio path in general) in VS1053 is very different than in VS1003.

A quick setup procedure:
write 0xc042 to SCI_WRAMADDR, then write 0x0005 to WRAM. This configures the ADC for 48kHz (lowest possible). The power-on default in SCI_MODE is to keep mic amplifier off. If you write to SCI_MODE, check that you set or clear the LINE bit accordingly (to disable or enable the mic amplifier, respectively).

When the ADC is running, you can read the values with: write 0xc043 to SCI_WRAMADDR, then read WRAM once to get left channel (mic / line1) data, then read WRAM second time to get right channel (line2) data.

If you only want to read the right channel data, write 0xc044 to SCI_WRAMADDR, then read SCI_WRAM.

Even if you use mono recording feature, you can use the other channel for generic converter. When the encoding mode is active the ADC is already started, so you can just read the values.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
User avatar
pasi
VLSI Staff
 
Posts: 714
Joined: Thu 2010-07-15 16:04

Return to Microcontroller Software

Who is online

Users browsing this forum: No registered users

cron