NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Porting C5000 Teaching ROM to C5535 eZdsp

From Texas Instruments Wiki
Jump to: navigation, search

About the C5000 Teaching ROM[edit]

Twenty chapters provide an introduction to Digital Signal Processing (DSP) techniques including FIR filters, IIR filters, LMS adaptive filters, Goertzel Algorithm, speech compression and wavelets. The material is aimed at the beginner to DSP or the enthusiast. Suitable for classroom use or self study. The emphasis is hands-on practical experiments rather than pure theory. Complete working examples of C code are provided for each chapter which run on the TSM320C5505 and TMS320C5515 USB Sticks. There is also a fun element to the experiments - you will be able to sound like an alien or play an electric guitar with echo and phasing effects. Each chapter contains a PowerPoint presentation to introduce the topic, block diagrams, some Matlab models and working C code. Self-test questions are provided to check on your progress. All the additional equipment you need is a dynamic microphone and headphones. Also useful are an electric guitar or other musical instrument and a digital frequency meter or oscilloscope. The material does assume some basic knowledge of C programming to allow the code to be used modified by the student.

Download[edit]

Teaching ROM Compatibility[edit]

The C5000 Teaching ROM was created for use with the {{#tiwikiurl:C5505#eZdsp|C5505 eZdsp}} and {{#tiwikiurl:C5515#eZdsp|C5515 eZdsp}} development boards. On the C5505 eZdsp and C5515 eZdsp the AIC3204 stereo audio codec is connected to the I2S0 interface of the DSP.

On the {{#tiwikiurl:C5535#eZdsp|C5535 eZdsp}} the AIC3204 codec is connected to the I2S2 interface. To send or receive audio streams to/from the AIC3204 codec on the C5535 eZdsp, the Teaching ROM source code needs to use I2S2 instead of I2S0 and needs to configure the EBSR Parallel Port pin mux to bring out the I2S2 signals.

How to change I2S0 to I2S2[edit]

  • Follow the project configuration instructions in "Chapter 1 Getting Started.ppt"
    • Important to use rts55h.lib, set the memory model to huge, set the --ptrdiff_size to 32, --silicon_version = 5515
  • Build the project to make sure there are no build problems before the code port...

Download the modified source code and replace original files[edit]

Or copy the modified code sections into your source code[edit]

  • Copy and paste the below code segments into the respective files in your project...
Edit csl_general.h[edit]
  • Configure CSL for C5515 eZdsp (C5535 and C5515 are very similar at a device level)
  • Comment C5515_EVM on line 159:

<syntaxhighlight lang="c"> //#define C5515_EVM </syntaxhighlight>

Edit usbstk5505.h[edit]
  • Copy and paste these register definitions into the usbstk5505.h file:

<syntaxhighlight lang="c"> //Add I2S2 register definitions for C5535 port

  1. define I2S2_CR *(volatile ioport Uint16*)(0x2A00)
  2. define I2S2_SRGR *(volatile ioport Uint16*)(0x2A04)
  3. define I2S2_W0_LSW_W *(volatile ioport Uint16*)(0x2A08)
  4. define I2S2_W0_MSW_W *(volatile ioport Uint16*)(0x2A09)
  5. define I2S2_W1_LSW_W *(volatile ioport Uint16*)(0x2A0C)
  6. define I2S2_W1_MSW_W *(volatile ioport Uint16*)(0x2A0D)
  7. define I2S2_IR *(volatile ioport Uint16*)(0x2A10)
  8. define I2S2_ICMR *(volatile ioport Uint16*)(0x2A14)
  9. define I2S2_W0_LSW_R *(volatile ioport Uint16*)(0x2A28)
  10. define I2S2_W0_MSW_R *(volatile ioport Uint16*)(0x2A29)
  11. define I2S2_W1_LSW_R *(volatile ioport Uint16*)(0x2A2C)
  12. define I2S2_W1_MSW_R *(volatile ioport Uint16*)(0x2A2D)

</syntaxhighlight>

Edit aic3204_init.c[edit]
  • Change the initialization of Serial Port 0 (I2S0) to Parallel Port Mode 1 (I2S2) (2 instances at lines 80 & 222)...

<syntaxhighlight lang="c">

   /* Configure Serial Bus */
   SYS_EXBUSSEL |= 0x0100;  // Configure Serial bus 0 for I2S0

</syntaxhighlight> to... <syntaxhighlight lang="c">

   /* Configure Parallel Port */
   SYS_EXBUSSEL = 0x1000;  // Configure Parallel Port mode = 1 for I2S2

</syntaxhighlight>

  • Change all instances I2S0 to I2S2 (2 instances at lines 139 & 281)...

<syntaxhighlight lang="c">

   /* I2S settings */
   I2S0_SRGR = 0x0;
   I2S0_CR = 0x8010;    // 16-bit word, slave, enable I2C
   I2S0_ICMR = 0x3f;    // Enable interrupts

</syntaxhighlight> to... <syntaxhighlight lang="c">

   /* I2S settings */
   I2S2_SRGR = 0x0;
   I2S2_CR = 0x8010;    // 16-bit word, slave, enable I2C
   I2S2_ICMR = 0x3f;    // Enable interrupts

</syntaxhighlight>

Edit aic3204.c[edit]
  • Change all instances I2S0 to I2S2 (11 instances throughout file)...

<syntaxhighlight lang="c">

   /* Read Digital audio inputs */
   while(!(I2S0_IR & RcvR) )
   {
   	counter1++; // Wait for receive interrupt
   }
   *left_input = I2S0_W0_MSW_R;         // Read Most Significant Word of first channel
    dummy = I2S0_W0_LSW_R;              // Read Least Significant Word (ignore)
   *right_input = I2S0_W1_MSW_R;        // Read Most Significant Word of second channel
    dummy = I2S0_W1_LSW_R;              // Read Least Significant Word of second channel (ignore)

</syntaxhighlight> to... <syntaxhighlight lang="c">

   /* Read Digital audio inputs */
   while(!(I2S2_IR & RcvR) )
   {
   	counter1++; // Wait for receive interrupt
   }
   *left_input = I2S2_W0_MSW_R;         // Read Most Significant Word of first channel
    dummy = I2S2_W0_LSW_R;              // Read Least Significant Word (ignore)
   *right_input = I2S2_W1_MSW_R;        // Read Most Significant Word of second channel
    dummy = I2S2_W1_LSW_R;              // Read Least Significant Word of second channel (ignore)

</syntaxhighlight>

  • Comment SYS_EXBUSSEL & GPIO configuration in aic3204_hardware_init(void) and aic3204_disable(void)...
    • On the C5505 eZdsp, GPIO 26 is used as reset signal to the AIC3204 codec
    • On the C5535 and C5515 eZdsps, TARGET_PWR_GOOD brings the AIC3204 out of reset

<syntaxhighlight lang="c"> void aic3204_hardware_init(void) {

	SYS_EXBUSSEL |= 0x0020;  // Select A20/GPIO26 as GPIO26

USBSTK5505_GPIO_init(); USBSTK5505_GPIO_setDirection(GPIO26, GPIO_OUT); USBSTK5505_GPIO_setOutput( GPIO26, 1 ); // Take AIC3204 chip out of reset USBSTK5505_I2C_init( ); // Initialize I2C USBSTK5505_wait( 100 ); // Wait }

void aic3204_disable(void) {

   AIC3204_rset( 1, 1 );                   // Reset codec
   USBSTK5505_GPIO_setOutput( GPIO26, 0 ); // Put AIC3204 into reset
   I2S0_CR = 0x00;

} </syntaxhighlight> to... <syntaxhighlight lang="c"> void aic3204_hardware_init(void) { // SYS_EXBUSSEL |= 0x0020; // Select A20/GPIO26 as GPIO26 // USBSTK5505_GPIO_init(); // USBSTK5505_GPIO_setDirection(GPIO26, GPIO_OUT); // USBSTK5505_GPIO_setOutput( GPIO26, 1 ); // Take AIC3204 chip out of reset USBSTK5505_I2C_init( ); // Initialize I2C USBSTK5505_wait( 100 ); // Wait }

void aic3204_disable(void) {

   AIC3204_rset( 1, 1 );                   // Reset codec

// USBSTK5505_GPIO_setOutput( GPIO26, 0 ); // Put AIC3204 into reset

   I2S2_CR = 0x00;

} </syntaxhighlight>

Rebuild the project[edit]
  • With these changes made, rebuild and reload the program. The audio examples should now work with the C5535 eZdsp.

Configuring a Microphone as Input to the C5535 eZdsp[edit]

The teaching ROM software is configured to use either an audio line-input or microphone input from a dynamic microphone. Dynamic microphones differ from PC microphones (electret-based) in that no microphone bias current is required to generate a signal. To use a PC microphone, the AIC3204 CODEC must be configured to output a microphone bias into the microphone.

  • This forum post explains the changes required.
  • The microphone bias is configured in AIC3204 register: Page 1 / Register 51: MICBIAS Configuration Register
  • Copy and paste the following line into the two functions of aic3204_init.c
    • aic3204_init()
    • set_sampling_frequency_and_gain()

<syntaxhighlight lang="c">

   AIC3204_rset( 51, 0x48);  // power up MICBIAS with AVDD (0x40)or LDOIN (0x48)

</syntaxhighlight>

  • The MICBIAS register is on Page 1, so make sure to paste the line after Page 1 has been selected
  • The code with MICBIAS enabled should look like the following:

<syntaxhighlight lang="c">

   /* ADC ROUTING and Power Up */
   AIC3204_rset( 0, 1 );      // Select page 1
   AIC3204_rset( 51, 0x48);  // power up MICBIAS with AVDD (0x40)or LDOIN (0x48)
   AIC3204_rset( 0x34, 0x30 );// STEREO 1 Jack
   ...

</syntaxhighlight>

Adjusting the Microphone gain[edit]

  • Adjust the ADC gain by modifying the #define near the top of main.c:

<syntaxhighlight lang="c">

  1. define GAIN_IN_dB 30

</syntaxhighlight>

Warning Warning: Loud audio may damage your ears when MICBIAS is enabled and GAIN_IN_dB is set to 30.  

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Porting C5000 Teaching ROM to C5535 eZdsp here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Porting C5000 Teaching ROM to C5535 eZdsp here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Porting C5000 Teaching ROM to C5535 eZdsp here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Porting C5000 Teaching ROM to C5535 eZdsp here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Porting C5000 Teaching ROM to C5535 eZdsp here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Porting C5000 Teaching ROM to C5535 eZdsp here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Porting C5000 Teaching ROM to C5535 eZdsp here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Porting C5000 Teaching ROM to C5535 eZdsp here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Porting C5000 Teaching ROM to C5535 eZdsp here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity