Problem in OSA_TimeDelay() - fsl_os_abstraction_bm.c (KSDK 1.3.0)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problem in OSA_TimeDelay() - fsl_os_abstraction_bm.c (KSDK 1.3.0)

1,026件の閲覧回数
derek_ik
Contributor I

Hi,

I found a problem in the OSA_TimeDelay() function defined in "KSDK_1.3.0/platform/osa/src/fsl_os_abstraction_bm.c".

 

void OSA_TimeDelay(uint32_t delay)

{

    uint32_t currTime, timeStart;

 

    timeStart = OSA_TimeGetMsec();

 

    do {

        currTime = OSA_TimeGetMsec(); /* Get current time stamp */

    } while (delay >= OSA_TimeDiff(timeStart, currTime));

}

 

The condition inside the while loop makes the delay always 1 ms greater (because of the equality test) than the parameter passed to the function.

 

timer tick | delay = 3

0          | timeStart = 0

           | 3 >= 0 // true, busy wait

1          | 3 >= 1 // true, busy wait

2          | 3 >= 2 // true, busy wait

3          | 3 >= 3 // true, busy wait

4          | 3 >= 4 // false, exit

 

Instead it should be:

while (delay > OSA_TimeDiff(timeStart, currTime));

 

Best Regards,

Derek

ラベル(1)
タグ(4)
0 件の賞賛
返信
1 返信

688件の閲覧回数
DavidS
NXP Employee
NXP Employee

Hi Derek,

Thank you fro reporting this.

I have submitted it to our KSDK software development team.

It is reported as KPSDK-7957

Regards,

David