Reading the external crystal.

Go To Last Post
59 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

 

I use  ATMEGA256rfr2 . I would like to read the external crystal. its operating frequency is 16mhz. In xtal1 and xtal2 ,there are 8pF capacitors attached and grounded respectivley. I use Atmelstudio 7.How can I read the external crystal ? Any ideas? thanks

 

This topic has a solution.
Last Edited: Tue. Oct 17, 2017 - 09:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What do you mean by "read the external crystal"?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Instead of using the internal crystal ,I would like to know if it can work with the external crystal and so make sure it works

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What do you mean by "read"? You cannot read crystals. Do you mean you want to activate it so it is used? You do that with the CKSEL fuse bits - but make sure you know what you are doing before changing them!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pika wrote:

...its operating frequency is 16mhz...How can I read the external crystal ?

 

If you know the frequency then why do you need to read it?

 

 

pika wrote:

...two 8pF capacitors attached and grounded respectivley.

 

That seems awfully low.

 

 

pika wrote:

How can I read the external crystal ? Any ideas? thanks

 

If you are asking 'how can I measure what frequency an unknown crystal connected to my AVR is' the answer is...you can't unless you provide another reference frequency to measure against. This could be the other 32.768kHz crystal or even the local mains.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

Do you mean you want to activate it so it is used? You do that with the CKSEL fuse bits - but make sure you know what you are doing before changing them!!

 

Yes,I want to do this. Is there any link for this?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want the µc to use it and run and to make sure,I just want to read it. I guess my question was not clear enough.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The most common way that people confirm that their crystal is operating correctly is to generate a program that blinks a led at a human readable frequency such as one flash per second.

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At first I would like to know , how can I change the CKSEL fuses , without damaging the controller usinf Atmel studio 7

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The datasheet for the chip will tell you what CKSEL (and SUT) fuses there are and how to set them for various clocks. Make sure you pick "crystal" not "clock" and set the SUT to the longest possible. If the device has something called CKOPT make sure it is enabled. Crystals over 8MHz need high power drive.

 

I was going to suggest checking the fuses in the usually useful: http://www.engbedded.com/fusecalc/ but I don't see the part number there.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you.Yes, since this device was not there I had posted in the forum. I will check it out in datasheeet.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

pika wrote:
I will check it out in datasheeet.
Silly question but is that not the FIRST place you would look for any aspect of "how do I use this AVR" ? I'm sure the word "crystal" must appear in that document several times.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Silly question but is that not the FIRST place you would look for any aspect of "how do I use this AVR" ?

Sadly, it appears not.

 

frown

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

 

I have attached a picture of the settings. Should i do any other changes?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pika wrote:

I have attached a picture of the settings. Should i do any other changes?

 

You have not read all of the above posts have you?

 

Pay attention to post #10.

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Actually , I did read and I'm pretty sure I did not understand fully. My doubt is , the CKSEL was the one thing that can be changed on the debugger settings. http://www.atmel.com/Images/Atme... ,from pg 177,  I found this information and there is in CKOPT present in this device. So,is this enough? or should I do anyother changes ? With the power connection,Shall I will try with 5volts?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

His point was that I said you must choose "crystal" and not "clock" but your picture shows you picked a "clock" option. This is wrong and if you go ahead with the settings like that you will make it quite difficult to be able to contact the AVR again as it will then be looking for a clock source that does not exist. (crystal != clock !)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
you must choose "crystal" and not "clock" ... (crystal != clock !) 

This seems to be coming up quite a lot lately:

 

http://www.avrfreaks.net/comment...

 

http://www.avrfreaks.net/comment...

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
This seems to be coming up quite a lot lately:
What do you mean "lately"? cheeky

 

This has been coming up regularly ever since I started reading Freaks. I don't think either the datasheet or the programming tools makes it clear enough to beginners what a clock is and what a crystal is. I suppose the argument goes "these things are for professionals - they don't want hand holding" (though this has never stopped Microsoft / Apple adding "Fischer-Price" interfaces to their supposedly professional software!). Perhaps the programming dialog should be:

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
 I don't think either the datasheet or the programming tools makes it clear enough to beginners what a clock is and what a crystal is

Agreed.

 

