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.

CCS/TMS320F28377S: Troubleshooting CLA aTan2

Part Number: TMS320F28377S
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

I've been trying to implement a function call to CLAatan2() and am having a difficult time figuring out why it only ever returns the value 0.0. The example atan2PU from the CLAmath folder seems to work properly, however.

The CLA task is triggered successfully and executes the code contained in the Cla1Task1 interrupt. I first thought that I had an issue with the CLAmath library, but other functions such as sin and cos behave as expected. My next thought was that there was something wrong with aTan2 in particular because it uses a table loaded in ROM (my MCU is revision C, which the TRM leads me to believe contains this feature). However, the function CLAexp() also uses a table and executes successfully. The function CLAexp2() does not, always returning 1.0, which leads me back to the idea that there is an issue with the table (since the expansion of exp has a 1 prior to anything that would come from a table).

When I open a memory viewer and look at the CLAatan2Table, it's full of zeros, but this is also true when I am running the example or if I use the function CLAasin(), which both yield correct values.

I am using the library from C2000Ware, so I think that it is up to date (v4.02.00.00). Does anybody know if there is something about the arctangent functions that is easy to get tripped up on, or is it more likely that I just have an error in, e.g. linker settings that would cause some of the trig functions to behave differently than others? 

Additionally, should I expect non zero values when looking at the memory viewer for the table in question?

Any insight would be appreciated, thanks.

  • Can you confirm that the data section used by the CLA task is loaded into a RAM LSx memory that has been assigned to the CLA and as a data RAM block? Can you confirm that the program is loaded in a RAM LSx memory that has been assigned to the CLA and as a program RAM block?

    What memory address are you using to try to view the ROM contents? I think in order to get the contents to show up on the memory browser, you need to use the C28x memory address while connected to the CLA and clicking on the CLA in the Debug window.

    sal
  • Hi Sal,

    I can confirm that there is data in the memory allocated to RAMLS4, which is what I have configured CLA to be the master and set to be a program block. Using the address from the .map file with the memory browser window in CCS, the same number of space that is indicated as "used" does have data (I don't know how to confirm that this data is what's supposed to be there).

    I have RAMLS1-2 configured as data blocks, but there is nothing currently in them because I have simply been putting hard-coded numbers (or sometimes ADC register reads) into the function for debugging.

    For the table, I have been using the address found (0xf876) in the .map file (which is the same that comes up if searching the memory browser for the table name). This is my first attempt at debugging the CLA, so I'm not 100% sure I'm even doing that right, but I can connect to the CLA and type the same address back into the memory browser, but it still contains zeros.

    I also tried changing the C2000 Linker File Search Path includes to use the 'cla1_math_library_fpu32.lib' (without the data ROM) so that the table would be loaded into RAM (0xa0ea). This does indeed lead the memory at that address to contain what looks like the correct table. Despite this, the variable that I am putting the result of CLAatan2PU (present in 'Cla1ToCpuMsgRAM') into just reads 0.

    Thanks for the reply, if I figure out anything else useful, I'll let you know.

    Mike
  • Is your project loading to flash at all? CCS does not guarantee all sections get loaded if your .out uses RAM and flash.

    sal
  • Hi Sal,

    Thanks again for the help. After realizing how fast the trigonometric math unit, I've decided not to use the CLA. I am pretty certain that the problems I was having were due to careless linker settings on my part.

    Mike
  • Good to know you got it resolved.

    sal