Generating Frequency

Writing software that inputs and/or outputs audio and performs DSP algorithms such as filters, new codecs or audio effects.
Post Reply
Sizzle
User
Posts: 3
Joined: Fri 2019-11-01 12:22

Generating Frequency

Post by Sizzle » Fri 2019-11-01 12:28

Hello all i got a device named VS1053 Mp3 Shield for arduino.Now i have to generate a sine wave(beep tone)having a frequecny of 1-10khz on of its pins .This device is totally new for me .Does anybody know how generate my desired signal(frequency)on one of its pins.
Thanks

User avatar
pasi
VLSI Staff
Posts: 1612
Joined: Thu 2010-07-15 16:04

Re: Generating Frequency

Post by pasi » Fri 2019-11-01 14:07

Can it be analog output? There is a built-in sine test, so with a few SCI writes you can get that running on the analog outputs.

Must it be other than analog outputs? Can it be any pin?

Some possibilities:
- I2S - configure I2S to 48kHz, configure GPIO4 (I2S_LROUT) as output, it will produce 24kHz signal which you can divide with an externally.
- UART - set a suitable UART speed, and repeatedly transmit a suitable data value (e.g. 0x55 is transmitted LSb first and with start and stop bits as "0101010101", 0xf0 as "0000011111").
- GPIO pin toggled with a timer interrupt.

The latter two require some VSDSP programming and uploading the code through SCI. The first requires an external divider to get to 12kHz.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Sizzle
User
Posts: 3
Joined: Fri 2019-11-01 12:22

Re: Generating Frequency

Post by Sizzle » Fri 2019-11-01 15:06

Thanks for the response .Yes the output should be an audio.It could be on any pin.How to get this using arduino?

Sizzle
User
Posts: 3
Joined: Fri 2019-11-01 12:22

Re: Generating Frequency

Post by Sizzle » Fri 2019-11-01 15:08

So what actually the sine test do?Can we generate the frequency of our own choice?

Hannu
Senior User
Posts: 73
Joined: Mon 2016-05-30 11:54

Re: Generating Frequency

Post by Hannu » Fri 2019-11-01 16:51

If I tracked down to right Arduino library, https://github.com/madsci1016/Sparkfun- ... no-Library

uint8_t SFEMP3Shield::enableTestSineWave(uint8_t freq)

function is to enable the sine test. It uses the old sine test.
Have a look at chapter 10.12.1 of the VS1053 datasheet http://www.vlsi.fi/fileadmin/datasheets/vs1053.pdf how the single byte is calculated to be the wanted frequency. For more accurate frequency you might want to use the new sine test, but I think the old version is good enough.

Post Reply