Clock system clarifications

Go To Last Post
40 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everyone,
I'm trying to continue reading and understanding the microcontrollers, starting with the ATMEGA family.
Right now I'm trying to deal with the system clock, the timers, and the counters.
In the case of the ATMEGA164A, in chapter 9 of its datasheet is summarized the clock distribution chain, which I report below.
 
What I come up with is that the clock system can be provided internally or externally. In the latter case, through a Prescaler system, it is possible to reduce, according to the needs, the system frequency.
 
What is not clear to me is that the clock entity is then divided into clock subsystems:
- clk_cpu
- clk_flash
- clk_adc
- clk_io
- clk_asy
 
But what does this mean? That there are N clocks from the main source? However, if so, then what is the frequency of work for each of them?
I know this topic has already been discussed on the forum as well, but I honestly continue to have confused ideas.
Moreover, to confuse me even more, it is the experimental evidence that I have been able to implement.
I state that, at this moment, my ATMEGA164A is configured to operate the internal clock at 8Mhz. Furthermore, the development board that I created has a quartz crystal with two 22pF capacitors in it.
 
At first, I am sincere before having read enough, I thought that the various clocks had the frequency of the clock source used, in my case, 16Mhz. But this is not the case.
In paragraph 9.1.2 "I / O Clock - CLK-i / o" I learn that this clock manages Timer/counter, SPI, and USART, etc... However, what I evince from the practical experiment is that there is something that it doesn't come back or more probably I don't understand.
 
Take, for example, the management of the USART it to make it work, in this configuration, I have to indicate with F_CPU 16 Mhz (I have a 16Mhz crystal onboard).
 
In order to use the serial port, I am configuring as follows:
 
<Code>
#ifndef F_CPU
#define F_CPU 16000000L
#endif
 
#define BAUD 115200
#define BRC ((F_CPU / 8 / BAUD) -1) // I divide by 8 because I initialize USART with UCSR0A = (1 << U2X0)
#define TX_BUFFER_SIZE 128
 
.....
 
void USART_init (void) {
UBRR0H = (BRC >> 8);
UBRR0L = BRC;
UCSR0A = (1 << U2X0);
UCSR0B = (1 << TXEN0) | (1 << TXCIE0); / * enable serial transmission and enable interrupt generation when transmission is complete * /
UCSR0C = (1 << UCSZ01) | (1 << UCSZ00); / * Set 8bit * /
}
</ Code>
 
Note that F_CPU - for the calculation of the baud rate - is set to 16Mhz.
 
While to use the counter I am using the following code:
 
<Code>
void init_timer1_CTC_wave_generator (void) {
DDRD | = (1 << PD5);
TCCR1A = 0; // set entire TCCR1A register to 0
TCCR1B = 0; // same for TCCR1B
TCNT1 = 0; // initialize counter value to 0
TCCR1A | = (1 << COM1A0);
// set appears match register for 1 Hz increments
OCR1A = 31249; // = 8000000 / (256 * 1) - 1 (must be <65536) -NOTE 8000000 (8mHZ)
// turn on CTC mode
TCCR1B | = (1 << WGM12); // Set timer / count in CTC operation mode
// Set CS12, CS11 and CS10 bits for 256 prescaler
TCCR1B | = (1 << CS12) | (0 << CS11) | (0 << CS10);
}
<Code>
 
So as can be seen from the measurement made with an oscilloscope, indicated with the image below, the square wave has a frequency of precisely 1000Hz and 50% period.

 

Setting 8Mhz
 
But if I suppose the time is using the external clock (16Mhz) I get a 0.5Hz square wave
Here is the code with a 16Mhz hypothesis
<Code>
void init_timer1_CTC_wave_generator (void) {
DDRD | = (1 << PD5);
TCCR1A = 0; // set entire TCCR1A register to 0
TCCR1B = 0; // same for TCCR1B
TCNT1 = 0; // initialize counter value to 0
TCCR1A | = (1 << COM1A0);
// set appears match register for 1 Hz increments
OCR1A = 62499; // = 16000000 / (256 * 1) - 1 (must be <65536) - (Note 16Mhz)
// turn on CTC mode
TCCR1B | = (1 << WGM12); // Set timer / count in CTC operation mode
// Set CS12, CS11 and CS10 bits for 256 prescaler
TCCR1B | = (1 << CS12) | (0 << CS11) | (0 << CS10);
}
</ Code
Below the oscilloscope image
 

Set 16Mhz

 

In conclusion, I apologize for the very long post, I ask you to kindly help me understand what is meant by clock distribution and what the clocks identified with:
- clk_cpu
- clk_flash
- clk_adc
- clk_io
- clk_asy
 
Are they separate clocks? If so, what frequency do they have? Or they have the same frequency and are a single clock that with an interruption system now manages an active subset (ADC, Timer, etc. ..?). However, if this last hypothesis were true, which from a logical point of view would seem the clearest, does not return with the empirical evidence of the oscilloscope.
In paragraph 9.1.2 page 38 of the datasheet Timer/counters and USART, for example, share the same clock (clk_i / o). But in the case of using the counter if I set 16Mhz (supplied by the external quartz), I get a wrong wave from the point of view of its frequency, while the configuration of the USART is correct.

