RISCV-on-Microsemi-FPGA / FreeRTOS

FreeRTOS for RISC-V
25 stars 12 forks source link

Problem with the actual timing for Polarfire Evaluation kit #16

Closed BhuvaHiren closed 5 years ago

BhuvaHiren commented 5 years ago

I am using 50Mhz as the configCPU_CLOCK_HZ and for configTICK_RATE_HZ i am using 100Hz but for this configurations also it takes 10 sec to timeout for a 100 tick timer

AntonKrug commented 5 years ago

To rule out design/clocking issue, can you run simple blinky example and confirm its frequency is as expected?

BhuvaHiren commented 5 years ago

Hi AntonKrug,

Thanks for reply, As you said, I tried miv-rv32im-systick-blinky example with same frequency and it is working as expected. but, when i try same using freeRTOS it is taking more time which is 100 times then the actual.

nitindeshpande commented 5 years ago

Thanks BhuvaHiren, There is a bug in the port.c. Need to consider the hardware pre-scalar in the port.c. Below lines in port.c time += (configCPU_CLOCK_HZ / configTICK_RATE_HZ); should be replaced with time += (configCPU_CLOCK_HZ / (configTICK_RATE_HZ *100) );

This would give you the correct time. Will update the source code soon.

Regards, Nitin

BhuvaHiren commented 5 years ago

Hi Nitin,

Thanks for the solution. want to know is this RTC_PRESCALER macro?

nitindeshpande commented 5 years ago

Yes, It is.

BhuvaHiren commented 5 years ago

okay