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.

DSPLib \ Error function atan2dp

Other Parts Discussed in Thread: MATHLIB

Hello,

i am using DSPLib librairie. I have a problem with function "atan2dp" (my application crashes when some specifics values are passed : at that time, i do not know this value). When i replace the DSPLib with the standard library, everything work fine.... :(
I was thinking about a bug in the DSPLib, so i used the latest c67xmathlib_2_01_00_00 library --> same problem...

Question: is there any know bug the the DSPLib ? Is someone already encounter this kind of problem ?

  • Sebastien,

    Someone recently reported a potential calculation error with atan2dp. You can search the forum for atan2dp and find this recent thread. But that was a case of an incorrect value being used inside the program, nothing about a crash.

    We will need to have much more information to help you determine the problem. But crashes are rarely due to logic or calculation errors in a subroutine, and this function has been around for quite a while.

    The most common cause for crashes is stack overflow, but there are definitely cases of interrupts occurring at just the wrong place or such. For a first test, please increase your stack size by doubling it or some other large amount to rule that out.

    Please describe the nature of the crash. What are the symptoms? How do you recognize that something bad has happened? Is this while running under emulation/CCS control or in a standalone Flash-based application?

    Since you have determined that the crash occurs (only?) when a specific set of values are passed, how can you determine those values? Or do you already know a range of those values? If you put in code that scales the values in some way to avoid those specific values, will that prevent the crash from happening?

    Regards,
    RandyP
  • RandyP said:
    Someone recently reported a potential calculation error with atan2dp. You can search the forum for atan2dp and find this recent thread. But that was a case of an incorrect value being used inside the program, nothing about a crash.

    Given the analysis of the bug in that recent report, no scenario is out of reach, including crash. Once again, atan2dp writes certain value at location pointed by A0. If A0 happens to point at user data, user might get wrong result. But if it happens to point at stack, it will corrupt stack. If it happens to point at code, it will corrupt code. If it happens to point at memory allocator structure, it will cause trouble moment you call it, allocator, again. It was said that providing C code example is unreasonable, but it doesn't mean that providing code example in assembly is not. In assembly you can choose what kind of crash you want to trigger, including whatever kind of crash we are talking about here.

  • Hello,

    think you for support me. I think your are right, it might be a problem of stack overflow or interrupt.

    The nature of the crash: My application (C6713 225 Mhz) is running on the target board (no emulation/CCS control). It contains a thread "A" which periodically send out some traces (and other kind of messages). This is how application exchange with external world. Another thread "B" makes calculation (using atan2dp) and send results to thread "A".
    I have found the problem when commenting the line with "atan2dp" make the problem disappeared. Using FastRTS library, no more message can be seen from external (the thread "A" stop running). That happens every time at the same moment in the execution of the code. Removing FastRTS for standard library and everything work fine everytime.

    I will verify that it is not a stack overflow at first (but i think stack size is enough).
    I am interested of understand the link between Interrupt and atan2dp. Is there some difference between the FastRTS and standard math function must be used ? Do i need to disable interrupt before calling a FastRTS math function ? There is no information about that in spru100a.pdf.

    Sebastien
  • Sebastien,

    It will be easiest for you to find the problem if you can use an emulator through CCS to set breakpoints and observe registers & memory contents. If I understand correctly, your only means of observing the DSP's progress/status are through the reading of messages send from thread "A" or from other similar messages, basically through printf's. CCS gives you a lot of additional capability. Depending on the nature of your application, you may be able to plug in the emulator and wait until the board has powered up and started running before doing the Target Connect step which will likely stop the processor - you can resume its running as soon as you gain control. This works for most applications.

    Sebastien ROLLE19 said:
    Removing FastRTS for standard library and everything work fine everytime.

    You mention FastRTS and Mathlib and standard library. Could you list the results when using each of these, please. I want to be sure I am not getting confused by it.

    Sebastien ROLLE19 said:
    That happens every time at the same moment in the execution of the code.

    What do you observe that leads you to this statement? Do full messages come out in each case, even when the crash occurs? What is the message medium, UART or other? What speed is that medium running?

    Is "the same moment" relative to something occurring external to the DSP, some external event like a switch setting or a signal variation?

    Is there a way to detect that moment in your code, such as by monitoring / testing the input values? I am not sure what to ask here, since you have not described the application.

    Sebastien ROLLE19 said:
    I have found the problem when commenting the line with "atan2dp" make the problem disappeared.

    An alternative to comment the line with "atan2dp" would be to force its input variable to be specific numbers that do not change, and see if calling the function is part of the problem or the particular values passed.

    Regards,
    RandyP

  • Thank for information. I do not have an emulator :(

    concerning the interrupt and the use of FastRTS function : do i need to disable interrupt (interrupt-tolerant) before calling FastRTS function ?

  • Sebastien,

    Most likely, you do not need to disable interrupts before calling these functions. If they need protection, they will generally provide that internally. But for a test, you can try disabling interrupts before and enabling interrupts after you call to atan2dp. I would do that as a test to at least eliminate that possibility.

    You need an emulator. You can get one for under $100, but you will want to do a search to make sure the version of emulator pod you select is compatible with CCS. And I recommend CCSv6 which is the latest version. You can ask about emulators separately on the Code Composer Forum and search E2E and the TI Wiki Pages for compatibility.

    Does you board have a connector or a place to add a connector for the JTAG access? Is this an existing product your company is selling, or a new product, or a side project or a learning project?

    If you will please address the other questions, we can evaluate more of your situation.

    Regards,
    RandyP

  • Thank for all. 

    I will look for an emulator. This is a product my compagny is selling.

    Sebastien

  • Sebastien,

    I did a quick search through CCS's selection of emulators to check for compatibility for the C6713. Unfortunately, none of the recent low-cost XDS100 or XDS200 emulators have drivers for the C6713 in my installation; I am pretty sure my installation is up-to-date.

    You can check with One of the XDS200 vendors (Spectrum Digital?) to see if they offer drivers for CCSv6, but it is not likely. Or there may be some searches on E2E that would show you some informative results.

    The emulator that appears to work is the XDS560v2 which is the leadership emulator with the best performance and broadest support. They can be bought through the TI eStore or directly from the vendors, or through authorized distributors. Blackhawk had the first one on the market, and Spectrum Digital is the one I use, but I have no preference.

    If you want to work through the debug process on the forum while waiting for the emulator, please provide some more information like what I have asked about above. Remote debug is not easy, so it requires a lot of specific information and sharing of the application process.

    Regards,
    RandyP