This one (from the thread I cited earlier)  is not just "insufficiently unclear" - it is downright misleading:

 

 

EDIT

 

For some reason, I can't resize that: If I double-click the image, the dialogue appears; but won't do anything.

Last Edited: Mon. Oct 2, 2017 - 01:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So does it mean that when I want to choose the external crystal for its operation (not clock) and I choose "external clock " (for crystal also I choose the clock but with the picture of a crystal must be available on the right side) .Is this right ? I do not get any picture like that. Maybe my external crystal is not detected ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pika wrote:
does it mean that when I want to choose the external crystal 

That depends on whether you do, in fact, just have a crystal, and not some other clock source - such as a crystal oscillator.

 

Did you follow the links to understand the difference between a crystal, and a crystal oscillator?

 

pika wrote:
I do not get any picture like that. 

Of course you don't - Cliff made it up!

 

That was just Cliff giving a suggestion for what it could look like in order to clarify it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This page looks pretty good I think:

 

http://www.fpga4fun.com/oscillat...

 

(numbers explained in that link)

 

The point being that most "crystals" are in some kind of package with (usually!) 2 pins while 4 or more pins probably means you have a "clock" (aka "oscillator")

 

In the AVR set the fuses to "crystal" if you have a crystal and "clock" if you have a clock. If you make the mistake of selecting "crystal" and you actually have a clock you will likely get away with it. However if you make the mistake of selecting "clock" when what you have is a crystal you may be in for a bit of a fun ride. That was the point I was making in #10

Last Edited: Mon. Oct 2, 2017 - 01:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think we're all missing something here.  Fortunately, the OP pika is around, so I'm going to ask:

 

To pika: Do you want the AVR itself to determine if there is an external crystal it can use?

 

I can see this as a useful bit of programming, because AVRs set to use external crystals when plugged into boards that don't have external crystals don't work real well (at all, actually).  I don't know how to do it exactly, but I have some ideas (on AVRs with other functions on XTAL pins).  Actually measuring the frequency does rely on another reference, as was pointed out before (Brian Fairchild, post #5).  If you're just fiddling about with external clocking, the LED flash routine will tell you everything you need to know.

 

S.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello ,

 

Yes. I want AVR to use the 'external crystal' for working. But I do not know , if itself can determine the presence of the external crystal or should we configure it through debugger

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Scroungre wrote:
I don't know how to do it exactly,
I would suggest that's because no one has ever determined a way to do it.

 

When Atmel switched from tiny/mega to xmega they took a leap of faith and made a chip that always starts up at 2MHz on the internal oscillator. The programmer can then configure various other clock sources at run time. Wiat for them to "settle" then switch them active.

 

Tiny/Mega simply don't have anything like that. The clock source choice for tiny/mega is made at power on from the fixed setting of some fuse bits. To make a "dynamic switch" the AVR would presumably need to be set to "internal RC" (the only one guaranteed to work), it would then probe for / decide what clock is really required and then here comes the clever bit - it would need to reprogram it's own fuses and then force a power cycle so that, at the restart, the new CKSEL setting was read and acted upon.

 

Tiny/Mega cannot reprogram their own fuses from code running within them.

 

I could see a possible solution involving two AVR chips where one acts as an "ISP"er to the other. So after the decision was made the non mainline chip would get some kind of message as to how the fuses must be set then it performs ISP on the other chip to change its clock source and power cycle it. But this would be "fraught" !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

I could see a possible solution involving two AVR chips where one acts as an "ISP"er to the other. So after the decision was made the non mainline chip would get some kind of message as to how the fuses must be set then it performs ISP on the other chip to change its clock source and power cycle it. But this would be "fraught" !

 

Highly clever, though.  And you could use a dinky little one as the 'clock-setter' while a much bigger AVR did the heavy lifting.

 

In short, pika, at this time I think you get to decide as a human being (or small mountain rodent?) what your AVRs will use for timing at the time you program them.

 

S.

 

PS - If you're up for all that sort of rot, just stick a crystal and a couple caps on the board already.  Seriously, dudes!  S.

