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.

TMS320F280039C: Not able to achieve 1microsecond task using timer interrupt.

Part Number: TMS320F280039C
Other Parts Discussed in Thread: SYSCONFIG, UNIFLASH, C2000WARE

I'm attempting to toggle a GPIO pin 31 using a timer interrupt with a specified tick time of 1 microsecond. However, when measuring the output, I'm observing a tick time of approximately 1.505 microseconds. Can anyone provide insights into why I'm experiencing this discrepancy and suggest possible solutions?

FIG 1. CPUTIMER1 sysconfig configuration with time prescaler 0 and timer interrupt 120 according to calculation for tick time of 1 microsecond.

FIG. 2 Toggling pin 31 in CPUTIMER1_ISR.

fig 3. Toggle pin output is highlighted above in the fig. where the desired O/P is 1microsecond and actual is 1.505microsecond.

  • Hello Tejas,

    Are you running the program from RAM? Have you tried running this program in release mode instead of a debug session? Also try turning your optimizations on in the Project Properties (it will be difficult to read variables/expressions in the debug session, but you should be able to run the code properly).

    Best regards,

    Omer Amir

  • Hello Omer,

    I tried running this program by flashing it on microcontroller using UniFlash Programming Tool but still getting the same results.
    Optimizations are not in use as the project is in development phase.
    According to calculations I am able to achieve desired tick count >= 1.5 microseconds but 1.5 microseconds being the threshold I am unable to achieve desired tick from 1.4 microsecond and below.

  • I tried running this program by flashing it on microcontroller using UniFlash Programming Tool but still getting the same results.

    I recommend running this code from RAM, or at least copying your application code from Flash to RAM. The Flash requires wait states to execute program code from it, so there will inherently be longer execution times for doing something even as simple as toggling a GPIO. If you still see a problem when executing from RAM, let me know.

  • Hello,

    We tried running code from RAM, and we are getting our expected output.

    But out of curiosity, I want to know that if it really takes too much time to load from flash to RAM?
    why delta is this? (getting 1.5us instead of 1us in FLASH mode).

    Is there mentioned in manual or document?

    Regards,
    Mohit

  • But out of curiosity, I want to know that if it really takes too much time to load from flash to RAM?

    If you mean you want to load from Flash to RAM, you can do this very simply (you can follow some of the Flash examples provided in C2000Ware). But if you're asking why we don't do it by default, this is more of something that depends on the customer; some customers want to execute from Flash because if the device loses power, the program can still execute when powered on without having to worry about spending time copying memory over. It really just depends on preference, although I highly recommend programming to Flash and then loading functions/application to RAM for speed benefits.

    why delta is this? (getting 1.5us instead of 1us in FLASH mode).

    Is there mentioned in manual or document?

    Flash is slow to access, this is a fairly universal concept. However, our devices run much faster than the Flash operates, so wait states are introduced to properly access data. This is indeed documented in the device's datasheet (for all devices). For the F28003x: