Post Go back to editing

Sine Wave Generator with Adjustable Frequency port for BF706-EZMINI

I have seen quite a number of inquiries on the forums requesting examples regarding the inner workings of a signal generator. Few hints available on how to do this on the BF706-EZMINI series and I have not seen any detailed samples inside the ADI libraries that show a concise procedure regarding how to do this efficiently that I'm aware of. What is even lesser known is that somewhere in history an excellent book was written in detail about how to achieve a signal generator using Matlab script generated data on another kit the excellent BF537-EZLITE which I just so happened to purchase the other day from DIGIKEY! Well not only did I receive the kit, but tonight on the second day of this excellent purchase, I got to work and almost finished the entire book on the Blackfin architecture I was mentioning above.

My first fear and challenge was that it would be really complicated to do in real time on the BF706 because of different codec structure, but that was not a real issue after reading the detailed codec, Sport peripheral and DMA chapters from the following excellent book by Prof. Woon-Seng Gan


In his excellent book, the author shows some detailed ways to achieve this in a number of steps, that follow his guidance. the method (excerpted from his book) ends up looking something like this :

As you can see from the kit I presented above, a number of push-buttons and leds are present on the BF537 kit which are not present on the much cheaper B706 kit. I came up with the idea of using the UART port I have made a few weeks back and creating an terminal interface for the signal generator port. In this brief tutorial, I only demonstrate the ported and modified sine-wave generator concept borrowed from Prof. Woon-Seng Gan. 

The idea is that we can use a matlab script generated LUT (Look up table) with frequency and scaling coefficients and adjustment of phase in each ear that is 90 degrees apart.



These coefficients are loaded into the source code and are absorbed inside the compiler showing up by their respective names...

The code method that does this follows as it is explained in the book...

I have only bothered generating the sine-wave LUT table and not the other examples showing the Fourier Series means to concatenate multiple harmonic series to generate square waves, saw-tooth ramps and sweeps. A future tutorial may follow doing something similar in the future, but the concept is clearly illustrated inside this port! I'm not going to go into detail here, because the book is self explanatory and will make anyone with limited knowledge almost a master of the programming art inside Blackfins. I obviously highly recommend this must have book, so get it! Enough said, lets see how the Sine Wave Generator is invoked via my handy-dandy terminal...

Type : aud on to turn on the sine wave generator and listen to the tone, which should reveal itself on a scope at about 1KHz.


freq up [ENTER]

freq up [ENTER]

(Enter means press the Enter key! As if you didn't already know that, duh...)

The frequency should go up to about 3KHz. If you get outside the range of about 10 KHz, the frequency will cycle back to 1Khz. You can move up in frequency with freq up and down in frequency with the command freq dn. Here is the list of all supported commands you can use. Just type term anytime you are stuck to refresh the command list. You can also turn off the audio with the ubiquitos aud off command. 

Happy dsp'ing and leave any feedback as you wish! If you find this helpful and/or useful, feel free to drop a comment or two! 


Mario G.