Hi Sofia!

On Fri, Jan 28, 2011 at 1:31 PM, sofia aparicio
<[email protected]> wrote:
> Hello,
>
> I finally I could see the output signal for OC3A, OC3B and OC3C. To do that
> I have to remove the TimerMilliC from my main program, otherwise only OC3A
> was working. Do you know why is that? OC3B and OC3C correspond to INT0 and
> INT1. Maybe this timer is using the interrupts?

I have no idea why the TimerMilliC interferes with Timer3. In the
documentation I could not find anything.

> I have configured them in Fast PWM TOP=OC3A and clear on compare match as
> follows:
>
> TCCR3A=0xAB;
> TCCR3B=0x9;

So you have used
COM = 2: clear on compare, set on bottom
WGM = 7: fast pwm 10 bit

So I think your top is not what you think it is (or maybe I have again
misread it).

> OCR3A=0x3E8;
> OCR3B=0x5B;
> OCR3C=1;
>
> Removing the TimerMilliC from my main program I can see that the frequency
> does not change for each OC3 but the wide of the signal change.

This is completely normal operation. PWM is used to change the
set/clear distribution, not the frequency. If you want to do different
frequencies, completely independent of each other, then you have to do
is manually. Probably this would work:

1) Use WGM = 0: normal operation, keep the counter free running
2) Use COM = 1: toggle the pins on compare match
3) From the compare interrupt always update your compare registers by
advancing it by 0x3E8 and 0x5B. I am affraid that you would not be
able to get 0x1, that is just the clock right? The timer would not
even be able to provide that frequency. If I remember correctly, then
it needs 3 or 4 cycles minimum. Even the 0x5B is a border line case,
since then you have to have a lot of interrupts and the MCU might not
be able to handle those. Another option would be to use Timer3 and
Timer1 together (and then you have to disable all other use of Timer1,
e.g. radio driver)

Best,
Miklos

Best,
Miklos

> It is not
> possible to obtain different frequencies? I enclose you a picture of the
> results obtained in OC3B and OC3A.
>
> Thank you very much.
>
> Sofia
>
>
>
>> Date: Thu, 27 Jan 2011 21:41:44 +0100
>> Subject: Re: [Tinyos-help] Question about IRIS mote using OC3A,OC3B,OC3C
>> From: [email protected]
>> To: [email protected]
>> CC: [email protected]
>>
>> Hi Sofia!
>>
>> On Thu, Jan 27, 2011 at 4:25 PM, sofia aparicio
>> <[email protected]> wrote:
>> > Hello,
>> >
>> >  > Seems ok, but not sure how you access those pins. How did you
>> > verified
>> >> that your code does not work? You cannot be sure that these pins are
>> >> available on the 51-pins.
>> >
>> > I am using a MDA100 sensor board connected to my IRIS mote. I can see
>> > the
>> > signals in OC3A, OC3B and OC3C using an oscilloscope. You can see the
>> > pines
>> > in the 51-pin connector of the IRIS mote.
>>
>> Ok. You should try to enable the interrupts and toggle LEDs just to be
>> sure that the problem is not a 51-pin connector wirings. As far as I
>> know, OC3A = PE3 = PIN26, OC3B = PE4 = PIN6, OC3C = PE5 = PIN5.
>>
>> >> > TCCR3A=0x57;
>> >>
>> >> COM3A = 1: toggle pin on compare match
>> >> COM3B = 1: toggle pin on compare match
>> >> COM3C = 2: clear pin on compare match
>> >> WGM3:10 = 1
>> >> > TCCR3B=0x19;
>> >>
>> >> ICNC3 = 0: input capture noise canceler disabled
>> >> ICES1 = 0: input capture falling edge
>> >> CS3 = 1: clock running with no prescaling
>> >> WGM3:32 = 3, therefore WGM3 = 0xD: reserved.
>> >
>> > This is not OK COM3C=1: toggle pin on compare match.
>> > WGM3=0x0F; Fast PWM mode with OC3A as TOP value.
>>
>> Oh, you are right, I was tired apparently.
>>
>> > I think that the configuration is OK. Can I use this Fast PWM and to use
>> > the
>> > tree output compares?
>> > Or do I need to use the CTC mode?
>>
>> Ok, now since you are using Fast PWM (I thought that you used CTC),
>> then Table 17-4 of the datasheet says that COM3X = 1 means that OC1A
>> toggles the pin but OC1B and OC1C are disconnected! You might want to
>> use another mode of operation (WGM or COM).
>>
>> >> By the way, the Atmega1281 has timer 4 and 5 as well! If possible, I
>> >> suggest you to use Timer/Counter 4 or 5, as no other code uses that
>> >> (Timer3 was used instead of Timer1 on the MicaZ and Mica2 motes ,so
>> >> there could be codes that uses that)
>> >
>> > I did not know, but the problem is that I do not have these pines
>> > available
>> > in the MDA sensor board (or in the IRIS connector).
>>
>> Yup.
>>
>> Best,
>> Miklis
>>
>> >
>> > Thank you very much.
>> >
>> > Sofia
>> >
>> >
>

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

Reply via email to