This has yet to be my most complex Tutorial and I hope not the final one...I call it Audio Filter control. In fact it is many things in one. I have finally achieved UART immortality by being able to control everything from it. I can turn LED on and OFF. Set the BLINK Rate among many different rates, turn Audio ON and OFF and lastly, turn a Cross-Over filter ON or OFF. You might want to turn the LED OFF while the filter is executing or you might get weird feedback. I guess I'm not perfect, so nothing is stopping you from correcting my quickly written code that included the work of brilliant people here on the Forum. @PatrickG and @UweS to mention a few great minds...Lets move on, shall we ?!
This example can be a bit daunting, but it is really quite simple even underneath the surface. I have used Will Pirkle's excellent software called RackAFX to test my prototype whose simple parameters are passed passed in at the console. The only commands you need to know in this incarnation of the software are really: aud on / aud off /filt on / filt off.
Check out my other indepth tutorials for the other commands which are clearly obtained by typing term at the PUTTY terminal i.e.
The terminal is very self explanatory, so go ahead and experiment with the different terminal commands. The neat thing in this version is that you can simply engage a mode of the terminal that works for you by commenting or un-commenting one line at the top of the source! If you used the definition as you see below, it means you are running UART as DMA interrupt device. If you comment the line out you are only running interrupts RX and TX without DMA. The choice is yours!
// Comment out #define USE_UART_DMA to only engage UART in interrupt mode!#define USE_UART_DMA
One you turn audio on via terminal command aud on you are on your way to play around with various instruments to feed audio into the line intput port and feed the output port to a scope, or head phones...
while the aud on or filt on is immediately typed at the PUTTY terminal console, you should see something on your scope that looks similar to either an audio signal passed in or perhaps an oscillator pulse from RackAFX.
If you engage UweS cross-over FIR filters, it can be done with filt on / filt off.
I hope you found this tutorial useful. Let me know how it works out for you. As always I have attached the source code for it. If you can improve it and make it better also let me know how! I will evolve the terminal so that filter coefficients can be passed in automatically from a graphic environment. More on this later...
I hope you'll get well soon.
When I read the initialization of SPROT yesterday, I couldn't find the pages 26-59, 26-67, 26-75 and 26-76 in the ADSP-BF70x Blackfin+ Processor Hardware Reference manual, which was mentioned by PatrickG in the Simple audio in-out code.
// Function sport_configure initialises the SPORT0. Refer to pages 26-59, 26-67, 2
// 26-75 and 26-76 of the ADSP-BF70x Blackfin+ Processor Hardware Reference manual.
R0=0x3F0(X); [REG_PORTC_FER]=R0; // Set up Port C in peripheral mode
R0=0x3F0(X); [REG_PORTC_FER_SET]=R0; // Set up Port C in peripheral mode
R0=0x2001973; [REG_SPORT0_CTL_A]=R0; // Set up SPORT0 (A) as TX to codec, 24 bits
R0=0x0400001; [REG_SPORT0_DIV_A]=R0; // 64 bits per frame, clock divisor of 1
R0=0x1973(X); [REG_SPORT0_CTL_B]=R0; // Set up SPORT0 (B) as RX frm codec, 24 bits
R0=0x0400001; [REG_SPORT0_DIV_B]=R0; // 64 bits per frame, clock divisor of 1 rts; sport_configure.end:
*pREG_SPORT0_CTL_A=0x2001973; // Set up SPORT0 (A) as TX to codec, 24 bits *pREG_SPORT0_DIV_A=0x400001; // 64 bits per frame, clock divisor of 1
*pREG_SPORT0_CTL_B=0x0001973; // Set up SPORT0 (B) as RX from codec, 24 bits *pREG_SPORT0_DIV_B=0x400001; // 64 bits per frame, clock divisor of 1