In conclusion, and I apologize for the long and certainly confusing post, please help me understand the AVR's clock system, but what I imagine are the same for all microcontrollers.

 

Thank you very much!

 

This topic has a solution.
Last Edited: Wed. Sep 11, 2019 - 07:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

codabat wrote:
But in the case of using the counter if I set 16Mhz (supplied by the external quartz), I get a wrong wave from the point of view of its frequency,

 

The delay will be half the period of the frequency - it toggles the output after each delay.

OCR1A = 62499; // = 16000000 / (256 * 1) - 1 (must be <65536) - (Note 16Mhz)

   62,500 * 256 = 16,000,000 clock cycles = 1 second delay --> 0.5 Hz.

So it is doing exactly what you are telling it to do.

 

------------------------------------------------------------------------------------------

 

Why the different clocks?

 

One reason is that the different clocks can be enabled/disabled independently

from the others.  For example in certain power down modes, the clk_cpu may

be stopped while the clk_io continues.  Also, clk_io may be stopped while clk_adc

continues for noise reduction.  clk_flash may be derived from the watchdog clock,

not clk_cpu.

 

 

 

 

 

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

Hi Chuck99,
thank you very much for your intervention.
The sense of the line of code I wrote

OCR1A = 62499; // = 16000000 / (256 * 1) - 1 (must be <65536) - (Note 16Mhz)

It is clear to me. It was what I wanted to understand experimentally. In other words, the timer was not using the external crystal, but the internal one of the atmega. So do you confirm that the timers use the internal clock?
For me, a little more challenging to understand is when you say

Chuck99 wrote:

 

Why the different clocks?

 

One reason is that the different clocks can be enabled/disabled independently

from the others.  For example in certain power down modes, the clk_cpu may

be stopped while the clk_io continues.  Also, clk_io may be stopped while clk_adc

continues for noise reduction.  clk_flash may be derived from the watchdog clock,

not clk_cpu.

 

The difficulty is not conceptual but architectural. Are you telling me that for each of those clocks there is an additional internal oscillator? And if so, why isn't the frequency listed in the datasheet? Furthermore, observing the datasheet of the datasheet, it would seem that they too are automatically influenced by the prescaler, which example for the timers does not happen, having their prescaler.
Thank you very much, and I thank you once again if you can help me understand and resolve these last doubts that I have exposed to you.

Thank you very much again!

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

codabat wrote:
The difficulty is not conceptual but architectural. Are you telling me that for each of those clocks there is an additional internal oscillator?

 

No.

 

All internal clocks (with the exception of the WDT I think) are derived from a common oscillator...either the internal RC, or an external source.  What each clock can have though, is its own prescaler.  There is an exception on some AVRs with an extra 32Khx oscillator for the RTC.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Hi jgmdesign,
I am very grateful for your further clarifications.
However, I still have some doubts. I apologize for this.
I try to explain these doubts in the simplest way.
Before to do this, I will step back.
During the study of the timers-counters and the generation of square waves (PWM) I started by generating the classic square wave with a 50% duty cycle (CTC-PWM). I advance that every test-exercise has as constant the generation of a 1Hz wave.

Case 1) CTC-PWM generation (duty cycle 50% by definition of CTC-PWM):

 

void int_ctc_pwm_50_duty_cycle () {
DDRD |= (1<<PD5);
TCCR1A = 0; //set entire TCCR1A register to 0
TCCR1B = 0; //same for TCCR1B
TCNT1 = 0; //initialize counter value to 0
//set compare match register for 1 Hz increments
OCR1A = 31249; // 8000000 / (256 * 1) - 1 (must be <65536)
TCCR1A = (1 COM1A0);
//turn on CTC mode
TCCR1B = (1 << WGM12);
//Set CS12, CS11 and CS10 bits for 256 prescaler
TCCR1B = (1 << CS12) (0 << CS11) (0 << CS10);

}

 

CTC PWM I must set 8Mhz

 

As you then notice in the case of generation of a square wave in CTC-PWM mode, this time, to obtain a wave with a frequency of 1Hz, I must set the clock to  8Mhz (OCR1A = 31249; = 8000000 / (256 * 1) -1)  Why? As you see in the next case (Fast-PWM) I must set the clock to 16Mhz but the clock_i / o should be the same, as reported in datasheet (see the link reported below).

Case 2) FAST-PWM generation (10% duty cycle):
In this case, in order to obtain a square wave with 10% duty cycle and 1Hz frequency, as regards the frequency, I have to set the 16Mhz supplied by the external crystal as the internal frequency. As you can see the two codes use the same prescaler. Here is the code and the evidence obtained from the oscilloscope:

