I managed to have TimerMilli working without re-wiring:
  - I used Blink as test
  - I changed SYM_TIMER_MODE to ATMRFA1_CLKSC_XTAL but it was not enough 
since as the datasheet says: "If the transceiver goes from active mode 
into sleep  mode, the symbol counter clock source is switched to the RTC 
clock automatically [...] After wake up, the counter switches back to 
the clock source which was selected before  going to sleep mode."
  - Hence, I added ActiveMessageC and started it, but TimerMilli was 
still not working
  - Then I found this thread: 
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=110931&start=0
 
<http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=110931&start=0>
 
where it seems that when the radio exits sleep mode, it does not select 
XTAL unless the following code is run:

     ASSR_struct.as2 = 1;
     ASSR_struct.as2 = 0;

     the code enables and disables the RTC.
- Thus, in the splitControl.startDone of Active message I added:

      atomic{
         ASSR = 1 << AS2;
         ASSR = 0 << AS2;
     }

     and yep, it worked :)

By the way I realized that without the RTC, the symbol counter as 
TimerMilli is useless since it would be stopped each time the radio 
would go into sleep state, thus i think that re-wiring everything to 
TMcu as previously done is better. Isn't it?

Ugo

On 05/21/2012 06:30 PM, Ugo Colesanti wrote:
> Hi, I just made the port of TinyOS-2.1.2-rc1 for the Zigduino platform,
> an arduino clone with atmega128rfa1 chip. The porting was pretty simple
> since the atm128rfa1 is already supported. The only issue I had was
> related to the missing RTC on the zigduino which is used by TimerMilli
> and Alarm62khz components. I made everything work by applying the
> following changes:
>    - I re-wired AlarmMilli32C and CounterMilli32C to AlarmMicro32C and
> CounterMicro32C respectively
>    - I used AlarmMicro32C and LocalTimerMicroC in the RFA1DriverLayerC
>    - I redefined TRadio as TMicro and set RADIO_ALARM_MICROSEC to 1 and
> RADIO_ALARM_MILLI_EXP to 0 in RadioConfig.h
>
> With these changes I've been able to successfully run Blink,
> RadioCountToLeds,tests/TestNetworkLPL and tutorial/Printf . However I
> think there is a cleaner way to get the millitimer and 62khz timer to
> properly work on zigduino. In particular I think there is a way to tell
> tinyos to use the XTAL1 instead of OSC1 at least for Alarm62khz.  I
> tried to set SYM_TIMER_MODE   to  ATMRFA1_CLKSC_XTAL in TimerConfig.h
> but it has not worked. Probably I missed some steps but I get lost with
> all those timers :S
> Does somebody have any suggestion?
>
> Ugo
>
> p.s. I put my code on: http://code.google.com/p/zigduino-tinyos/
>
>
>
>


-- 
Ugo Maria Colesanti
Dipartimento di Informatica e Sistemistica
Sapienza Universita' di Roma
Via Ariosto 25, II floor, room B221
00185, Rome
http://wiserver.dis.uniroma1.it/cms/index.php?id=8
Phone:  +39 06 77274003
Fax:    +39 06 77274002

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

Reply via email to