Datasheet
HH
VS1053B OGG VORBIS ENCODER VSMPG
2.3.4 Reading Additional Data while Recording Ogg Vorbis
You can get extra side information while recording Ogg Vorbis data to see whether
VS1053b is still working. The following VS1053b X memory addresses may be read
for extra data:
X Memory Address Description
0x8 16 LSb’s of recording time (seconds)
0x9 16 MSb’s of recording time (seconds)
0xC 16 LSb’s of average bitrate (bits/s)
0xD 16 MSb’s of average bitrate (bits/s)
0x1800 16 LSb’s of sample counter
0x1801 16 MSb’s of sample counter
Example: To read the average bitrate, do as follows. First write 0xC to SCI_WRAMADDR
(7). Then read from SCI_WRAM (6). This is 16 least significant bits of the bitrate. Then
read the 16 more significant bits by reading SCI_WRAM again.
You can read the recording time as a sanity check that VS1053b is working: if the
register contents don’t change every second, you’ll have to take protective measures.
2.3.5 Finishing Ogg Vorbis Recording
To create fully compliant Ogg Vorbis files, Ogg Vorbis bitstreams need to be shut down
properly. The following algorithm can be used to implement this:
1. Set bit 0 of SCI_AICTRL3 (15) to 1.
2. Continue reading data through SCI_HDAT0 and SCI_HDAT1 as usual, but check
SCI_AICTRL3’s bit 1 from time to time. When this bit turns to 1, the Ogg Vorbis
encoder has finished writing to the buffer.
3. Write the remaining words from the bitstream buffer as normal using SCI_HDAT0
and SCI_HDAT1.
4. Read SCI_AICTRL3 twice (changed from version 1.4!) and check whether bit 2 is
1 in the latter read. If it is, then don’t write to the file the last byte (bits 7:0) of the
last word that have come through SCI_HDAT0.
5. Reset VS1053b to normal state using software reset. Remember to clear register
SCI_MODE (0) bit SM_ADPCM (12) if you don’t wish to start ADPCM recording.
Remember to also set bit SM_LAYER12 (1) to an appropriate value.
6. If you want to restart recording, you have to completely reload and restart the
recording application.
Rev. 1.70c 2012-11-16
Page 11(39)