void init_timer1_fast_pwm_wave_generator (void) {
DDRD | = (1 << PD5); // set port D like output. I prepare OC1A pin hardware
TCCR1A = 0; // set entire TCCR1A register to 0
TCCR1B = 0; // same for TCCR1B
TCNT1 = 0; // initialize counter value to 0
// set appears match register for 1 Hz increments
OCR1A = 6249; // SET ICR1 for high duty (10%) - (0,1s)
// TURN PWM FAST MODE
TCCR1B | = (1 << WGM13) | (1 << WGM12);
TCCR1A | = (1 << COM1A1) | (1 << WGM11);
ICR1 = 62499; // 16000000 / (256 * 1) - 1 (must be <65536) - set 1s of period (1Hz of frequency)
// Set CS12, CS11 and CS10 bits for 256 prescaler
TCCR1B | = (1 << CS12) | (0 << CS11) | (0 << CS10);

}

FAST PWM - I must to set 16Mhz of clock

Why this difference? From figure 9-1 of the datasheet ATmega164A_PA_324A_PA-644A_PA-1284_P_DATA-Sheet-40002070A.pdf (Figure 9-1) ( http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega164A_PA-324A_PA-644A_PA-1284_P_Data-Sheet-40002070A.pdf ) this difference is not so clear to me.
It would seem that in the case of Fast-PWM the clock is different from that of a CTC-PWM. However, from figure 9-1, the pwm should be, in both cases generated with the same clock, using the timers anyway. As you can see in the TCCR1B register, I use the same prescaler for both generation modes. Does this mean that upstream there are two clocks (not indicated) with a pre-defined pre-set already set to which is added the one I indicate in the register above? However, according to what reported in point 9.1.2 Clock i / o should handle both modes used, being the i / o clock responsible for managing the counters.
Asking you to apologize again, for the long post, clarified that the source for the clocks is the same, on which electronic components do the prescalers act and then actually give different timings?
I thank you, and I am very grateful for the help you have already given me and for the further answers to these that I am again submitting.

Thank you so much

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

I give you high marks for your thoroughness!

 

The reason for the difference is how the modes work.  CTC mode works differently than Fast-PWM.  Its not how the clock works but how the mode works.

 

For CTC mode:

In CTC mode the counter is cleared to zero when the counter value (TCNTn)
matches either the OCRnA (WGMn3:0 = 4) or the ICRn (WGMn3:0 = 12). The OCRnA or ICRn define the top
value for the counter, hence also its resolution
 

 

For FAST-PWM:

The fast PWM differs from the other PWM options by its single-slope
operation. The counter counts from BOTTOM to TOP then restarts from BOTTOM.

.

.

.

In fast PWM mode the counter is incremented until the counter value matches either one of the fixed values
0x00FF, 0x01FF, or 0x03FF (WGMn3:0 = 5, 6, or 7), the value in ICRn (WGMn3:0 = 14), or the value in OCRnA
(WGMn3:0 = 15). The counter is then cleared at the following timer clock cycle.
 

I have attached a very helpful tool I use for setting the values you need for various peripherals.  No, it will not provide you with answers to your questions, but you might find it helpful for something

 

JIm

 

 

Attachment(s): 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Dear jgmdesign (Jim),
I thank you, I know I am still very lacking in the subject and therefore within the limits of my possibilities I try to give the maximum information that I have or that I have been able to deduce rightly or wrongly. For this, I thank you for your words of encouragement.
You have given me many points of reference and in-depth analysis. I immediately think about and study about your indications.

I will be pleased to update you. In the meantime, I apologize if my expositions are not clear enough. But it is not easy for me to write such technical questions in your language. I assume you're from New York. My nephew has lived in New York for over two years.
A hug and my thanks for your kindness, for your competence. Thank you also for food for thought.
See you soon.
Thank you so much.

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

codabat wrote:
As you can see the two codes use the same prescaler. Here is the code and the evidence obtained from the oscilloscope:

 

And you had to make some changes to the other values to stick with the same prescaler.  Notably the use of ICR1, OCR1A, and the master clock.

 

If you want to use a common frequency for BOTH CTC mode and/or FAST-PWM then you need to either change prescalers, change ICR1/OCR1A, Timer TOP value, or all three.

 

 

I just tried the AVRCALC and put in what I wanted for a 1 second timer for CTFC and FAST-PWM using a 8 Mhz clock and your calculated numbers were spot on.

 

 

I then ONLY changed the clock frequency to 16Mhz, and I only had to change a few register values:

 

So for your example your master clocks can be the same, its just a matter of setting things up correctly.

 

 

JIm

 

 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Dear Jim,

Thank you for your reply. It's all clear for me by the mathematical side. But what is not too clear to me, is what is the real frequency of the clock. How could I check if am I using the internal one at 8MHz or the external crystal one at 16MHz?

In the screenshot you posted about the calculator, you set 8Mhz or 16Mhz in the two calculations. How did you decide which value to set? Isn't choice related to real clock speed? Sorry me again for such so trivial questions, but I cannot find an answer so far.

Thank you again.

 

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

codabat wrote:
But what is not too clear to me, is what is the real frequency of the clock.

 

THe REAL frequency of the clock is either the Internal RC(with or without the divider), or the External crystal/clock source DIVIDED by the prescaler.

 

Example:

Clock source: Internal RC 8Mhz

Timer Prescaler: 256

 

Timer Clock Frequency = 8,000,000 / 256 = 31,250Hz

 

Example:

