This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Generate Sine Wave with C6748 LCDK

Other Parts Discussed in Thread: TMS320C6748, SYSCONFIG, OMAP-L138

Hi,

 

I'm using TMS320C6748 LCDK with xds100 v2 emulator to do some applications by using the book "Digital Signal Processing and Applications with the OMAP-L138 eXperimenter".

From the forum I know that "The textbook is compatible not only with the LogicPD OMAP-L138 eXperimenter but also with both the OMAP-L138 LCDK and the C6748 LCDK.". 

 

I try to generate sine wave by using the code in Chapter 1, which is as follows

 

// L138_sine48_buf_intr.c //

#include "L138_aic3106_init.h"

#define LOOPLENGTH 48

#define BUFLENGTH 256

int16_t sine_table[LOOPLENGTH] =   {0, 1305, 2588, 3827, 5000, 6088, 7071, 7934,    8660, 9239, 9659, 9914, 10000, 9914, 9659, 9239,    8660, 7934, 7071, 6088, 5000, 3827, 2588, 1305,    0, -1305, -2588, -3827, -5000, -6088, -7071, -7934,    -8660, -9239, -9659, -9914, -10000, -9914, -9659, -9239,    -8660, -7934, -7071, -6088, -5000, -3827, -2588, -1305};

int16_t sine_ptr = 0; // pointer into lookup table

int32_t buffer[BUFLENGTH];

int16_t buf_ptr = 0;

interrupt void interrupt4(void) // interrupt service routine {

  int16_t sample;

  sample = sine_table[sine_ptr];       // read sample from table

  output_left_sample(sample);          // output sample

  sine_ptr = (sine_ptr+1)%LOOPLENGTH;  // increment table index

  buffer[buf_ptr] = (int32_t)(sample); // store sample in buffer

  buf_ptr = (buf_ptr+1)%BUFLENGTH;     // increment buffer index  

  return;

}

int main(void) {  

 L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB);

  while(1);

}

After I debugged the project, it says that

C674X_0: Output:  Target Connected.

C674X_0: Output:  Memory Map Cleared.

C674X_0: Output:  Memory Map Setup Complete.

C674X_0: Output:  PSC Enable Complete.

C674X_0: Output:  PLL0 init done for Core:300MHz, EMIFA:25MHz C674X_0: Output:  DDR initialization is in progress....

C674X_0: Output:  PLL1 init done for DDR:150MHz C

674X_0: Output:  Using DDR2 settings

C674X_0: Output:  DDR2 init for 150 MHz is done

C674X_0: Output:  DSP Wake Complete.

 

So I think that the configuration is correct.

When I run the c-code, the values in "sine_table"(16 bit signed integer) are correct, however, the values in the "buffer"(32 bit signed integer) which are for the output are wrong, i.e., the waveform is not sine.

In addition, I can't hear any sound from the output of the C6748 LCDK by earphoe.

Is it associated with the DIP switch or other settings, since I can generate and see the sine wave by C code only in simulation with CCS5, i.e., without using anything related to the C6748 LDCK?

Thanks.

 

Best regards,

