Tool/software: Code Composer Studio
I don't know if this has been reported yet, but I have found a bug causing overflows in rtiGetCurrentTick().
This is the function:
uint32 rtiGetCurrentTick(uint32 compare) { uint32 tick; uint32 counter = ((rtiREG1->COMPCTRL & (uint32)((uint32)1U << (compare << 2U))) != 0U ) ? 1U : 0U; uint32 RTI_CNT_FRCx = rtiREG1->CNT[counter].FRCx; uint32 RTI_CMP_COMPx = rtiREG1->CMP[compare].COMPx; uint32 RTI_CMP_UDCPx = rtiREG1->CMP[compare].UDCPx; /* USER CODE BEGIN (27) */ /* USER CODE END */ tick = RTI_CNT_FRCx - (RTI_CMP_COMPx - RTI_CMP_UDCPx); /** @note The function rtiInit has to be called before this function can be used. */ /* USER CODE BEGIN (28) */ /* USER CODE END */ return tick; }
The problem is with synchronization, and occurs between reading the FRC register into RTI_CNT_FRCx, and the COMP register into RTI_CMP_COMPx. If between these two events, the value of the register FRC increases and reaches COMP, the value of RTI_CMP_COMPx will hold the new, increased value. But RTI_CNT_FRCx will still hold the value of FRC before the increase. And this causes the overflow in the row with the calculation of the return value of the function.
Thank you for reading!