I m trying full-swing feature of ATmega328P in hope for increase robustness against possible noises.
.
I have no problem with low-power mode over years of production, this is my first try of full-swing. just trying out.
.
Seems it increase noise in my circuit at higher temperatures
Here is the details of my trial :
.
Crysral 20MHz HC49 smd
With 15pF caps
ATmega328P PWM drives N-CH mosfet
Mosfet load is 100 mA LED
USART Rx/Tx 250kbps
.
No issue @25~70 °C
With both Full-swing and low-power
.
No issue @70~80 °C
Only with low-power
.
issue @70~80 °C
Only with full-swing
.
İssue is checksum error on RX, 1 or 2 byte corruption out of 19 bytes data
.
I took a look at some old posts. Some people recommend using full-swing option.
I am not sure if I need to fix this issue and use full-swing or just skip it and content with low-power mode.
.
Appriciate anyone sharing experiences
Full Swing Crystal issue
Your symptoms are consistent with changes in oscillator frequency, but you would NOT expect that with a crystal. 5V and 20MHz is right on the edge of the safe operating area, so you should be OK.
Can you verify that the oscillator is running correctly at higher temperatures? For example, turn on CKOUT and monitor it with a scope. It is less desirable to monitor the oscillator directly with a scope because that changes the load capacitance but lacking the ability to use the CKOUT pin (maybe it is used for something else), I would try scope monitoring the oscillator output pin (XTAL2).
Jim
Show us a photo of your setup.
5V and 20MHz is right on the edge of the safe operating area, so you should be OK.
I recheck the datasheet, "29.3 Speed Grades" says for 20MHz safe range is 4.5V - 5V
İn my case with full-swing maybe it falls below 4.5V?
I need to verify.
Can you verify that the oscillator is running correctly at higher temperatures?
No incidence the issue without full-swing, but I will verify to be sure as you recommended via CKOUT
The full swing osc was removed a few years ago (generating a lot of complaints & mayhem)...so who knows what you get when you select that setting nowadays?
I believe if you want 20MHz, nowadays, you must provide an external 20MHz clock waveform (such as from an oscillator) & set the chip to use an external clock/osc.
....but will cause hours of debugging headaches if it does. So here’s your heads-up. The full-swing oscillator driver circuitry is being removed. As always, there’s good news and bad news.
.....The good news about the change is that the low-power crystal driver has been improved to the point that it’ll drive 16 MHz crystals, so you probably don’t need the full-swing driver anymore unless you’re running the chip at 20 MHz (or higher, you naughty little overclocker
https://hackaday.com/2016/05/03/atmel-removes-full-swing-crystal-oscillator/
The point is that there are two different active "elements" in there. The symptoms you describe are exactly those of an MCU clock running at a different than expected frequency. So, it seems common sense to check that the oscillator is running correctly.
By the way, how are you testing this? Are you, by chance, using one of those "spring" proto boards? Like this?
I ask because that kind of oscillator behavior can come from incorrect load caps on the crystal. And, those spring boards have a lot of stray capacitance that you might not recognize. Also, the long wires associated with components and jumpers on those board can lead to weird behavior.
Jim
The full swing osc was removed a few years ago (generating a lot of complaints & mayhem)...so who knows what you get when you select that setting nowadays?
I believe if you want 20MHz, nowadays, you must provide an external 20MHz clock waveform (such as from an oscillator) & set the chip to use an external clock/osc.
....but will cause hours of debugging headaches if it does. So here’s your heads-up. The full-swing oscillator driver circuitry is being removed. As always, there’s good news and bad news.
.....The good news about the change is that the low-power crystal driver has been improved to the point that it’ll drive 16 MHz crystals, so you probably don’t need the full-swing driver anymore unless you’re running the chip at 20 MHz (or higher, you naughty little overclocker
https://hackaday.com/2016/05/03/atmel-removes-full-swing-crystal-oscillator/
I see that also says this too :
An Atmel representative said they can get you chips with the full-swing driver with a special order code. We’re thinking that they’re not going to let us special order ten chips, though, so we’re going to have to learn to live with the change.
Which suggests there is some yield issue (maybe temperature related ?) around the full swing, which also may explain why they dropped it.
Gains do get worse at higher MHz, but usually once a Xtal oscillator starts, it continues reliably.
If you really want 20MHz & Xtal, you may need to look around for Xtals with lower ESR and lowest operating Caps.
which also may explain why they dropped it
I believe they moved to a different vendor/factory, who couldn't make the chips using the same process , leading to bad statistics & removal of the full swing osc. SAD!
If you really want 20MHz & Xtal, you may need to look around for Xtals with lower ESR and lowest operating Caps.
Though mega328PB :
Pololu A-Star 328PB Micro schematic (bottom left)
via Pololu - 3. A-Star 328PB Micro pinout and components
...
Speed warning for 20 MHz version: The 20 MHz resonator frequency exceeds the maximum explicitly allowed in the ATmega328PB datasheet. In our basic testing, the 20 MHz resonator appears to function without problems, but for any critical applications you should confirm for yourself that this product is appropriate.
...
Edit: Overview
Some (most?) mega328 (base, P, and PB) are wafer fab'd at Microchip as of June'18.
by https://www.microchip.com/mymicrochip/Reports.aspx?type=cpn&filter=ATmega328P
Is the OP using M328PB? In the initial post, only M328P is mentioned.
Jim
The full swing osc was removed a few years ago (generating a lot of complaints & mayhem)...
Well the latest official datasheet says it is legit to use full-swing 20MHz 4.5V - 5V
"Table 9-5 Full Swing Crystal Oscillator operating modes"
"29.3 Speed Grades"
The full-swing oscillator driver circuitry is being removed.
Product change notification 2015 says the new order code will be ATmega328P-AURS (no full-swing)
The old one is ATmega328P-AUR (full-swing)
.
Strange thing is new ATmega328P-AURS not in order list of official datasheet 2018
Also not found in digikey.com
.
The symptoms you describe are exactly those of an MCU clock running at a different than expected frequency. So, it seems common sense to check that the oscillator is running correctly.
By the way, how are you testing this? Are you, by chance, using one of those "spring" proto boards? Like this?
The circuit is PCB, all parts are SMD
I start thinking some issue in circuit design, with low-power mode the issue is hidden,
Full-swing + heating reveal the issue.
.
Anyway I have to wait till Monday to do CKOUT verification.
Strange thing is new ATmega328P-AURS not in order list of official datasheet 2018
(page 657)
via ATmega328P - 8-bit AVR Microcontrollers - Microcontrollers and Processors
I start thinking some issue in circuit design, with low-power mode the issue is hidden,
Full-swing + heating reveal the issue.
mega328P will be a stimulus into the VCC regulator's error amplifier.
Phase noise (jitter) is proportional to power supply noise.
Edit: jitter
I know it's bad of Atmel (now microchip) to call a mega328PB a 328 chip, because it can't replace a 328 (328A etc).
And it's only the mega328PB where the full swing don't work and therefore removed from the datasheet.
Here is the change notice...it was a whole series that removed the full-swing osc....actually, it doesn't say "removed" , says no longer supported...so perhaps it is there but not guaranteed to function over all specs
https://media.digikey.com/pdf/PCNs/Atmel/WC154601.pdf
the new design revision of the products listed will be also manufactured at Tower Panasonic (Japan) wafer fabrication. |
But wasn't that change then reversed?
But wasn't that change then reversed?
So do all the old chips (mega48, 88,168, etc) now have the full swing capability restored? Would be nice for them to pub a checked current full list of which chips do & which do not have full swing mode. Datasheets may or may not be updated, or have cut/paste errors.
: . Crysral 20MHz HC49 smd With 15pF caps ATmega328P
What are the exact specs of the crystal you are using ? You may need to trial one with the lowest ESR you can find.
or a resonator.
Good point, if the OP can tolerate a resonator level precision, they may oscillate 'easier' than a crystal.
The symptoms you describe are exactly those of an MCU clock running at a different than expected frequency. So, it seems common sense to check that the oscillator is running correctly.
you are right, I just verified CKOUT and succeeded to catch the corruption in clock.
here is the details :
1) issue : RX checksum error
CKSEL3=full-swing, PWM=5%~90% (pulse), RX=streaming data
2) issue : no issue, (hidden symptom)
CKSEL3=low-power, PWM=5%~90% (pulse), RX=streaming data
3) issue : no issue,
both CKSEL3=low-power or CKSEL3=full-swing, PWM=5%~90% (pulse), RX=idle
both CKSEL3=low-power or CKSEL3=full-swing, PWM=0% or 100% (DC), RX=streaming data
I considered the issue occurs ONLY in presence of 3 factors :
T > 77°C
PWM=5%~90%
RX streaming
in absense of one factor (any of them), the other 2 factor never cause the issue.
now where should I trace to solve the problem, apparently crystall is the first subject.
I appricaite sharing experiences.
At the risk of repeating myself...
Show us a photo of your setup.
+1
Short wires is essential. (also caps to ground)
In the old days I often glued the crystal to the top of the chip with direct wires to the two clk pins. and then also connected the house to ground, (then you also have short wires for the two caps)
At the risk of repeating myself... Brian Fairchild wrote: Show us a photo of your setup.
Sorry Brian I have limited authority to share the PCB.
I try to explain it as possible.
It is 2-layer 2-side PCB all parts SMD.
One side is LEDs and mosfets, other side is MCU, crystall and regulator.
design basic rules are implemented. such as ground plane, bypass caps as near as possible to ICs.
15p caps are very close to crystall, but the whole crystall+2 caps are 2cm far from MCU.
Schematic is as below
Cheers
OK, so you're doing some sort of DMX controlled RGB LED source with PWM control.
My money is on poor ground connections. With LED currents pushing 300mA, and PWM to boot, you are pushing a lot of noise into your ground connection.
Looking at your scope traces it's hard to tell how good your clock drive is, I'm guessing that your scope doesn't have that high a bandwidth. Have a look at my post here...
https://www.avrfreaks.net/commen...
...and also the rest of that topic for the discussion on getting a true scope trace.
I don't like the 1 ohm power resistor and then only 100nF on the CPU side. (and then pulse 300mA)
That means that you have no coupling capacitor at all !
It would have been better if the 1 ohm resistor was a coil.
Add more 100nF caps, and also a good 10-100uF cap that can act as a "local" batt.
One side is LEDs and mosfets, ...
Most transistor manufacturers have linear LED drivers as a current source or sink some of which have a PWM input.
Might consider a low VCE-sat bipolar transistor in-lieu of the FET (gate drive is an issue for MCUs)
design basic rules are implemented. such as ground plane, bypass caps as near as possible to ICs.
Recommend a ferrite bead instead of 1R.
1R's advantage is can measure mega328P's VCC current with an inexpensive DMM.
TND6093 - Low VCE(sat) BJT's in Automotive Applications
(page 3)
...
However, for the control of currents from 500 mA to 5 A an external pass transistor (MOSFET) is the typical design of choice. An alternative to the MOSFET is to use a lower cost Low VCE(sat) BJT. The new family of Low VCE(sat) BJTs offer potential savings of 5 to 20 cents compared to designs using MOSFETs. Low VCE(sat) BJTs perform the same function as a MOSFET at a lower cost, and as an added bonus, in many cases provide for improved power consumption.
Load Switch – Back Light Control in Automotive Dashboards Dashboards often use multiple arrays of LEDs for illumination of the different functions. Figure 2 is an illustration using a Low VCE(sat) BJT to control the LED backlights.
...
AVR042: AVR Hardware Design Considerations
(page 5, Digital Supply)
Figure 2-2. Decoupling with Series Inductor
ka7ehk wrote:The symptoms you describe are exactly those of an MCU clock running at a different than expected frequency. So, it seems common sense to check that the oscillator is running correctly.you are right, I just verified CKOUT and succeeded to catch the corruption in clock.
here is the details :
I cannot decode those brief summaries, can you explain more how those captures are done, and what is captured.
Some scopes show a compete cessation of clocks ?!, which is going to be worse than 'RX checksum error'
A simple current noise litmus test, is to run the code, but remove the load currents. If the presence/absence of load current affects things, you have a bad layout/design.
If monitoring CLKOUT, I would also look for 50% duty cycles. One of those scope shots looks skewed in duty.
A high value R on the Xtal in pin, to gnd/vcc may help restore 50% clock duty. (some of the Atmel AT89LP series have a fuse option resistor here )
Thanks all comments , I will consider all suggestions.
I cannot decode those brief summaries, can you explain more how those captures are done, and what is captured.
sure,
I put the oscilloscope to SINGLE mode and adjusted to catch CKOUT PULSE when LOW-PULSE > 50ns
when (Temp < ~77°C OR PWM = 100% OR RX=idle); then oscilloscope catches nothing. (normal : for 20MHz, T=50ns, 50ns = 25ns High + 25ns Low)
when (Temp > ~77°C AND PWM =5%~95% AND RX=streaming) ; then oscilloscope catches low level pulse as screen shot (1) and (2) of #20
Some scopes show a compete cessation of clocks ?!, which is going to be worse than 'RX checksum error'
Yes It is quite serious problem, it means heart of system halts for moments!
I will repeat the test on another clone of PCB to trace the issue.
Thanks all comments , I will consider all suggestions.
Who-me wrote:I cannot decode those brief summaries, can you explain more how those captures are done, and what is captured.sure,
I put the oscilloscope to SINGLE mode and adjusted to catch CKOUT PULSE when LOW-PULSE > 50ns
when (Temp < ~77°C OR PWM = 100% OR RX=idle); then oscilloscope catches nothing. (normal : for 20MHz, T=50ns, 50ns = 25ns High + 25ns Low)
when (Temp > ~77°C AND PWM =5%~95% AND RX=streaming) ; then oscilloscope catches low level pulse as screen shot (1) and (2) of #20
Who-me wrote:Some scopes show a compete cessation of clocks ?!, which is going to be worse than 'RX checksum error'Yes It is quite serious problem, it means heart of system halts for moments!
I will repeat the test on another clone of PCB to trace the issue.
It seems even the low power mode disturbs, just not for as long as the full swing mode.
The questions are not only what make it cease, but also what restarts it ?
That much disturbance on a CLK is certainly not good, and does seem to need PWM activity to trigger it, so I'd suggest looking into how that PWM energy is getting into the Xtal side of things.
You could patch in a external CMOS oscillator module (20MHz), and confirm there are then no disturbances. (ie that verifies it is the Xtal nodes, not somewhere else, like reset spikes )
Also try a 20MHz ceramic resonator.
I setup PCB-2 with exactly the same parts like PCB-1 , and repeated the test on both PCB-1 and PCB-2.
.
under the same test conditins, there was no incident of issue on PCB-2, issue still remained on PCB-1
Then I swapped the Crystals between 2 PCB and observed the issue occurs only with crystal 1 on both PCBs.
After replacing with new crystals both PCBs works fine and issue disappeared.
.
I am not happy since there is no reasonable explanation for wierd behaviour of crystall 1,
All crystals are from the same reel.
I wonder if crystal is half damaged such as high temp soldering, physical hit, ESD etc. But never seen this before.
That specific crystal make and model : marginal safety factor?
If you really want 20MHz & Xtal, you may need to look around for Xtals with lower ESR and lowest operating Caps.
Also try a 20MHz ceramic resonator.
(16MHz, 0.5%, 15pF load)
with a 1Meg ohm feedback resistor.
The Murata SMD resonators are up to 20MHz.
https://www.arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf (center)
T > 77°C
Ouch! that's hot!
What are the spec's for your xtal?
Jim
I wonder if crystal is half damaged such as high temp soldering, physical hit, ESD etc. But never seen this before.
Well, they are just a small slice of quartz in a can and will break if abused.
I setup PCB-2 with exactly the same parts like PCB-1 , and repeated the test on both PCB-1 and PCB-2. . under the same test conditins, there was no incident of issue on PCB-2, issue still remained on PCB-1 Then I swapped the Crystals between 2 PCB and observed the issue occurs only with crystal 1 on both PCBs. After replacing with new crystals both PCBs works fine and issue disappeared. . I am not happy since there is no reasonable explanation for wierd behaviour of crystall 1, All crystals are from the same reel. I wonder if crystal is half damaged such as high temp soldering, physical hit, ESD etc. But never seen this before.
At least you have a solution.
Maybe that xtal has a worse ESR ?
You can emulate ESR by adding series resistance, but that's tricky to do on a 20Mhz oscillator without disturbing things.
Try using 10MHz, verify it is working , then move up from there
m.majid wrote: T > 77°C Ouch! that's hot! What are the spec's for your xtal?
actually crystall temp is approx 25° less than MCU, with MCU 77 °C, Crystal is about 50°C
I also deliberately increased temperature as a test, with MCU 95°C, Crystal is 70°C, new crystals still worked fine.
Crystal specs http://www.china-fiveten.com/p1_2.htm
ESR MAX 30 ohm
Operating temp -20 ~ +70
Capacitance 20pF
frequency tolerance 30 ppm
The 16MHz resonator in an Arduino Uno (mega328P) https://www.mouser.com/ProductDe... (16MHz, 0.5%, 15pF load) with a 1Meg ohm feedback resistor. The Murata SMD resonators are up to 20MHz. https://www.arduino.cc/en/upload...(center)
I will consider Murata resonator. except for worse tolerance (resonator +-0,1 MHz) ; (crystal +-600 Hz)
Operating temp -40°C ~ 125°C , compact size and built in caps are considerable features.
Try using 10MHz, verify it is working , then move up from there
3 PCB are working now with new 20 MHz crystalls.
seems just 1 crystal damaged,
I am preparing 12 more test PCBs, to be certain.