Hi Vlado, 

thanks for the mail it helped a lot. I implemented this the following way like 
described but the TimerMilli was doing random periodes. For example I tried to 
get a fire every 1ms and I got it for every 700us. I think my  HPL works fine, 
because if I use the HPL component as separate I can get correct fire events. 
But when I go through all the transformation it behaves strange. 

For sure I am doing something wrong. Just to make sure I underestand you right, 
could you please confirm my steps? 

Steps:

- I create a HPL for the timer where 1 tick has 1/16=0,0625us
- I provide an alarm, counter interface in HPL following way 
               provides interface Counter< TMicro, uint16_t> as Counter
               provides interface Alarm< TMicro, uint16_t> as Alarm[ uint8_t id 
];
- the counter signalises overflow in 4.096ms = (65536 ticks)
- the alarm is implemented using the compare register, and the fire event is 
the compare match with the counter
- I transform the counter to 32bit 1ms counter following way, 2^14 ticks = 
16384 * 0.0625 = 1024 which is aprox. 1ms

CounterMilli32C.nc:
    components CounterMicro16C as CounterFrom;
    components new 
TransformCounterC(TMilli,uint32_t,TMicro,uint16_t,14,uint32_t) as Transform;


  Counter = Transform.Counter;

  Transform.CounterFrom -> CounterFrom;


- I transform the alarm to 32bit 1ms counter following way, 14: 2^14 ticks = 
16384 * 0.0625 = 1024 which is aprox. 1ms
AlarmMilli32C.nc:
  components new AlarmMicro16C() as AlarmFrom;
  components CounterMilli32C as Counter;
  components new TransformAlarmC(TMilli,uint32_t,TMicro,uint16_t,14) as 
Transform;

   Init = AlarmFrom;
   Alarm = Transform;
   Transform.AlarmFrom -> AlarmFrom;
   Transform.Counter -> Counter;


- I provide both AlarmMilli32C and CounterMilli32C to HilTimerMilliC.nc so I 
can use the TimerMilli interface for timing:
HilTimerMilliC.nc:
components new AlarmMilli32C();
components new AlarmToTimerC(TMilli);
components new VirtualizeTimerC(TMilli,uniqueCount(UQ_TIMER_MILLI));

Init = AlarmMilli32C;
TimerMilli = VirtualizeTimerC;

VirtualizeTimerC.TimerFrom -> AlarmToTimerC;
AlarmToTimerC.Alarm -> AlarmMilli32C;


Thank you very much for the help, 
greetings
Attila



________________________________
From: Vlado Handziski <[email protected]>
To: Attila Strba <[email protected]>
Cc: [email protected]
Sent: Tue, March 16, 2010 3:46:07 AM
Subject: Re: [Tinyos-help] Timer precision problem during proting to platform


On Sun, Mar 14, 2010 at 23:50, Attila Strba <[email protected]> wrote:

>
>Hi Guys,
>
>
>>I am trying to port the TinyOS to the Dolphin EO3000I chip from EnOcean and I 
>>have a poblem with the Timer precission.
>
>>As I read from the TEP 102, it is written that the HLP timer interface should 
>>provide either 32kHz or 1ms or 1us tick precision. The Dolphin runs on 16MHz 
>>clock. The Timer0 I am trying to use is 16bit, uses the same clock source and 
>>it has the possibility to use either 2,4,8 prescaler. But that's all, so in 
>>best case using prescaler 8 I would get 0.5us pro 1 tick.
>
>
>

The TEP 102 is only specifying how the HIL _must_ look, and provides examples 
how the lib/timer components can be used to build a flexible HAL layer. The HPL 
component interfaces are fully driven by the hardware characteristics, so you 
can do whatever you like there. 
 
>My question is what to do with this? I am far away from the values TEP102 
>considers. The transformation components are only for the width adjustment 
>right? (i.e. TransformAlarmC).
>>Or should I manually adjust the values I get through the HPL interface  using 
>>constants (multiplication of the input values by 2) such way that I get 1us 
>>interface?
>
>

My suggestion is to expose the maximal precision on HPL and as Counters/Alarms 
on HAL level and then use TransformAlarmC which also transforms precision (to a 
lower one) to provide the HIL.

Vlado

 
>Any help is highly apritiated,
>
>>greetings
>
>>Attila
>
>
>
>
>>_______________________________________________
>>Tinyos-help mailing list
>[email protected]
>https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



      
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to