Clock source: External 16Mhz crystal

Timer Prescaler: 1024

 

Timer Clock Frequency = 16,000,000 / 1024 = 15,625Hz

 

 

codabat wrote:
How could I check if am I using the internal one at 8MHz or the external crystal one at 16MHz?

By your FUSE bit settings.

 

Also, the external crystal oscillator is not alwyas 16Mhz...it can be ANYTHING.  WHatever crystal you put on the pins is what the master clock will be.  YOu just need to program the proper fuse bits for the external clock.

 

One note about the internal RC oscillator.  When you get a new AVR, MOST of them are set for internal Oscillator(8Mhz) and the DIV8 fuse programmed meaning the internal clock is actually 1Mhz.  So be careful when you are doing your programming

 

What do you use to program your AVR if I may ask?

What do you use for writing your code?  Studio or something else?

 

JIm

 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

codabat wrote:
But what is not too clear to me, is what is the real frequency of the clock. How could I check if am I using the internal one at 8MHz or the external crystal one at 16MHz?
Only way I know of to do that is to calibrate against something you do know the exact speed of (which could be your wristwatch if you want to flash an LED every 5 seconds or something ;-)

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

Dear Clawson, 
I thank you for writing on my post. Post of a developer apprentice on mcu. I'm not so interested in measuring the actual clock speed. Let me explain: I have an atmega164A, mounted on a PCB, with a 16Mhz quartz crystal. The fuse is set so that the internal clock works at 8 Mhz, in the absence of an external source. I assume that the microcontroller working at 16MHz, but at the end of my question is almost irrelevant. I don't understand why for the calculation of a ctc PWM I must use in the 8Mhz formula, while for the Fast PWM I have to write 16Mhz. This is due to how the wave is built. If I understand the construction difference between a Fast PWM and a normal PWM that doubles the frequency in one of the two cases, I don't understand it in the CTC setup. Please excuse my confusion.

I take this opportunity to greet you, and thank you again.

 

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

codabat wrote:
The fuse is set so that the internal clock works at 8 Mhz, in the absence of an external source.
The fuses have no such setting. That's kind of the whole point of "fuses" - you burn them to exactly the combination you want to use. They can be set to "internal" (and there's another one for "divide by 8 by default"). Or they can be set to two forms of external, either "external crystal" or "external clock".
codabat wrote:
I assume that the microcontroller working at 16MHz,
then you assume wrong. The default fuses for a 164 are "internal" and "divide by 8". So it uses the internal 8MHz RC and then it applies a /8 to this so the default speed for 164 is 1MHz. If you have changed fuses and simply deactivated CLKDIV8 then it will be running at 8MHz from the internal RC (all CKDIV8 does is preload the /8 value into the CLKPR register).

 

The only way the chip could be running at 16MHz is if you have chosen "ext crystal" or "ext clock" and then you have attached either a crystal to XTAL1/XTAL2 or a clock to XTAL1. In that case the chip runs at whatever speed that crystal/clock is. So if it is a 16MHz device the AVR will run at 16MHz.

 

As for the PWM calculations. For all modes (normal, CTC, fast PWM) the frequency is a direct derivative of F_CPU but in "phase correct PWM" there is a further division factor of /2 because in that mode the entire cycle is not just "count up" but "count up then count down".

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

clawson wrote:

]then you assume wrong. The default fuses for a 164 are "internal" and "divide by 8". So it uses the internal 8MHz RC and then it applies a /8 to this so the default speed for 164 is 1MHz. If you have changed fuses and simply deactivated CLKDIV8 then it will be running at 8MHz from the internal RC (all CKDIV8 does is preload the /8 value into the CLKPR register).

 

The only way the chip could be running at 16MHz is if you have chosen "ext crystal" or "ext clock" and then you have attached either a crystal to XTAL1/XTAL2 or a clock to XTAL1. In that case the chip runs at whatever speed that crystal/clock is. So if it is a 16MHz device the AVR will run at 16MHz.

 

As for the PWM calculations. For all modes (normal, CTC, fast PWM) the frequency is a direct derivative of F_CPU but in "phase correct PWM" there is a further division factor of /2 because in that mode the entire cycle is not just "count up" but "count up then count down".

 

Hi clawson,
I have deactivated the "divide by 8".
If you look at the CTC configuration and the image of my oscilloscope, it looks like it is working at 8MHz.
I also don't understand: Fast PWM counts from zero to top and then from 0 to top again. So in Fast PWM I should not use the additional factor of division over the period and dunes the multiplication factor on the frequency (I mean in the formula). As you can see in the post, I posted. The register configurations should, in one case, configure a CTC PWM and in one case, the Fast PWM.
I agree that the correction factor "2" must be used in PWM with phase correction.
What am I doing wrong? The fact that the CPU works at 16Mhz I deduce it indirectly when I configure the USART.
What do you think about it?
As always you are, and you are incredibly kind and patient.
Thank you so much!

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

