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.

CLAln Function not working in TMS320F28035

Other Parts Discussed in Thread: TMS320F28035

Hi,

I'm using TMS320F28035 controller for one of my application.
We use CLA for floating point mathamatical operation. Simple mathamatical operations are working OK but CLAln function not working.
CLAln function returns value -2.181966e+17 irrespective of argument passed.
I've included "CLAmath.h" V4.00.01.00 and cla0_math_library.lib.

Regards,
Bhavin Joshi

  • Hi Bhavin,

    Are you getting any warnings when you build the project. Suggest you run a clean before the build.

  • Hi Vishal,

    I always clean project before download to DSP.
    I also find table copied in RAM and FLASH for CLAln.
    The strange is that CLAsqrt function working in the same file.

    I've included "CLAmath.h" V4.00.01.00 and cla0_math_library.lib. Is correct one for TMS320F28035, CLA0 ?

    Thanks & Regards,
    Bhavin Joshi
  • Amtech said:
    I've included "CLAmath.h" V4.00.01.00 and cla0_math_library.lib. Is correct one for TMS320F28035, CLA0 ?

    Yes, cla0 is the correct library for the 28035.

    Amtech said:
    The strange is that CLAsqrt function working in the same file.

    the square root function does not rely on any tables while the Ln does. I would check to see that the table values in memory are correct. You can look up the locations of the Ln table symbols in the .map file, view those locations in the memory browser and compare them against the values listed in source/CLAlnTable.asm

    You are looking for these symbols

     _CLALNV2
     _CLALNVe
     _CLALNV10
     _CLABIAS
     _CLALN_TABLE_MASK1
     _CLALN_TABLE_MASK2
     _CLALnTable
     _CLALnTableEnd
    

  • Hi Vishal,

    As per your suggestion, We  looked up the locations of the Ln table symbols in the .map file, seen those locations in the memory browser and compared them against the values listed in source/CLAlnTable.asm.

    We observed that the values at memory location of CLAln table are not same as source/CLAlnTable.asm.

    This .map file and memory browser of my project are attached.

    How to resolve this issue?

    Thanks & Regards,

    Bhavin Joshi

  • Hi Bhavin,

    There are a couple things to check, you are allocating the tables to RAML2 so make sure this is configured for CLA ownership in the MMEMCFG register. 

    Now, if you are running in standalone mode, you need to load the Cla1MathTables section to FLASH and then memcpy to RAMLS2 at run time. So in the linker command file the section description would look like this:

       CLA1mathTables	   : LOAD = FLASHB,
                             RUN = RAMLS2,
                             LOAD_START(_CLA1mathTablesLoadStart),
                             LOAD_SIZE(_CLA1mathTablesLoadSize),
                             RUN_START(_CLA1mathTablesRunStart),
                             PAGE = 1

    in your main.c you need to declare the linker variables as extern and then use them in the memcpy

    extern uint16_t CLA1mathTablesRunStart, CLA1mathTablesLoadStart, 
    CLA1mathTablesLoadSize;
    
        // Copy CLA math tabes from flash to RAM
           memcpy(&CLA1mathTablesRunStart, &CLA1mathTablesLoadStart, 
           (Uint32)&CLA1mathTablesLoadSize);

  • Hi Vishal,

    Thanks for your support.
    Now it's working fine after implementing your suggestion of memcopy.

    For my information, what is standalone mode ?

    One suggestion for CCS that supported libraries like math.lib, cla math, IQ math etc. should be directly linked to project after selecting DSP.

    Thanks and Regards,
    Bhavin Joshi
  • Amtech said:
    For my information, what is standalone mode ?

    standalone is when you dont have the emulator connected. When you power cycle the device, the boot code will cause the reset to go to FLASH instead of RAM (when you have the emulator connected). So anything that the CLA needs ought to be in FLASH on power up, and then copied to their "run" location in RAM during your device setup phase - this includes CLA code (Cla1Prog), constants (.econst), and initialized sections (like Cla1MathTables).

  • Hi Vishal,

    This is quite helpful. I have experienced some issues of CLA math on 28377 Delfino. The header file and .lin are both set up correctly. However, we see no results on CLAln and CLAexp. We actually see the functions being called. But the results are zero for some reason. BTW, CLAdiv is working fine.

    Any idea about this?

    Thanks
    Jianwu