Last Edited: Mon. Oct 2, 2017 - 01:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pika wrote:
But I do not know , if itself can determine the presence of the external crystal or should we configure it through debugger
Your question is still vague. Do you really mean the 256rfr2 should "auto detect" if there is a crystal there and use it if present, otherwise revert to using the internal RC (that can be relied upon)? As I have just explained this is not possible with an ATmega chip such as 256RFR2. You, the designer have to make a design time decision as to whether your circuit/design is OK using the inaccurate internal RC or do you need a crystal. Once you have made that decision (and assuming the answer is crystal) then you perform a one-time ISP session on the chip to set the CKSEL bits (but making sure it is "crystal" for crystal and "clock" for clock!) and then when you next power on that AVR it will start to use the currently selected source (if present).

 

Sounds a lot like you have decided to use crystal. You have the (probably 2 pin) crystal component (and two 12..20pF capacitors) and you are going to connect them to the XTAL1/XTAL2 pins of the chip. Once you have done that you can perform the ISP operation then power cycle the circuit and the next time the 25RFR2 starts up it will now be running using the crystal.

 

If you ever want to switch back (or switch to "clock") then you would wire up whatever is to be expected (or nothing if reverting the internal RC) then you would do ISp again to set CKSEL to a new setting and this time, after the next power cycle the chip would start up using the newly selected source and so on...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
I could see a possible solution involving two AVR chips where one acts as an "ISP"er to the other

While possible, what would be the point?

 

Surely, it's a whole lot easier and cheaper to just fit a crystal and be done ... ??

 

 

 

 

EDIT

 

typo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Answer is NO, it itself cannot determine the presence of the external crystal.  You MUST configure it through debugger.  S.

 

Edit:  PS - See above edit.  ;-P  S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
As I have just explained this is not possible with an ATmega chip such as 256RFR2

But it would be possible with a SAM R21 - which is the equivalent based on a Cortex-M0.

 

As Cliff described for the XMega, this will start on its internal RC oscillator and you can then, at runtime enable & select the external crystal.