codabat wrote:
I have deactivated the "divide by 8".
If you look at the CTC configuration and the image of my oscilloscope, it looks like it is working at 8MHz.
If you have cleared CKDIV8 but you have not changed CKSEL in any way then the AVR *will* be running at 8MHz because that is the speed of the internal RC.
codabat wrote:
I agree that the correction factor "2" must be used in PWM with phase correction.
What am I doing wrong?
The error seems to be that you mistakenly believe the AVR is running at 16MHz for some reason whereas it sounds like your CKSEL are set to pick 8MHz. That is a factor of 2. In the very first post you have:

#define F_CPU 16000000L

what made you pick 16 in this? Why is it not 8000000UL ?

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

Hi clawson,

if I'm not wrong, I have also changed CKSEL.
Furthermore, having put a 16Mhz crystal on XTAL1 and XTAL2 I have placed #define F_CPU 16000000L. Otherwise, I would not, for example, use the USART.
I'm using an ATMEGA164A with Atmel Studio 7 and ATMEL-ICE programmer, can I somehow send you the FUSE configuration etc.?

Thank you very much!

 

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

codabat wrote:
if I'm not wrong, I have also changed CKSEL.
Read back the current fuse setting and show those. It sounds a lot like you have a chip actually running at 8MHz but doing the sums as if it were 16MHz.

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

Hi clawson,
I'm out now. As soon as I am at the computer, I take readings and let you know.
Thank you very much, it's precious for me to talk to you and the many helpful and competent people of this beautiful forum.
Thanks again.

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

clawson wrote:

Read back the current fuse setting and show those. It sounds a lot like you have a chip actually running at 8MHz but doing the sums as if it were 16MHz.

Hi Clawson,

Here I am at my development computer.
I am attaching the image of the current FUSE configuration and also the values that can be copied to the clipboard.
What do you think about it? You could repeat your theory that you were hinting at me. I honestly don't understand what I'm wrong.
To recap if everything was correct:
1. For CTC PWM I should use 18Mhz as the clock speed
2. For Fast PWM always 18Mhz
3. For Phase Correct PWM 32Mhz (BOTTOM -> TOP -> TOP -> BOTTOM)

Here is the picture:

Fuse ATMGEA164 with external 16Mhz quarzt

Here are the textual values:

BODLEVEL = DISABLED
OCDEN = [ ]
JTAGEN = [X]
SPIEN = [X]
WDTON = [ ]
EESAVE = [X]
BOOTSZ = 1024W_1C00
BOOTRST = [ ]
CKDIV8 = [ ]
CKOUT = [ ]
SUT_CKSEL = EXTXOSC_8MHZ_XX_16KCK_65MS

EXTENDED = 0xFF (valid)
HIGH = 0x91 (valid)
LOW = 0xFF (valid)

 

Thank you so much!!!!

 

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

Those are the settings for an 8Mhz or higher External Crystal, with a very slow startup time.  So, whatever your crystal value is will be your internal clock frequency

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Note that the 164, as far as I know, is only rated to 20MHz (maximum external clock speed).  So that's the fastest crystal the spec sheet says you may install.  No, it does not have any internal clock multipliers (just dividers...).

 

It MIGHT work at 32MHz - but I doubt it, and it would be a very unhappy chip.  S.

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

jgmdesign wrote:

Those are the settings for an 8Mhz or higher External Crystal, with a very slow startup time.  So, whatever your crystal value is will be your internal clock frequency

Jim

Dear Jim,

Forgive me. I don't understand well. The setting from Atmel Studio 7 is the one shown in the combo below.
The combo shows Ext Crystal Osc 8.0- Mhz. 8.0- I understand it as greater than 8Mhz. However, I don't find an option that allows me to set a value of 16Mhz or 20Mhz, which is the maximum that ATMEGA164 can operate.


How should I operate? Via software?
Below is the exploded combo, for most of the selectable values.

Thank you so much!

Last Edited: Mon. Sep 9, 2019 - 07:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

YOu have selected the correct option!  What that option means is that you set the AVR for an external crystal 8MHz or higher.  So you are good to go.  Just do not go higher than 20Mhz.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Hi Scroungre,

however, 20Mhz is the maximum frequency at which the MCU can operate. The Atmega164 can operate with a 16Mhz crystal. I'm still preplanned because I make all my calculations for USART with 16MHz frequency and it works perfectly if I put it at 8Mhz it doesn't work.

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

codabat wrote:
I make all my calculations for USART with 16MHz frequency and it works perfectly if I put it at 8Mhz it doesn't work.

 

You need to recalculate your baud rate register settings for 8Mhz.  Check out the chart in teh USART section of the 164....you will see different UBRR values

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

codabat wrote:
if I put it at 8Mhz it doesn't work.

That's because you have a 16MHz xtal attached!  If you want 8MHz, you have three choices..

1) connect an 8MHz xtal, the xtal determines what freq. it runs at given your current fuse settings!

2) set the CLKPR reg to /2 using your 16MHz xtal! (16 / 2 = 8)

3) use the internal 8MHz RC osc. by changing the fuses!

I hope it's clear now....

 

Jim

 

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

ki0bk wrote:

 

That's because you have a 16MHz xtal attached!  If you want 8MHz, you have three choices..

1) connect an 8MHz xtal, the xtal determines what freq. it runs at given your current fuse settings!

