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.

C6747 RTS6740.lib Interrupt Restrictions

Using a C6747 for doing some wideband audio signal processing. TI CSS 3.3.82.13 and Code Gen 6.1.19 tools

Having problems using TI supplied RTS6740.lib when running interrupts enabled. When calling floating point

cos/sin function without Interrupt Disable/Enable around cos/sin call (GIE bit in CSR register)  causes

C6747 to crash.  Interrupts are coming at 200HZ rate from timer peripheral on C6747 (TIMER64P1)

Are supplied TI  RTS6740.library functions  interruptable ?? Any option to use alternative C6747 RTS

library , or change CCS build options to make lib functions interruptable ??

Thanks

Tom L.

  • Tom,

    Can you confirm that you don't observe crash when the interrupts are disabled?

    Have you confirmed that the device stack is not getting corrupted?

    have you considered using fastMATH library that should give you significantly improved performance: http://processors.wiki.ti.com/index.php/Software_libraries#fastMath

     

    RTS functions are interruptible and I don't believe there are any reported issues. Please provide the above requested information and we can go from there

    Cheers,
    Gagan 

  • HI Gagan !

    Yes, C6747 processor runs program correctly when Interupts are Disabled around call to double precision

    cos/sin function in TI supplied  RTS6740.lib (C6747 default linker library).   Spent several hours tracking down possible

    bugs ! Yes, I also checked stack and SP pointer  for any corruption and looks OK. Have allocated 0x4000 bytes stack.

    Have majority of program running in C6747 SHAREDRAM area and ISTP service table in L2RAM area at L2RAM

    start  (0x1180000).

     

    When DSP program is running the C6747 TIMER64P1  interrupt occurs every 5ms (200HZ)..  Looks like DSP get stuck in infinite

    loop but still processing 5ms interrupts correctly !   Was wondering if possible software pipelining or FPU exception handling ??

    Program is simple foreground/background task  without any OS..

    Tom

     

     

     

  • HI Gagan

    Also in C6747 Interrupt Service Routine,  I save and Restore AMR, SAT Bit and FPU Adder, Multiplier, and FPU Config Registers

    (FADCR, FAUCR, FMCR) as recommended by TI C6747  Compiler Guide.

    Tom

     

     

     

  • Tom, I'm sorry for your trouble.

    So you are saying that the DSP continues to service interrupts, but seems to be hung in some infinite loop in the main application code. Do you know where that loop is? By looking at the address and the map file you can tell what function the code is stuck in. Does the DSP always hang at the same location?

    How often does the code hang? Is it very easy for the code to hang or does it hang after long time?

    What processing happens in the ISR? Do you call any math functions from the ISR also? 

    Cheers,
    Gagan 

     

     

     

  • HI Gagan !


    Yes, I checked the CCS  6.1.19 tools linker load map and looks like the C6747 PC is pointing to location in the RTS6740.lib

    section called  C$L4: _cos.obj (.text: _cos) every time the DSP gets into infinite loop !  This section contains other blocks like

    _printfi.obj (.text:ecvrt).    C6747 DSP loop appears to occur early when starting to calculate cos function when interuupts are

    turned on.


    Wondering maybe RTS6740.lib file has been corrupted ?? Can I re-build or re-download RTS6740.lib using available CCS 3.3.82.13

    and Code Gen 6.1.19 tool set ?


    Tom

     

     

     

     

     

  • HI Gagan !

     

    I took your suggestion about linking with an alternative math library and tried c674xfastMath.lib.

    instead of default rts6740.lib. Downloaded c674xfastMath.lib from TI web site !

     

    Looks like the c674xfastMath.lib works OK with my 200HZ TIMER64P1 interrupt and does not get

    stuck in a infinite loop in the floating point cosine/sine function ! No crashes or  infinite loops with

    c674xfastMath.lib so far !! Will do externsiev testing to be sure !!

     

    So my question is if both math libraries (rts6740.lib, c674xfastMath.lib)  are designed to be interruptable

    why does c674xfatsMath.lib work OK when rts6740.lib fail ??  Maybe rts6740.lib got corrupted ??

     

    Tom

     

     

     

     

     

     

  •  

    Tom, I'm glad you have a work around now. Please note that the usage of fastMath library is preferable as it will give you much improved performance as well.

    I would be curious to know answer to the questions I had asked earlier:

     

    > What processing happens in the ISR? Do you call any math functions from the ISR also?

     

    I don't believe it is likely that the RTS lib got corrupted. But if you still want to rebuild it, the steps are documented here:

    http://processors.wiki.ti.com/index.php/How_to_rebuild_the_C6000_RTS

     

    Cheers,

    Gagan

     

     

     

  • HI Gagan !

     

    C6747 ISR processing just clears Interrupts flags in all C6747 Registers (Edma3cc, HPI, TIMER64P1) and sets GPIO ON/OFF

    flags ! No math or floating point is used !!

     

    So what is best guess as to why c674xfastMath.lib works OK with interrupts and  rts6740.lib does not ??

     

    Tom

     

     

     

     

     

  • Tom, I'm checking. We may have to develop a simpler example that we can recreate the issue with.
    Please let me know once you have completed your testing and concluded that the fastMath has no issues.

    Cheers,
    Gagan 

  • HI Gagan !

     

    Yes, when I have some time can make a more simple example of RTS6740.lib interrupts looping !

     

    By the way, what is best way to specify loading/searching of c674axastMath.lib over rts6740.lib

    to the Code GenTools 6.1.19 ??

     

    I put  both -i c674xfastMath.lib and -l rts6740.lib in both the linker command files and also in the linker build options

    Otherwise I get a warning message about double defined floating point math functions ??

     

    Tom

  • Tom,

    Putting -l c674xfastMath.lib and -l rts6740.lib  (in that order )in the linker options should suffice while using floating point math functions. If you are using CCSv4, you don`t have to link in the rts6740 library as the project is setup to link into that library by default.

    Regards,

    Rahul

     

  • HI Gagan !


    Yes, I tried that order in the linker command file but needed to set linker option  –priority to allow first floating

    point library to find and use the c674xfastMath functions.


    Otherwise linker will pick up and link in the second library rts6740.lib functions !!

     

    Can also specify order in Build option Linker Tab.  Currently using Linker Tab under Build Options and set priority and

    Library order ! Also need to turn off multiply defined references in  library scan option to avoid getting Warning messages

    after linking !

     

    CCS 3.3.82.13

    Code Gen 6.1.19

     

    Tom

     

    tlofte@clearwire.net

     

  •  

    Thomas,

    In the CCSv3.3 build options under the Linker tab, you can specify the libraries so that the fastMath is specified before rts6740.lib. In general the linker looks for symbols in library from left to right so which ever library you specify first should have the higher priority. Just to verify, check your linker options show that the order of libraries being linked is

    -l"c67xfastMath.lib" -l"rts6740.lib"

    Mentioning the priority like you have done is also the other option that works.

    Regards,

    Rahul

  • Thomas, do you have printf in your ISR? Can you remove that and see if you still see hang?

    Cheers,
    Gagan 

  • Hi Gagan !

     

    Yes,  I did have a debug printf statement in my C6747 ISR but I commented it out because I suspected it might be causing problems !

    Was still getting stuck in rtsl6740.lib  floating point cosine function with printf's commented out !!

    TIMER64P1 interrupts at 200 HZ (5ms)

     

    So far, having no problems using c674xfastMath.lib cos/sine functions as replacement for rts6740.lib cos/sine !

    Enclosing  a PDF copy of my  init_IRQ.c interrupt setup and ISR.

     

    Tom

    tlofte@clearwire.net

     

     

    Tlofte_initIRQ.pdf
  • Thanks so much! Well, I do recommend continuing with fastMath library. We will analyze the issue and get back if we find anything.

    When you get a chance and if you can create a simpler test, please feel free to send our way

    Cheers,
    Gagan 

  • Hi Gagan

     

    Do  not need to send you a simple example after all !!

     

    I found a bug in my assembly language  Interrupt Service Routine Fetch Table (ISR Fetch table).

     

    I was using a register (B0) as an branch address into the actual C coded  interrupt Service Routine and

    was not properly saving and restoring B0 when branching ! I corrected the problem by pushing register

    B0 onto the stack and restoring during the delayed branch. Enclosing PDF copy of assembly program

    istable.asm

     

    I corrected my error and tried both cos/sine routines in both rts6740.lib and c674zfastMath.lib and

    have no more cos/sin infinte loops problems.

     

    Anyway, thanks for your help.

     

    By the way, I have another question regarding the C6747 Memory Protection Unit (MPU)  for the

    EMIF-B control registers. Can I ask the C6747 MPU question here or open a new post ??

     

    Tom

    tlofte@clearwire.net

     

     

     

     

     

    isrtable_asm.pdf
  • Glad the issue is resolved!

    Please start a new thread for the MPU question

     

    Cheers,
    Gagan