(some ARMs have automatic "clock failure" detection & fallback - I can't remember if the R21 does)

 

However, I think you still need a crystal for the radio anyhow ...

 

EDIT 

 

re-order for clarity

 

(?)

Last Edited: Mon. Oct 2, 2017 - 02:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What I mean is, in the drop down menu of the fuses , clock select CKSEL there are many options for the clock with different SUT settings. So ,I expected that the external clock would also be an option in it and it can be chosen over the internal crystal. Is it not possible through JTAG?

Last Edited: Mon. Oct 2, 2017 - 02:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
While possible, what would be the point?
I could maybe see a situation where something offered some kind of "optional extra" functionality that maybe include RTC or UART operation that would benefit from an accurate clock but you sell this without and the user can choose to upgrade. They then fit the crystal and in the next convoluted power on sequence its presence is noted (and the fact that the CKSELs have not already chosen it) so then chip 2 reprograms chip 1. How it actually detects it is another interesting challenge - perhaps a mechanical sensor or an optical sensor or something? Or if you want it really fancy: a small camera that does optical recognition and can actually "see" the difference between a 2 and 4 pin package and eve makes the crystal/clock choice too!

 

But this side track is probably confusing the ever living life out of OP who only wants to enable a crystal on his single AVR!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pika wrote:
internal crystal

There is no internal crystal! 

 

It is an RC (Resistor-Capacitor) oscillator - that's why the accuracy is (relatively) poor.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes .. its the RC. But is my question clear enough ? from post #32

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pika wrote:
What I mean is, in the drop down menu of the fuses , clock select CKSEL there are many options for the clock with different SUT settings. So ,I expected that the external clock would also be an option in it and it can be chosen over the internal crystal. Is it not possible through JTAG?
look right down that list. I forget the exact wording but you will see a number of entries for "internal RC", then a number of "external crystal", then a number for "external clock". The point is that you want to change it from one of the "internal RC" options that it is now to one of the "external crystal" options but being very careful to avoid anything that says "external clock" such as was showing in the picture  in post #14

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pika wrote:

yes .. its the RC. But is my question clear enough ? from post #32

  

 

I meant this from

 

clawson wrote:
Sounds a lot like you have decided to use crystal. You have the (probably 2 pin) crystal component (and two 12..20pF capacitors) and you are going to connect them to the XTAL1/XTAL2 pins of the chip. Once you have done that you can perform the ISP operation then power cycle the circuit and the next time the 25RFR2 starts up it will now be running using the crystal.

 

This is what I want to do and I have connected the two-pin crystal between xtal1 and 2. But cant this be done through ISP ?

Last Edited: Mon. Oct 2, 2017 - 02:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pika wrote:

What I mean is, in the drop down menu of the fuses , clock select CKSEL there are many options for the clock with different SUT settings. So ,I expected that the external clock would also be an option in it and it can be chosen over the internal crystal. Is it not possible through JTAG?

 

All right, quiet down, guys.

 

You must select CLKSEL depending upon what else there is upon your circuit board to provide a clock.  If it is an external crystal oscillator, then you select 'clock'.  If it is an external crystal (with capacitors) then you select 'crystal'.  If you wish to go with what the chip came with inside, that's 'internal oscillator'.  We deliberately chose all these terms to confuse non-English speakers.

 

You must select CLKSEL according to the parts on your circuit board.  The AVRmega you are using cannot choose for itself.  Yes, you may force it to choose any of the above by using JTAG.

 

S.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Scroungre wrote:

 

 

All right, quiet down, guys.

 

You must select CLKSEL depending upon what else there is upon your circuit board to provide a clock.  If it is an external crystal oscillator, then you select 'clock'.  If it is an external crystal (with capacitors) then you select 'crystal'.  If you wish to go with what the chip came with inside, that's 'internal oscillator'.  We deliberately chose all these terms to confuse non-English speakers.

 

You must select CLKSEL according to the parts on your circuit board.  The AVRmega you are using cannot choose for itself.  Yes, you may force it to choose any of the above by using JTAG.

 

S.

 

 

This is perfect !

 

If it is an external crystal (with capacitors) then you select 'crystal'.

This crystal is not available in my menu ! Could the connection of the crystal be a problem? maybe its not connected well that the debugger does not show it?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's interesting.  What exactly does it say?  I will go look at my own programming tools.  BRB.  S.

 

PS - For 'startup time' pick the longest one.  S.

Last Edited: Mon. Oct 2, 2017 - 02:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

These are the only three"external" options I could see

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah ha! I see the source of your confusion. The options you see in that menu are actually:

      <value-group caption="" name="ENUM_SUT_CKSEL">
        <value caption="Ext. Clock; Start-up time: 6 CK + 0 ms" name="EXTCLK_6CK_0MS" value="0x00"/>
        <value caption="Ext. Clock; Start-up time: 6 CK + 4.1 ms" name="EXTCLK_6CK_4MS1" value="0x10"/>
        <value caption="Ext. Clock; Start-up time: 6 CK + 65 ms" name="EXTCLK_6CK_65MS" value="0x20"/>
        <value caption="Int. RC Osc.; Start-up time: 6 CK + 0 ms" name="INTRCOSC_6CK_0MS" value="0x02"/>
        <value caption="Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" name="INTRCOSC_6CK_4MS1" value="0x12"/>
        <value caption="Int. RC Osc.; Start-up time: 6 CK + 65 ms" name="INTRCOSC_6CK_65MS" value="0x22"/>
        <value caption="Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms" name="INTRCOSC_128KHZ_6CK_0MS" value="0x03"/>
        <value caption="Int. 128kHz RC Osc.; Start-up time: 6 CK + 4.1 ms" name="INTRCOSC_128KHZ_6CK_4MS1" value="0x13"/>
        <value caption="Int. 128kHz RC Osc.; Start-up time: 6 CK + 65 ms" name="INTRCOSC_128KHZ_6CK_65MS" value="0x23"/>
        <value caption="Tranceiver Oscillator; Start-up time: 258 CK + 4.1 ms" name="TOSC_258CK_4MS1" value="0x06"/>
        <value caption="Tranceiver Oscillator; Start-up time: 258 CK + 65 ms" name="TOSC_258CK_65MS" value="0x16"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 0 ms" name="TOSC_1KCK_0MS" value="0x26"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 4.1 ms" name="TOSC_1KCK_4MS1" value="0x36"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 65 ms" name="TOSC_1KCK_65MS" value="0x07"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 0 ms" name="TOSC_16KCK_0MS" value="0x17"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 4.1 ms" name="TOSC_16KCK_4MS1" value="0x27"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 65 ms" name="TOSC_16KCK_65MS" value="0x37"/>
        <value caption="Tranceiver Oscillator; Start-up time: 258 CK + 4.1 ms" name="TOSC_258CK_4MS1" value="0x08"/>
        <value caption="Tranceiver Oscillator; Start-up time: 258 CK + 65 ms" name="TOSC_258CK_65MS" value="0x18"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 0 ms" name="TOSC_1KCK_0MS" value="0x28"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 4.1 ms" name="TOSC_1KCK_4MS1" value="0x38"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 65 ms" name="TOSC_1KCK_65MS" value="0x09"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 0 ms" name="TOSC_16KCK_0MS" value="0x19"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 4.1 ms" name="TOSC_16KCK_4MS1" value="0x29"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 65 ms" name="TOSC_16KCK_65MS" value="0x39"/>
        <value caption="Tranceiver Oscillator; Start-up time: 258 CK + 4.1 ms" name="TOSC_258CK_4MS1" value="0x0A"/>
        <value caption="Tranceiver Oscillator; Start-up time: 258 CK + 65 ms" name="TOSC_258CK_65MS" value="0x1A"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 0 ms" name="TOSC_1KCK_0MS" value="0x2A"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 4.1 ms" name="TOSC_1KCK_4MS1" value="0x3A"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 65 ms" name="TOSC_1KCK_65MS" value="0x0B"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 0 ms" name="TOSC_16KCK_0MS" value="0x1B"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 4.1 ms" name="TOSC_16KCK_4MS1" value="0x2B"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 65 ms" name="TOSC_16KCK_65MS" value="0x3B"/>
        <value caption="Tranceiver Oscillator; Start-up time: 258 CK + 4.1 ms" name="TOSC_258CK_4MS1" value="0x0C"/>
        <value caption="Tranceiver Oscillator; Start-up time: 258 CK + 65 ms" name="TOSC_258CK_65MS" value="0x1C"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 0 ms" name="TOSC_1KCK_0MS" value="0x2C"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 4.1 ms" name="TOSC_1KCK_4MS1" value="0x3C"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 65 ms" name="TOSC_1KCK_65MS" value="0x0D"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 0 ms" name="TOSC_16KCK_0MS" value="0x1D"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 4.1 ms" name="TOSC_16KCK_4MS1" value="0x2D"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 65 ms" name="TOSC_16KCK_65MS" value="0x3D"/>
        <value caption="Tranceiver Oscillator; Start-up time: 258 CK + 4.1 ms" name="TOSC_258CK_4MS1" value="0x0E"/>
        <value caption="Tranceiver Oscillator; Start-up time: 258 CK + 65 ms" name="TOSC_258CK_65MS" value="0x1E"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 0 ms" name="TOSC_1KCK_0MS" value="0x2E"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 4.1 ms" name="TOSC_1KCK_4MS1" value="0x3E"/>
        <value caption="Tranceiver Oscillator; Start-up time: 1K CK + 65 ms" name="TOSC_1KCK_65MS" value="0x0F"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 0 ms" name="TOSC_16KCK_0MS" value="0x1F"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 4.1 ms" name="TOSC_16KCK_4MS1" value="0x2F"/>
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 65 ms" name="TOSC_16KCK_65MS" value="0x3F"/>
      </value-group>

That makes this a pretty "unusual" AVR. The majority of normal AVRs (such as a plain mega2560) have something like this:

      <value-group caption="" name="ENUM_SUT_CKSEL">
        <value caption="Ext. Clock; Start-up time: 6 CK + 0 ms" name="EXTCLK_6CK_0MS" value="0x00"/>
        <value caption="Ext. Clock; Start-up time: 6 CK + 4.1 ms" name="EXTCLK_6CK_4MS1" value="0x10"/>
        <value caption="Ext. Clock; Start-up time: 6 CK + 65 ms" name="EXTCLK_6CK_65MS" value="0x20"/>
        <value caption="Int. RC Osc.; Start-up time: 6 CK + 0 ms" name="INTRCOSC_6CK_0MS" value="0x02"/>
        <value caption="Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" name="INTRCOSC_6CK_4MS1" value="0x12"/>
        <value caption="Int. RC Osc.; Start-up time: 6 CK + 65 ms" name="INTRCOSC_6CK_65MS" value="0x22"/>
        <value caption="Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms" name="INTRCOSC_128KHZ_6CK_0MS" value="0x03"/>
        <value caption="Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms" name="INTRCOSC_128KHZ_6CK_4MS" value="0x13"/>
        <value caption="Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms" name="INTRCOSC_128KHZ_6CK_64MS" value="0x23"/>
        <value caption="Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" name="EXTLOFXTAL_1KCK_0MS" value="0x04"/>
        <value caption="Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" name="EXTLOFXTAL_1KCK_4MS1" value="0x14"/>
        <value caption="Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" name="EXTLOFXTAL_1KCK_65MS" value="0x24"/>
        <value caption="Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" name="EXTLOFXTAL_32KCK_0MS" value="0x05"/>
        <value caption="Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" name="EXTLOFXTAL_32KCK_4MS1" value="0x15"/>
        <value caption="Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" name="EXTLOFXTAL_32KCK_65MS" value="0x25"/>
        <value caption="Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power" name="FSOSC_258CK_4MS1_CRES_FASTPWR" value="0x06"/>
        <value caption="Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power" name="FSOSC_258CK_65MS_CRES_SLOWPWR" value="0x16"/>
        <value caption="Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable" name="FSOSC_1KCK_0MS_CRES_BODEN" value="0x26"/>
        <value caption="Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power" name="FSOSC_1KCK_4MS1_CRES_FASTPWR" value="0x36"/>
        <value caption="Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power" name="FSOSC_1KCK_65MS_CRES_SLOWPWR" value="0x07"/>
        <value caption="Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled" name="FSOSC_16KCK_0MS_XOSC_BODEN" value="0x17"/>
        <value caption="Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power" name="FSOSC_16KCK_4MS1_XOSC_FASTPWR" value="0x27"/>
        <value caption="Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power" name="FSOSC_16KCK_65MS_XOSC_SLOWPWR" value="0x37"/>
        <value caption="Ext. Crystal Osc. 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" name="EXTXOSC_0MHZ4_0MHZ9_258CK_4MS1" value="0x08"/>
        <value caption="Ext. Crystal Osc. 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" name="EXTXOSC_0MHZ4_0MHZ9_258CK_65MS" value="0x18"/>
        <value caption="Ext. Crystal Osc. 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" name="EXTXOSC_0MHZ4_0MHZ9_1KCK_0MS" value="0x28"/>
        <value caption="Ext. Crystal Osc. 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" name="EXTXOSC_0MHZ4_0MHZ9_1KCK_4MS1" value="0x38"/>
        <value caption="Ext. Crystal Osc. 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" name="EXTXOSC_0MHZ4_0MHZ9_1KCK_65MS" value="0x09"/>
        <value caption="Ext. Crystal Osc. 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms" name="EXTXOSC_0MHZ4_0MHZ9_16KCK_0MS" value="0x19"/>
        <value caption="Ext. Crystal Osc. 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms" name="EXTXOSC_0MHZ4_0MHZ9_16KCK_4MS1" value="0x29"/>
        <value caption="Ext. Crystal Osc. 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms" name="EXTXOSC_0MHZ4_0MHZ9_16KCK_65MS" value="0x39"/>
        <value caption="Ext. Crystal Osc. 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" name="EXTXOSC_0MHZ9_3MHZ_258CK_4MS1" value="0x0A"/>
        <value caption="Ext. Crystal Osc. 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" name="EXTXOSC_0MHZ9_3MHZ_258CK_65MS" value="0x1A"/>
        <value caption="Ext. Crystal Osc. 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" name="EXTXOSC_0MHZ9_3MHZ_1KCK_0MS" value="0x2A"/>
        <value caption="Ext. Crystal Osc. 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" name="EXTXOSC_0MHZ9_3MHZ_1KCK_4MS1" value="0x3A"/>
        <value caption="Ext. Crystal Osc. 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" name="EXTXOSC_0MHZ9_3MHZ_1KCK_65MS" value="0x0B"/>
        <value caption="Ext. Crystal Osc. 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms" name="EXTXOSC_0MHZ9_3MHZ_16KCK_0MS" value="0x1B"/>
        <value caption="Ext. Crystal Osc. 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms" name="EXTXOSC_0MHZ9_3MHZ_16KCK_4MS1" value="0x2B"/>
        <value caption="Ext. Crystal Osc. 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms" name="EXTXOSC_0MHZ9_3MHZ_16KCK_65MS" value="0x3B"/>
        <value caption="Ext. Crystal Osc. 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" name="EXTXOSC_3MHZ_8MHZ_258CK_4MS1" value="0x0C"/>
        <value caption="Ext. Crystal Osc. 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" name="EXTXOSC_3MHZ_8MHZ_258CK_65MS" value="0x1C"/>
        <value caption="Ext. Crystal Osc. 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" name="EXTXOSC_3MHZ_8MHZ_1KCK_0MS" value="0x2C"/>
        <value caption="Ext. Crystal Osc. 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" name="EXTXOSC_3MHZ_8MHZ_1KCK_4MS1" value="0x3C"/>
        <value caption="Ext. Crystal Osc. 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" name="EXTXOSC_3MHZ_8MHZ_1KCK_65MS" value="0x0D"/>
        <value caption="Ext. Crystal Osc. 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms" name="EXTXOSC_3MHZ_8MHZ_16KCK_0MS" value="0x1D"/>
        <value caption="Ext. Crystal Osc. 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms" name="EXTXOSC_3MHZ_8MHZ_16KCK_4MS1" value="0x2D"/>
        <value caption="Ext. Crystal Osc. 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms" name="EXTXOSC_3MHZ_8MHZ_16KCK_65MS" value="0x3D"/>
        <value caption="Ext. Crystal Osc. 8.0-    MHz; Start-up time: 258 CK + 4.1 ms" name="EXTXOSC_8MHZ_XX_258CK_4MS1" value="0x0E"/>
        <value caption="Ext. Crystal Osc. 8.0-    MHz; Start-up time: 258 CK + 65 ms" name="EXTXOSC_8MHZ_XX_258CK_65MS" value="0x1E"/>
        <value caption="Ext. Crystal Osc. 8.0-    MHz; Start-up time: 1K CK + 0 ms" name="EXTXOSC_8MHZ_XX_1KCK_0MS" value="0x2E"/>
        <value caption="Ext. Crystal Osc. 8.0-    MHz; Start-up time: 1K CK + 4.1 ms" name="EXTXOSC_8MHZ_XX_1KCK_4MS1" value="0x3E"/>
        <value caption="Ext. Crystal Osc. 8.0-    MHz; Start-up time: 1K CK + 65 ms" name="EXTXOSC_8MHZ_XX_1KCK_65MS" value="0x0F"/>
        <value caption="Ext. Crystal Osc. 8.0-    MHz; Start-up time: 16K CK + 0 ms" name="EXTXOSC_8MHZ_XX_16KCK_0MS" value="0x1F"/>
        <value caption="Ext. Crystal Osc. 8.0-    MHz; Start-up time: 16K CK + 4.1 ms" name="EXTXOSC_8MHZ_XX_16KCK_4MS1" value="0x2F"/>
        <value caption="Ext. Crystal Osc. 8.0-    MHz; Start-up time: 16K CK + 65 ms" name="EXTXOSC_8MHZ_XX_16KCK_65MS" value="0x3F"/>
      </value-group>

That is "normal" and has options for "Ext. Clock", "Int. RC", "Ext, Low-Freq. Crystal", "Ext Crystal Osc." etc.

 

So I guess most readers here were expecting the 256RFR2 to offer the same.

 

Presumably the RFR2 in the 256RFR2 name means this is a "radio chip" of some sort? In that case I guess it has tuned radio oscillators and this mysterious "Transceiver Oscillator" is something to do with that? I think (as I said in #10 in fact) that it may be time to consult the datasheet to find out what your options are. The items in the programming dialog (that come from the XML I just showed) will just reflect what is actually described in the datasheet.

Last Edited: Mon. Oct 2, 2017 - 02:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay, I get:

 

Ext. Clock   :   Use when you have an external crystal oscillator (a full can, or other clock source)

Int RC Osc  :   Use when you have no external clocking hardware at all

Ext Crystal Osc  : Use when you have an external crystal (standalone, and needs separate capacitors)

 

That help any?

 

S.

 

PS - Oh dear.  I see also all the RF clocking options.  You, pika, using an RF chip, will have to deal with them too.  S.

Last Edited: Mon. Oct 2, 2017 - 02:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

As an aside I should mention that the only reason for picking a faster 'start-up time' is if your nodes (AVRs) are going to be spending a lot of their time completely powered off and only powered on for a very short period of time (seconds, if not half a second or less).  If that is the case, you will need to measure just how fast your external clocks (and everything else, including RF driver amplifiers) do power up and become stable, and once you have done that you might be able to cut down the powerup time.  Until then, use the longest ones.  S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BTW the 256RFR2 data has this:

 

which pretty much tells the whole story.

 

Unlike other AVRs that have multiple crystal options you basically have a choice of one here. Either there is a 16MHz crystal (with 2 capacitors to Gnd) across XTAL1/XTAL2 or there isn't. After that the choices are just:

 

The usual advice is to use the longest startup time possible to give the crystal a chance to start resonating.

 

But start by reading the whole of Chapter 11 in the datasheet so you understand the whole picture.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did they really spell it

 

clawson wrote:

Ah ha! I see the source of your confusion. The options you see in that menu are actually:

      <value-group caption="" name="ENUM_SUT_CKSEL">
        <value caption="Tranceiver Oscillator; Start-up time: 16K CK + 0 ms" name="TOSC_16KCK_0MS" value="0x1B"/>

 

without the 's' I would have put into 'transceiver'? 

 

S.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Presumably the RFR2 in the 256RFR2 name means this is a "radio chip" of some sort?

Yes, it is:  it is the AVR Equivalent of the SAM R21[1]  (as hinted in #31) - microcontroller + IEEE 802.15.4 transceiver.

 

In that case I guess it has tuned radio oscillators and this mysterious "Transceiver Oscillator" is something to do with that?

Presumably - again, as hinted in #31

 

 

it may be time to consult the datasheet

What do you mean, "may" ?? cheeky

 

The items in the programming dialog (that come from the XML I just showed) will just reflect what is actually described in the datasheet.

Absolutely

 

 

Bart Simpsons Chalkboard

 

EDIT

 

[1] Actually, the 256RFR2 came first - so it would be better to say that the SAM R21 is the ARM equivalent of the 256RFR2 

Last Edited: Mon. Oct 2, 2017 - 02:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did they really spell it...

Yup, the ATDF files are full of typos like this ;-)

 

Elsewhere in the same XML you see:

        <module name="TRX24">
          <instance name="TRX24" caption="Low-Power 2.4 GHz Transceiver">
            <register-group name="TRX24" name-in-module="TRX24" offset="0x00" address-space="data" caption="Low-Power 2.4 GHz Transceiver"/>
          </instance>
        </module>

so maybe the other errors were just an "off day" (and then a serious cut/paste error!).

 

Another one in the same file:

          <bitfield caption="Reciver Smart Receiving Mode Enable" mask="0x20" name="RX_RPC_EN"/>

I'm sure if you pulled any of the ATDF files you could find at least one typo error in each (which kind of makes you wonder why Atmel have never sat someone down with a spell checker and a pile of XML files!)

Last Edited: Mon. Oct 2, 2017 - 02:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

I'm sure if you pulled any of the ATDF files you could find at least one typo error in each (which kind of makes you wonder why Atmel have never sat someone down with a spell checker and a pile of XML files!)

 

Possibly because XML tags cause any spellchecker I've ever met to go into conniptions?  There may be those that can overlook them.

 

Anyhow, advice for pika is, as I see it, set CLKSEL to 0x3F.

 

This presumes an external crystal with capacitors (I use 18pF on all my AVRs, and have never been disappointed, although different crystals are known to want different values) all wired up correctly.  And yes, the OP must set the fuses through their debugger.

 

S.

 

Last Edited: Mon. Oct 2, 2017 - 03:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Isn't the transceiver crystal mandatory for radio operation anyhow?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

 

 

From the datasheet this is the one thing I found and it confused

 

Last Edited: Mon. Oct 2, 2017 - 03:27 PM

Pages