2) set the CLKPR reg to /2 using your 16MHz xtal! (16 / 2 = 8)

3) use the internal 8MHz RC osc. by changing the fuses!

I hope it's clear now....

 

Jim

 

Hi ki0bk,

I just wanted to say that this confirmed that I was working properly at 16MHz.
What I wanted to conclude was whether the settings for CTC PWM (50% DUTY CYCLE) and FAST PWM should be made as follows:

 

CTC PWM: DC=50% FREQ.: 1Hz

 

void init_timer1_CTC_wave_generator(void){
    DDRD |= (1<<PD5);
    TCCR1A = 0; // set entire TCCR1A register to 0
    TCCR1B = 0; // same for TCCR1B
    TCNT1  = 0; // initialize counter value to 0
    TCCR1A |= (1 << COM1A1);
    // set compare match register for 1 Hz increments
    OCR1A = 62499; // = 16000000 / (256 * 1) - 1 (must be <65536) - (Note 8Mhz)
    // turn on CTC mode
    TCCR1B |= (1 << WGM12); //Set timer/count in CTC operation mode
    // Set CS12, CS11 and CS10 bits for 256 prescaler
    TCCR1B |= (1 << CS12) | (0 << CS11) | (0 << CS10);
}

 

FAST PWM DUTY CYCLE: 10% FRQUENCY 1Hz

 

void init_timer1_fast_wave_generator(void){
    DDRD |= (1 << PD5); //set port D like output. I prepare hardware pin OC1A    
    TCCR1A = 0; // set entire TCCR1A register to 0
    TCCR1B = 0; // same for TCCR1B
    TCNT1  = 0; // initialize counter value to 0
    // set compare match register for 1 Hz increments
    OCR1A = 6249; //  SET ICR1 for high duty (10%) - (0,10s) 
    //TURN PWM FAST MODE
    TCCR1B |= (1 << WGM13) | (1 << WGM12);
    TCCR1A |= (1 << COM1A1) | (1 << WGM11);
    ICR1 = 62499; // 16000000 / (256 * 1) - 1 (must be <65536) - set 1s of period (1Hz of frequency)
    // Set CS12, CS11 and CS10 bits for 256 prescaler
    TCCR1B |= (1 << CS12) | (0 << CS11) | (0 << CS10);

}

 

Thank you!

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

jgmdesign wrote:

YOu have selected the correct option!  What that option means is that you set the AVR for an external crystal 8MHz or higher.  So you are good to go.  Just do not go higher than 20Mhz.

 

Jim

Ok, I'm sorry, before I have read wrong your response.

Then,

 

I just wanted to say that this confirmed that I was working properly at 16MHz.
What I wanted to conclude was whether the settings for CTC PWM (50% DUTY CYCLE) and FAST PWM should be made as follows:

 

CTC PWM: DC=50% FREQ.: 1Hz

 

void init_timer1_CTC_wave_generator(void){
    DDRD |= (1<<PD5);
    TCCR1A = 0; // set entire TCCR1A register to 0
    TCCR1B = 0; // same for TCCR1B
    TCNT1  = 0; // initialize counter value to 0
    TCCR1A |= (1 << COM1A1);
    // set compare match register for 1 Hz increments
    OCR1A = 62499; // = 16000000 / (256 * 1) - 1 (must be <65536) - (Note 8Mhz)
    // turn on CTC mode
    TCCR1B |= (1 << WGM12); //Set timer/count in CTC operation mode
    // Set CS12, CS11 and CS10 bits for 256 prescaler
    TCCR1B |= (1 << CS12) | (0 << CS11) | (0 << CS10);
}

 

FAST PWM DUTY CYCLE: 10% FRQUENCY 1Hz

 

void init_timer1_fast_wave_generator(void){
    DDRD |= (1 << PD5); //set port D like output. I prepare hardware pin OC1A    
    TCCR1A = 0; // set entire TCCR1A register to 0
    TCCR1B = 0; // same for TCCR1B
    TCNT1  = 0; // initialize counter value to 0
    // set compare match register for 1 Hz increments
    OCR1A = 6249; //  SET ICR1 for high duty (10%) - (0,10s) 
    //TURN PWM FAST MODE
    TCCR1B |= (1 << WGM13) | (1 << WGM12);
    TCCR1A |= (1 << COM1A1) | (1 << WGM11);
    ICR1 = 62499; // 16000000 / (256 * 1) - 1 (must be <65536) - set 1s of period (1Hz of frequency)
    // Set CS12, CS11 and CS10 bits for 256 prescaler
    TCCR1B |= (1 << CS12) | (0 << CS11) | (0 << CS10);

}

 

Thank you so much!

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

You are confusing the hell out of us.

 

WHAT does not work properly?  The USART or the Timer?  Cliff gave you a great set of explanations on how the Timer works, and the rest of us have been explaining how the oscillators work.

 

So PLEASE carefully explain what it is you are having a problem with.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

jgmdesign wrote:

You are confusing the hell out of us.

 

WHAT does not work properly?  The USART or the Timer?  Cliff gave you a great set of explanations on how the Timer works, and the rest of us have been explaining how the oscillators work.

 

