The STM module of the RTD 2.0.0 (S32K3_RTD_2_0_0_D2203_ASR_REL_4_4_REV_0000_20220331) for S32K3xx does not contain any requirements regarding thread safety.
However, the implemention of the Stm_Ip_StartCounting is not thread safe! Next to that, it fails for small wait times for the same reason:
When the currentCntValue is obtained and an interrupt occurs the counter continuous on the background. The compare value is then set to the "old" currentCntValue + the request wait time. When the counter has already advanced past this compare value we'll have to wait a complete counter wrap before the compare value is reached. This causes the function to faile for small wait times and in case of interrupts happening during the function execution.
A new implementation and/or interrupt disabling is required in my opinion.
Hello @joohau
Thank you for your report. I agree that the process should be improved. I created a ticket for the team to investigate: ARTD-55075.
Best Regards,
Nam