PP

  • Hi PP,

    I'm the author of the book. Have you downloaded the files for the LCDK from the Wiley ftp site? There are different files there for the eXperimenter and for the LCDK. Because of differences between the LCDK and eXperimenter boards, the low level support files for the two boards are different.

    Bear with me while I try and talk you through getting the program example L138_sine48_buf_intr.c to work. There _is_ a minor mistake in the source file supplied for the LCDK on the ftp site.

    As I've mentioned already, make sure that you've downloaded the LCDK version of the files from the ftp site. LCDK_files_CCSv5.zip There are some notes on using the LCDK here

    http://e2e.ti.com/group/universityprogram/educators/f/776/t/223997.aspx

    Two important differences between the LCDK and the eXperimenter are that

    i) they use different McASP serializers (and hardware pins) to connect to the AIC3106 codec and so the eXperimenter code might run on the LCDK but the codec will not be operating. The slightly different support files supplied for the LCDK take care of this while the top level program examples are almost unchanged from those listed in the pages of the book. So, what is the minor difference between program example listings, e.g. L138_loop_intr.c, for the LCDK and for the eXperimenter? Well, one slight difference is that at the top of the listings, header file L138_LCDK_aic3106_init.h is included in place of L138_aic3106_init.h. The other difference is in the initialisation functions, e.g L138_initialise_intr() and this relates to the second difference 

    ii) the LCDK offers the opportunity to use either  the MIC or LINE IN inputs on the AIC3106. This is reflected in the use (on the LCDK) of a modified version of function L138_initialise_intr() that accepts an extra fourth parameter, e.g. LCDK_LINE_INPUT that selects the AIC3106 input to be used.

    The minor mistake in the LCDK files supplied (that affects only the example you're using) is that the supplied version of L138_sine48_buf_intr.c has not had the fourth parameter added.

    The line in L138_sine48_buf_intr.c as supplied

    L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB);

    should be

    L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT );

    Until you make this change, you will get a compiler error.

    Hope this makes some sense. Please let me know how you get on and feel free to ask me mor equestions.

     

    Regards,

     

    Donald

  • Hi,

    Did my previous reply help you to get the program working? To summarise that post, in order to get the program running on the LCDK, you need to download LCDK_files_CCSv5.zip from the Wiley ftp site and (only) in the case of program L138_sine48_buf_intr.c you need to edit the C source file so that

    #include "L138_aic3106_init.h"

    becomes

    #include "L138_LCDK_aic3106_init.h"

    and

    L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB);

    becomes

    L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);

    These edits are not required in any other program examples.

    Regards,

    Donald

  • Hi, Donald,

     

    Thanks for your reply.

    I have done as you said: changing the some of the code in 'L138_sine48_buf_intr.c' into

     

    #include "L138_LCDK_aic3106_init.h"

    L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);

     

    The files in the project include:

    evmomapl138_aic3106.h

    evmomapl138_gpio.h

    evmomapl138_i2c.h

    evmomapl138_mcasp.h

    evmomapl138_pll.h

    evmomapl138_psc.h

    evmomapl138_sysconfig.h

    evmomapl138_timer.h

    evmomapl138.h

    L138_LCDK_aic3106_init.c

    L138_LCDK_aic3106_init.h

    L138_sine_buf_intr.c

    linker_dsp.cmd

    types.h

    vectors_intr.asm

    evmomapl138_bsl.lib

    L138_eXperimenter_v2_ccxml

    OMAP-L138_LCDK.gel

     

    Again, the console says that "DSP Wake Complete".

     

    However, the outputs of the buffer are still very large values, not a sine wave.

    The dip switches in C6748 LCDK are set as 'off' from 1 to 4 and 'on' from 5 to 8.

    I would like to know whether the setting of dip switch is associated with the C6748 LCDK performance to generate sine wave.

     

    In addition, I also tried to use the eXperimenter_files_CCS5 to generate sine wave (in Chapter 1).

    In the morning, I have seen the sine-wave in the Graph tool. However, in the afternoon no correct results show, which makes me feel that the C6748 LCDK or my computer does not work steadily.

     

     

    By the way, as you mentioned in last reply, I have tried the code L138_sine48_intr.c in Chapter2.

    However, I don't know how to check the output by neither oscilloscope nor Goldwave.

    Should we use the line_output or the pins named JP1 to JP4?

     

    Thanks.

     

    Best regards,

    PP

  • Hi PP,

    You say that you have used the files  eXperimenter_files_CCS5. These are for the eXperimenter and will not work for the LCDK.

    Some of the filenames that you list are from LCDK_files_CCSv5.zip but it is possible (?) that you have a mixture of eXperimenter and LCDK files on your system.

    My suggestion would be to make sure that you start from scratch, without any eXperimenter files on your system and copy the files from LCDK_files_CCSv5.zip into c:\LCDK afresh.

    As far as I remember, the DIP switch settings on the LCDK are unimportant for this activity. The sine wave output should be from the LINE OUT 3.5mm jack socket.You should be able to hear the sine wave by plugging headphones into the LINE out socket.

    Hope this helps.

     

    Regards,

     

    Donald

  • Hi, Donald,

    Thanks for the reply.

    I can generate sine wave by your code on LCDK, and can hear it by headphone.

    However, I have to say that I have not done any change of the setting as shown in my last email.

    The code did not work yesterday, but works today.

     

    Another problem is that the sine wave is not continuous, as shown below. I also find this problem in figure 2.58 in your book.

    Thanks!

     

    Best regards,

    Zixiong

  • Hi,

    Glad to hear that you got the program running. The graph is correct. The discontinuity in the curve corresponds to the value of buf_ptr when you halted the program. The most recent 256 output sample values are stored in the array buffer. One cycle of the sine wave contains 48 samples and 256 is not an integer multiple of 48.

    Regards,

    Donald

  • Thanks, Donald!

     

    PP

  • Hi,

    i have to make the same project. But i muss include SYNC /Bios to the Projekt.

    I don't know how i can do it.

    what will i add or Change? Where can i find the code-example

    Thank for your Help.(sorry for my bad Englich ,i 'm a French-people)

    Regards,

    Miriane.

  • I'm using OMAP-L138 to generate  sine Wave. I have to include SYNC/BIOS to the project i find in the Book. OMAP-L138 eXperimenter.

    has someone already  did something like?

    Thanks for your Help.

    Miriane

  • Hi Miriane,

    I'm sorry, I don't really understand your question. By SYNC/BIOS, do you mean SYS/BIOS?

    Conceptually, chapter 7 of the book describes how to adapt the program examples in earlier chapters to run under SYS/BIOS. As newer versions of SYS/BIOS are released, the exact details of implementation may change slightly. The book describes how to use the OMAP-L138 eXperimenter - again, while the concepts remain similar, the precise details of how to use SYS/BIOS with the LCDK may be slightly different.

    Donald

  • Hi Donald Sir, 

                            I have problem on OMAP L138 LCDK , I want to do image processing application on the kit, 

        i am doing project on Navigation System for blind person in which we are trying to make a standalone device which can be helpful for navigation of  blind person, in the project we are interfacing camera for recognizing the object that what type of object is there and using ultrasonic sensor for finding the distance of that object, and the audio is given through earphone which is prerecorded sound in the SD Card. So sir for doing this project i have read many documents given in the website and your book also but i am not able to know that how to do image processing application with the help of code composer studio,, and how to interface ultrasonic sensor from this kit,, For doing our project we are getting many difficulties in the omap l138 lcdk kit,  Sir please help us and sir can you give me your email id my email id is maruttripathi@ymail.com 
     
  • Hi Donald,

    Thank for your reply, sorry i mean  SYS/BIOS it was a mistake.

    The problem is my professor  didn't  want me to use the example on the book with Interrupt. He want me do something different. i don't have a idea. I'm already look after some Example , but i did'nt find  someone.

    Regards.

    Miriane

     

  • Hi Donald,

    Can you provide the link for the Wiley ftp website?

    I am using the OMAP-LCDK with your book Digital Signal Processing. But I cannot get any of your program(codes) to run with CCS v.6 on the LCDK. I just read on the TI forum that you mentioned something about wiley ftp. Can you please provide more details about it?

  • Hi Sandra,

    The ftp site is

    ftp://ftp.wiley.com/sci_tech_med/signal_processing/

    as noted on page 5 of the OMAP-L138 book. I am wondering, since you say that you cannot get the program code to work with CCSv5 and LCDK, did you get the program code to work with CCSv5 and either eXperimenter or LCDK?

    Also, you don't give much indication of what is going wrong. 

    I have not actually used CCSv6 but if you could be more specific about you problem I ight be able to help.

    Regards,

    Donald

  • I'm sorry, I mistyped Sadrac.

    Regards,

    Donald

  • Dear Donald, 

    Thanks for your feedback.

    First, I now downloaded CCS v5.5 and followed exactly the tutorials  which is in the rt_dsp website. I get stocked at the very first basics steps. When I tried to build the project in CCS, I keep getting a bunch of errors. For example, I got the following when I compiled the program.

    " Could not open source files type.h"

    Please let me know.

    Regards

  • Hi Donald,

    I am working on the same program and able to build it successfully. I tried to run but it is not going to interrupt loop. Do i have to update/ change the code anywhere in the project.

  • sir , 

    can you tell me where to download the following header files as mentioned in the post?

    evmomapl138_aic3106.h

    evmomapl138_gpio.h

    evmomapl138_i2c.h

    evmomapl138_mcasp.h

    evmomapl138_pll.h

    evmomapl138_psc.h

    evmomapl138_sysconfig.h

    evmomapl138_timer.h

    evmomapl138.h

    L138_LCDK_aic3106_init.c

    L138_LCDK_aic3106_init.h

    L138_sine_buf_intr.c

    thanks in advance,