So PLEASE carefully explain what it is you are having a problem with.

 

Jim

 

Hi Jim, Hi everyone,

I apologize to all of you.
Excuse me also for my elementary English.
My reference to USART was to highlight even if indirectly that the microcontroller is working with the 16Mhz external crystal. Otherwise, due to the settings I posted, serial communication would not work. Instead, serial communications work perfectly.
My doubt arose from my initialization of a CTC PWM.
To get a wave of the desired frequency I was forced to write:

DDRD | = (1 << PD5);
TCCR1A = 0; // set entire TCCR1A register to 0
TCCR1B = 0; // same for TCCR1B
TCNT1 = 0; // initialize counter value to 0
TCCR1A | = (1 << COM1A1);
// set appears match register for 1 Hz increments
OCR1A = 31249; // = 8000000 / (256 * 1) - 1 (must be <65536) - (Note 8Mhz)
// turn on CTC mode
TCCR1B | = (1 << WGM12); // Set timer / count in CTC operation mode
// Set CS12, CS11 and CS10 bits for 256 prescaler
TCCR1B | = (1 << CS12) | (0 << CS11) | (0 << CS10);

(For me wrong)

 

While for the Fast PWM it was configured considering a clock frequency of 16Mhz (like the one I expected).

In conclusion I wanted to get confirmation that the crystal setting was correct and that the correct way to generate the CTC PWM w the Fast PWM were the following:

FAST PWM:

 

void init_timer1_FAST_wave_generator (void) {
DDRD | = (1 << PD5); // set port D like output. I prepare OC1A pin hardware
TCCR1A = 0; // set entire TCCR1A register to 0
TCCR1B = 0; // same for TCCR1B
TCNT1 = 0; // initialize counter value to 0
// set appears match register for 1 Hz increments
OCR1A = 6249; // SET ICR1 for high duty (10%) - (0.10s)
// TURN PWM FAST MODE
TCCR1B | = (1 << WGM13) | (1 << WGM12);
TCCR1A | = (1 << COM1A1) | (1 << WGM11);
ICR1 = 62499; // 16000000 / (256 * 1) - 1 (must be <65536) - set 1s of period (1Hz of frequency)
// Set CS12, CS11 and CS10 bits for 256 prescaler
TCCR1B | = (1 << CS12) | (0 << CS11) | (0 << CS10);

}

(For me correct Fast PWM)

 

and for CTC:

 

void init_timer1_CTC_wave_generator (void) {
DDRD | = (1 << PD5);
TCCR1A = 0; // set entire TCCR1A register to 0
TCCR1B = 0; // same for TCCR1B
TCNT1 = 0; // initialize counter value to 0
TCCR1A | = (1 << COM1A1);
// set appears match register for 1 Hz increments
OCR1A = 62499; // = 16000000 / (256 * 1) - 1 (must be <65536) - (Note 8Mhz)
// turn on CTC mode
TCCR1B | = (1 << WGM12); // Set timer / count in CTC operation mode
// Set CS12, CS11 and CS10 bits for 256 prescaler
TCCR1B | = (1 << CS12) | (0 << CS11) | (0 << CS10);
}

