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.

TMS320F28388D: DEVICE_DELAY_US() library function not producing actual delay.

Part Number: TMS320F28388D

Tool/software:

DEVICE_DELAY_US() library function not producing actual delay.
We are using CPU1 and CPU2 is disabled.
System clock is running at 200MHz produce from 20MHz external crystal.
#define DEVICE_OSCSRC_FREQ          20000000U
E.g..
we are trying to produce delay of 2500uS but actual produced delay is 4200uS.
Need help to get this resolve.
    GPIO_writePin(RLY_CMD1_PIN,true);
    GPIO_writePin(RLY_CMD2_PIN,true);

    DEVICE_DELAY_US(2500);                                         //2.5msec

    GPIO_writePin(RLY_CMD1_PIN,false);
    GPIO_writePin(RLY_CMD2_PIN,false);
Controller Module : TMS320F28388D
optimization Level is as suggested by optimizer assistant as follows.
I am generating 1ms timer interrupt and that is getting generated properly and can see 1ms periodicity.