RES: ERC32 clock counter incorrect

Wendell Pereira da Silva wendell.silva at compsisnet.com.br
Fri Mar 6 17:52:32 UTC 2009


Yes Manuel. Now I can see. You are right. 

 

Thanks.

Wendell.

 

 

________________________________

De: Manuel Coutinho [mailto:manuel.coutinho at edisoft.pt] 
Enviada em: sexta-feira, 6 de março de 2009 14:47
Para: Wendell Pereira da Silva; rtems-users at rtems.com
Assunto: RE: ERC32 clock counter incorrect

 

Hi

 

The Scalar value is correct, you should subtract one. But on the clock counter as well (counts from 0 to microseconds per tick minus one).

 

I've tested using the GPT timer on ERC32 and it was giving a microsecond in each clock tick.

Using the "-1" patch, it was ok.

 

Look at the same code of the leon2 and leon3 for example, they also subtract one unit.

 

Kind regards

Manuel Coutinho

 

________________________________

From: Wendell Pereira da Silva [mailto:wendell.silva at compsisnet.com.br] 
Sent: Friday, March 06, 2009 5:31 PM
To: Manuel; rtems-users at rtems.com
Subject: RES: ERC32 clock counter incorrect

 

Hi Manuel,

 

Note that -1 is added in ERC32_MEC.Real_Time_Clock_Scalar.

 

#define Clock_driver_support_initialize_hardware() \

  do { \

    /* approximately 1 us per countdown */ \

    ERC32_MEC.Real_Time_Clock_Scalar  = CLOCK_SPEED - 1; \

    ERC32_MEC.Real_Time_Clock_Counter = \

      BSP_Configuration.microseconds_per_tick; \

    \

    ERC32_MEC_Set_Real_Time_Clock_Timer_Control( \

      ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING | \

      ERC32_MEC_TIMER_COUNTER_LOAD_SCALER | \

          ERC32_MEC_TIMER_COUNTER_LOAD_COUNTER \

    ); \

    \

    ERC32_MEC_Set_Real_Time_Clock_Timer_Control( \

      ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING | \

          ERC32_MEC_TIMER_COUNTER_RELOAD_AT_ZERO \

    ); \

  } while (0)

 

I don't think it is a bug. How do you do the verification?

 

Att.

Wendell.

 

________________________________

De: rtems-users-bounces at rtems.org [mailto:rtems-users-bounces at rtems.org] Em nome de Manuel
Enviada em: sexta-feira, 6 de março de 2009 12:30
Para: rtems-users at rtems.com
Assunto: ERC32 clock counter incorrect

 

Hi

 

We have discovered a bug in the ERC32 clock driver (at least for the RTEMS 4.8.0 version).

 

Currently, the RTC counter is being initialized with (on the ckinit.c file)

 

 

ERC32_MEC.Real_Time_Clock_Counter = \

      BSP_Configuration.microseconds_per_tick;

 

 

This way it is adding an extra microsecond for each clock tick.

The correct set value should be

 

ERC32_MEC.Real_Time_Clock_Counter = \

      BSP_Configuration.microseconds_per_tick - 1;

 

 

the other SPARC BSPs (leon2 and leon3) clocks seam ok :)

 

 

Kind regards

Manuel Coutinho

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20090306/8f341f46/attachment-0001.html>


More information about the users mailing list