(For me correct but seem don't work)

 

I hope I was able to explain what my concerns and problems were.
I apologize again if I was not able to express the issues more simply and understandably.

With more strength, I thank you all very much for the precious support.
Thank you so much!

Last Edited: Mon. Sep 9, 2019 - 08:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm still confused......but thats nothing new frown

 

Your crystal setting is correct if you are indeed using the EXTERNAL crystal option in teh fuse settings AND you indeed have a 16Mhz crystal connected to the XTAL1 XTAL2 pins.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

So your UART is working fine with the 16MHz external clock selected.

If you then select the internal 8MHz clock, it should stop working.  Might want to test that.

 

Your PWM, however, seems to be working funny at 16MHz, with values that you think are wrong. (so's the comment in that last one).

 

Have I got it right here?  S.

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

Dear Jim,

I am very sorry.
I'm confused too. Although I searched the documentation, although I checked the FUSE setting to operate at 16Mhz, now the Fast PWM generation is OK! But the CTC PWM generation doesn't come back to me. To generate in CTC PWM a 1Hz wave imposed as follows:

 

void init_timer1_CTC_wave_generator (void) {
DDRD | = (1 << PD5);
TCCR1A = 0; // set entire TCCR1A register to 0
TCCR1B = 0; // same for TCCR1B
TCNT1 = 0; // initialize counter value to 0
// set appears match register for 1 Hz increments
OCR1A = 62499; // = 16000000 / (256 * 1) - 1 (must be <65536)
// turn on CTC mode
TCCR1B | = (1 << WGM12);
TCCR1A | = (1 << COM1A0);
// Set CS12, CS11 and CS10 bits for 256 prescaler
TCCR1B | = (1 << CS12) | (0 << CS11) | (0 << CS10);
}

However, from the oscilloscope, I get a frequency of 0.5Hz and not 1Hz.
This means that in this case, I have to use 8000000Hz instead of 16000000Hz as a calculation constant. What should this tell me? Could CTC only work with the internal clock? But for what we said we don't believe! So it depends on how the CTC wave is created? But the counter should be LOW-HIGH-LOW-HIGH, and therefore I should have a dc of 50% with frequency at 1Hz if I set 16Mhz with Prescaler 256.

I apologize again, but what does not come back to me is the CTC.

For Fast PWM (16000000 / (256*1) -1 work fine!

I ask for the last help to understand. Then on this topic, I will not disturb you anymore. I will try to study more and resolve the issue alone.

Let me express my gratitude for your time.
Thank you, thank you very much to you and all the others.

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

Scroungre wrote:

So your UART is working fine with the 16MHz external clock selected.

If you then select the internal 8MHz clock, it should stop working.  Might want to test that.

 

Your PWM, however, seems to be working funny at 16MHz, with values that you think are wrong. (so's the comment in that last one).

 

Have I got it right here?  S.

 

Hi dear Scroungre,

please you read my last post a few seconds ago...

I don't understand the behavior of the CTC PWM, the Fast PWM works as I expect it to be.

Thank you so much!

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

codabat wrote:
However, from the oscilloscope, I get a frequency of 0.5Hz and not 1Hz.
This means that in this case, I have to use 8000000Hz instead of 16000000Hz as a calculation constant.

 

No.  It means YOU need to change your settings to get the proper output frequency.  How the hell is your code, or the compiler going to know on the fly what Crystal or oscillator you are hanging on the device as the clock.  It is YOUR responsibility as the programmer to realise this and correct your code automatically.

 

As cliff told you:

clawson wrote:
The error seems to be that you mistakenly believe the AVR is running at 16MHz for some reason whereas it sounds like your CKSEL are set to pick 8MHz. That is a factor of 2. In the very first post you have:

 

#define F_CPU 16000000L

what made you pick 16 in this? Why is it not 8000000UL ?

 

Changing the F_CPU in your code, but NOT changing the master clock, and vice versa, does nothing but create the issues you are having.

 

Whatever your ACTUAL master clock is...Internal RC, Internal RC/8, External Crystal ETC, you must adjust your code accordingly.  Th AVR cannot recognise this aned make changes for you.

 

If you change the clock, you must change the code.  If you run the AVRCALC program I provided you will see this happen.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

I've often very cheerfully told people to try something that should not work - and when it does, that's often a very straight line to the problem.

 

So:  You have a UART.  It works.

You have F_CPU set.  It still works.

You have the fuses set.  It still works.  Try breaking it.

 

All of the above must agree on what frequency we're talking here, or things will not work.

 

Also, I'd like to see what pin you use (and the code) to measure the frequency.  If that pin toggles every trip through the PWM, you'll get exactly half speed.  Note that writing to the PINx in modern AVRs toggles the PORTx setting.  You could also use CLKO (another fuse that uses a pin for 'clock out').

 

Also note that the fuse setting you have isn't really "16MHz", it's "external crystal at 8Mhz or greater." [up to 20MHz, as per the spec sheet]

 

S.

 

PS - Don't worry about it.  We can be a bit cranky now and then, but we're trying to help.  And if you think your English is bad, you should see my Hindi.  S.

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

Summarizing some of your code:

TCCR1B = 0; // same for TCCR1B
// turn on CTC mode
TCCR1B | = (1 << WGM12);
// Set CS12, CS11 and CS10 bits for 256 prescaler
TCCR1B | = (1 << CS12) | (0 << CS11) | (0 << CS10);

Why do you make 3 writes to TCCR1B when it could be just one?

// Set CS12, CS11 and CS10 bits for 256 prescaler and CTC mode
TCCR1B  = (1 << CS12) | (0 << CS11) | (0 << CS10) | (1 << WGM12);

It seems many posters here are (overly) addicted to the use of the |= operator! There's no law about using good old fashioned =

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Jim, hi everyone,

first of all, my heartfelt thanks.
I didn't change the clock source. Also because Atmel Studio 7, each time the firmware is reloaded, does not change the FUSE settings independently.

The problem is that I took a mistake in applying the formulas, I apologize.
In fact, in the last case, the one related to CTC PWM, I got go crazy!

By definition, a CTC PWM has a 50% duty cycle. Therefore the wave period is twice the duty cycle. So the value calculation (N) of the comparator will be:
N = ((1/2) / (1/16000000 * 256)) - 1 = 31249.

I was blatantly confused and wrote 62499! That's why from my oscilloscope (correctly) I detected a wave of 0.5Hz instead of 1Hz.

 

I apologize for the confusion in which I have incurred. With greater strength, I address my most sincere thanks for your explanations, and first of all, for your patience.

 

Thank you so much.

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

Hi Scroungre,
you are very understanding, and I thank you for your advice, including method.
But, the truth is, I got crazy! Please read my post number 38.
Thank you so much. I apologize again!

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

Dear Clawson,
You're right, that piece of my code is absolutely redundant. Yours is the correct and preferable form. Thanks also for this observation, the details also contribute to growth.
Please, also for not letting you lose any more time for my confusion, read my post 38 of this thread.
Thank you so much, and I apologize again for my distractions!