On 05/28/2012 09:59 AM, Ugo Colesanti wrote:
> On 05/25/2012 06:58 PM, András Bíró wrote:
>> Hi,
>> On Thu, May 24, 2012 at 4:30 PM, Ugo Colesanti
>>
>> <[email protected]>   wrote:
>>> Thanks for your help. If I have correctly understood what you are saying, I
>>> have the following options (none of them is nice):
>> You can still change the hardware :)
> I bought for of this devices... must find something to do with them :)
Oops...

>>> - Use the external Transceiver Oscillator as Symbol Counter and manage the
>>> transceiver driver to avoid sleep mode (it seems quite complicated).
>>>
>>> I've checked the fuses of the zigduino, they are set as: low_fuses=0xFF ,
>>> high_fuses=0xDA , extended_fuses=0xF5
>>> The low fuse is set to select the external 16Mhz transceiver oscillator,
>>> thus, I started following the second option. It seems to work even if the
>>> timer stops if I force the atmega128rfa1 to standby mode (it shouldn't do
>>> that) while keeping the idle mode works fine.
>> Strange, but good to know.
> Maybe I made something wrong, I will check again...
Ok, it was my fault: when the cpu goes in standby it keeps the 16Mhz 
transceiver oscillator running but disables timers/counter -> I need to 
keep the cpu in idle otherwise use the symbolcounter (but then I will 
have the issue of the radio that cannot go in sleep state). What a mess :S

>>> Ugo
>>>
>>> p.s. the McuInitP does not seem to support the external oscillator since all
>>> the CLKPR values assumes internal RCOscillator with 1:2 prescaler. I forced
>>> CLKPR to 0x00 since the default value, 0x0f was for RC Oscillator only.
>> You're right, there should be a define for that.
>>
>> Andris
> Thanks again for your help.
>
> Ugo
>
>>>
>>>
>>> On 05/23/2012 10:11 PM, András Bíró wrote:
>>>> Hi Ugo,
>>>>
>>>> On Wed, May 23, 2012 at 5:37 PM, Ugo Colesanti
>>>> <[email protected]>     wrote:
>>>>> 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?
>>>> First of all, I'm not really familiar with the new (or the old) timer
>>>> stack, but I'm quite familiar with the rfa1 (I wrote some of the
>>>> drivers for it, and I'm still working with rfa1 based motes).
>>>>
>>>> Both solutions are bad, but I'm not sure which one is less bad.
>>>>
>>>> First, the internal RC oscillator is quite inaccurate. The 16MHz radio
>>>> crystal is much better, but it's way too fast for RTC usage, if you
>>>> scale it down to millisecs, the nominal frequency error will be much
>>>> bigger then a 32 kHz crystal.
>>>>
>>>> The bigger problem is the energy. You're correct, you need the radio
>>>> in TRX_OFF mode to use it's oscillator. Turning it on with
>>>> ActiveMessage brings the transciever to RX_ON mode, and I think it
>>>> consumes much more power than TRX_OFF. However turning the transciever
>>>> on without messing up the state machine of the radio timer is not an
>>>> easy task.
>>>>
>>>> If you want to use the main clock, it will never let the mcu to enter
>>>> power-down/power-save mode (only standby/extended standby). By the
>>>> way, you have to do this manually with connecting
>>>> McuPowerOverride/McuPowerState interfaces to McuSleepC.
>>>>
>>>> If I were you, I would use the main clock, and if I need more accurate
>>>> timing, I would change the corresponding fuses on the mcu to use the
>>>> radio crystal for the main clock.
>>>>
>>>> Andirs
>>>>
>>>>> 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
>>>
>>> --
>>> 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
>>>
>


-- 
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