328pb memory coruption

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

Hi,

 

I use atmega 328pb and I have problem with memory, if I touch somewhere around xtal0/1 and oscillator then CPU  stop working (it's clear because capacitance of finger etc..), but it erase whole memory. 

 

According manual it seems it can be connected to  http://ww1.microchip.com/downloads/en/DeviceDoc/40001906A.pdf  (32.8.3)  Chip Erase section. It is really annoying behaviour, is it any way how to protect to erase memory if I touch to oscillator, or only possible way use varnish?

 

Picture with memory dump is from pololu a-start 328pb, I was able to simulate similar behaviour on pololu board if I "played" with oscilloscope probe around ceramic oscillator, there were not erased whole memory but only first four lines. It's blink program. 

 

It's easy to fix by ISP programmer but, who from customer has ISP programmer :(. 

 

Thank you very much.

 

 

Attachment(s): 

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

Q1) Where are your decoupling capacitors?

Q2) How have you ascertained that 22pF is the right value for that crystal?

 

The Pololu board comes pre-programmed with a bootloader. For your tests are you disabling that? Or does your board use a bootloader?

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Brian Fairchild wrote:

Q1) Where are your decoupling capacitors?

Q2) How have you ascertained that 22pF is the right value for that crystal?

 

The Pololu board comes pre-programmed with a bootloader. For your tests are you disabling that? Or does your board use a bootloader?

 

A1) hmm, I use cap only for AVCC, see attachment. It is good point . (BTW: I use "breakout detection" set to I think 4.2V). 

A2) I use  https://lcsc.com/product-detail/SMD-Crystal-Resonators_Yangxing-Tech-X322516MOB4SI_C12668.html  , I ascertained from atmel manual, there is load capacitance 12-22pF, but crystal which I use is marked as 12pF load capacitance. 

 

Yes pololu uses bootloader from  https://github.com/pololu/a-star/tree/master/bootloaders/optiboot . No, all tests were with boards which contain bootloader. I am not sure whether bug in bootloader can erase whole chip + EEPROM. EEPROM was erased too. 

 

EESAVE is not set. so if I set EESAVE then I can test whether it erase "chip erase function" or any other bug. I just looked to  RDY/BSY whether it goes to high.

 

6. Wait until RDY/BSY goes high before loading a new command.

 

and it didn't :(.

 

 

 

 

Attachment(s): 

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

error414 wrote:

Brian Fairchild wrote:

Q1) Where are your decoupling capacitors?

A1) hmm, I use cap only for AVCC, see attachment. It is good point .

 

OK, so you are missing a capacitor for the Vcc pin. And maybe for all your other chips on the board?

 

I hope you have both GND pins connected to a solid 0V along with the 0V from the crystal and its capacitors.

 

error414 wrote:

Brian Fairchild wrote:

Q2) How have you ascertained that 22pF is the right value for that crystal?

...but crystal which I use is marked as 12pF load capacitance.

 

22pF might be a bit high. If you had no stray capacitance, and the AVR presented no capacitance, then you'd be spot on but, as it says in the datasheet...

 

Quote:

4. When selecting the external capacitor value, the stray capacitance from the PCB and device should be deducted.

 

Your two capacitors appear in parallel to the crystsal, so 11pF, but then there's all the other capacitance. This is quite a good read...

 

https://www.st.com/resource/en/a...

 

When we had the full-swing oscillator to play with then you could get away with just about any value, with the lower-power oscillator it is more important to get the right values.

 

error414 wrote:

No, all tests were with boards which contain bootloader. I am not sure whether bug in bootloader can erase whole chip + EEPROM. EEPROM was erased too. 

 

Bootloaders  can certainly erase parts, if not all, of the chip. It'll depend on their code.

 

 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Fortunately all IC has 100nF cap close to power input as it's possible. Just for atmel is missing. 

 

Ground should be ok, see attachment. 

 

-----------

Be honest, I don't fully understand of oscillators for atmel so I use 22pF because I saw it in some schema for arduino boards.  It's true that I saw schemes where was used 12pF cap. I would expected stability issue, not chip erase. 

Thank you for design guide, as many pages only about oscillator, HUH :)

 

 

----

I will try test it without bootloader. 

 

BTW: are arduino boards designed well?

Attachment(s): 

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

Get rid of R1, add bypass cap (100nf) close to pins 4 and 5, also add one to pin 18 AVCC, that may already be there, but it is not shown in pcb layout.

How are your fuses set, have you enabled the clock failure detection?

Have you selected the full-swing xtal oscillator?

show us your VCC power supply portion of the schematic, linear or switching?

Jim

 

 

 

 

 

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

error414 wrote:
Picture with memory dump is from pololu a-start 328pb, ...
https://www.pololu.com/file/0J1463/a-star-328pb-micro-schematic.pdf via Pololu - A-Star 328PB Micro - 5V, 20MHz

22pF is too large for PB megaAVR which also require a crystal or resonator with a reduced load capacitance.

Oscillator's input current loop is very high impedance; a ground plane under that current loop may aid, or, a guard ring around that current loop will reduce the electrostatic coupling (to reduce leakage, the guard's voltage is ideally the common-mode voltage though ground should work)

Example Layout of ATxmega32A4 and ATmega324PB Devices | AVR® Microcontroller Hardware Design Considerations

Recommended Capacitor Values | AVR® Microcontroller Hardware Design Considerations

 

"Dare to be naïve." - Buckminster Fuller

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

error414 wrote:
I would expected stability issue, not chip erase.
AVR NVM controllers can mis-function due to out-of-spec power and/or clock.

AVR have a clock dF spec that's improved in XMEGA and follow-on to PB megaAVR; these are AVR that are designed to reliably switch clocks and may be more tolerant of ESD/EFT/lightning.

AVR have a dVCC/dt spec and some have an injection current spec (EOS survival, latch-up prevention, oscillator start-up)

Excessive di/dt under a MCU die may cause excessive clock dF; consider the current flow in the ground plane.

 

"Dare to be naïve." - Buckminster Fuller

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

R1 is from arduino schema  http://electronoobs.com/images/Arduino/tut_31/arduino_uno_scheamtic_ch340.png  , I have no idea what it purpose of that. In PCB is C6 100bF, see attachment. 

 

My fuse bits are in attachment.

 

VCC is LIPO battery, 2Ah/45C so really stable, I use linear voltage regulator. see attachment.   https://lcsc.com/product-detail/Low-Dropout-Regulators-LDO_ON-Semiconductor-NCP1117ST50T3G_C17314.html

There is no big load from regulator, I would say max 100mA, I don't use any "power" components. 

 

Attachment(s): 

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

Very good, other than the missing bypass cap on VCC/GND and perhaps too large of xtal caps (check with xtal maker for recommended values) or try 15-18pf to see if that helps.

You do enable the clock failure detector, do you have an interrupt handler for that and if so what do you do when it is triggered? The solution may be in how you handle the change in operating frequency when this happens.

Jim

 

 

 

 

 

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

Thnak you very much for help, I have to buy new cap, and I will try it.

 

 

I din't set interrupt handler for that, is it possible to change clock source from program? I have no idea what program should do when clock skew is detected. I would say, stop program?

 

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

error414 wrote:
I have no idea what program should do when clock skew is detected. I would say, stop program?

Well then you need to ask yourself if this "feature" should be enabled. 

What effect will cpu speed and any related timer operations will be changed when this event happens, perhaps a delay loop with WDT timeout to force a  restart is best or not, your decision here will be needed.

 

Good luck with your project.

Jim

 

 

 

 

 

 

 

Last Edited: Wed. May 20, 2020 - 02:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Why is gnd upside down?  It should always point downwards (only), with rather rare exceptions!

 

 

The layout looks decent!...you might want to bring any (or at least a few) spare pins to adjacent vias, in case you need them. 

If you do so, you won't need them.  If you don't, you will certainly need them & wish you had a few spares.  That's much more aggravating with QFN packages!!

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

ki0bk wrote:

Have you selected the full-swing xtal oscillator?

m328pb doesn't have one.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

Because use crystal oscillator is only test and I didn't have enought place in schema and mainly I was lazy to create it prettier. :)

 

 

Hmm, it is good point, I would bet, it is from your experiences :D

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

ki0bk wrote:

Very good, other than the missing bypass cap on VCC/GND and perhaps too large of xtal caps (check with xtal maker for recommended values) or try 15-18pf to see if that helps.

You do enable the clock failure detector, do you have an interrupt handler for that and if so what do you do when it is triggered? The solution may be in how you handle the change in operating frequency when this happens.

Jim

 

 

I was able to buy only 12pF capacitors. 15 and 18 are ordered. I have tree board and I noticed that second one sometimes fails. Freeze for a second. I replaced 22pF to 12pF and it solved the issue. But still I can wipe IC by my finger :). I read a lot about cap for oscillator and it seems that I have to know how much capacitance is in tracks. Load capacitance for my crystal is 12pF, so I used formula

 

Cp = c1c2/c1+c2  + Cs   and CS I would say can be 6pF??? Then if I use 12pF result is 12pF what match with capacitance load of crystal. So it should be OK. 

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

I replaced crystal oscillator to ceramic which I used before and still my finger can wipe memory. U use captopn tape to protect exposure pads. It must be issue of 328PB because 328p works OK.  

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


A mega324PB layout has a ground ring around the frequency control devices.

in Example Layout of ATxmega32A4 and ATmega324PB Devices | AVR® Microcontroller Hardware Design Considerations

 

"Dare to be naïve." - Buckminster Fuller

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

error414 wrote:

 It must be issue of 328PB because 328p works OK.  

 

The 328P does have the full-swing oscillator.

 

I'd still be interested to see whether the same thing happens if you bypass the bootloader.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

I owe you ten beers. Without bootloader I wasn't able to damage memory, program stop working but after power down/up program runs again. I verified memory agains FW and "verified". 

 

EDIT: 328p does not have full swing oscilator :(. It's in eratta, full swing oscilator was removed 2015?? +- few years (from revision K.). You can ask Microchip to 328p which supports full swing oscilator.  

 

 

 

Errata ATmega328/P

The revision letter in this section refers to the revision of the ATmega328/P device.

Rev. K

1 – Full swing crystal oscillator not supported

The full swing crystal oscillator functionality is not available in revision K.

Fix/Workaround:

Use alternative clock sources available in the device.

Last Edited: Thu. May 21, 2020 - 12:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

error414 wrote:
The full swing crystal oscillator functionality is not available in revision K.

Duh, I was looking at the wrong DS! Never mind.

 

 

 

 

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

error414 wrote:

EDIT: 328p does not have full swing oscilator :(. It's in eratta, full swing oscilator was removed 2015?? +- few years (from revision K.). You can ask Microchip to 328p which supports full swing oscilator.  

 

No, rev K never made it into production. The full swing is still there in the 328P...

 

Quote:

39.1. Rev. B – 11/2016
1. Update I/O Multiplexing
2. Errata section updated
Removed die revision E to K for both ATmega328 and ATmega328P:
• Die revision E to J was not sampled.
• Die revision K was not released to production.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Brian Fairchild wrote:

error414 wrote:

EDIT: 328p does not have full swing oscilator :(. It's in eratta, full swing oscilator was removed 2015?? +- few years (from revision K.). You can ask Microchip to 328p which supports full swing oscilator.  

 

No, rev K never made it into production. The full swing is still there in the 328P...

 

Quote:

39.1. Rev. B – 11/2016
1. Update I/O Multiplexing
2. Errata section updated
Removed die revision E to K for both ATmega328 and ATmega328P:
• Die revision E to J was not sampled.
• Die revision K was not released to production.

 

Ahh, thank you, I read many articles abour removing full swing oscilator, so it confused me. 

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

There is a trace (from pin 10) running under the crystal connections, isn't that considered a no-no. I put a ground plane under and around the crystal and its connections for my 328pb (and 324pb) and so far they have worked as expected (but it is a small sample size).

 

When that trace from pin 10 goes form LOW to HI (or vice versa) it will capacitively be coupled to the low power high impedance crystal nodes. Surroundings those crystal nodes with as much ground as possible will limit that.

 

my projects: https://github.com/epccs

Debugging is harder than programming - don’t write code you can’t debug! https://www.avrfreaks.net/forum/help-it-doesnt-work

Last Edited: Thu. May 21, 2020 - 08:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's analog to analog comparator. Amplified PAL video signal. I redesigned it a little bit

 

 

Attachment(s): 

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

Ok

 

 

Show your ground planes if possible...

 

also for reference this is what I did.

 

my projects: https://github.com/epccs

Debugging is harder than programming - don’t write code you can’t debug! https://www.avrfreaks.net/forum/help-it-doesnt-work

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

Ok, but I think the crystal part has a keepout blocking the bottom ground plane.

 

Update: I am going to add some more suggestions. For the ground plane to work it needs to be connected as much as possible. Areas that lack connections can allow current to flow in undesirable places. Everwhere that the ground plane forms a continuous loop is like a cage and will keep in (or out) unwanted coupling. The green marks show some low hanging fruit where the plane can be connected. The light blue is an antenna and traces should be run to remove them.

 

my projects: https://github.com/epccs

Debugging is harder than programming - don’t write code you can’t debug! https://www.avrfreaks.net/forum/help-it-doesnt-work

Last Edited: Thu. May 21, 2020 - 09:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cool, thank you very much. I will have to fix whole board according your suggestions. 

 

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

Your layout should work without those changes if those sort of changes allow the 328pb to work then that is not good. I have been saying the 328pb works fine for a while now, but I am starting to think otherwise.

my projects: https://github.com/epccs

Debugging is harder than programming - don’t write code you can’t debug! https://www.avrfreaks.net/forum/help-it-doesnt-work

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

ron_sutherland wrote:

Your layout should work without those changes if those sort of changes allow the 328pb to work then that is not good. I have been saying the 328pb works fine for a while now, but I am starting to think otherwise.

 

I found out where is problem, and it's not nice for 328pb, if I touch XTAL1 pad with finger then CPU jumping randomly over whole program, bootloader contains SPM instruction, and if bootloader is used then random jumping can jump to SPM instruction and wipe memory. I removed SPM instruction from bootloader and then it was ok. It's really crap CPU.

 

To new board I soldered my old 328p and if I touch crystal then CPU stop working, and can revor from that, it's not needed restart. So I'm going to go back to 328p.

 

 

Last Edited: Fri. May 22, 2020 - 09:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My 328pb (and 324pb) is running on my bench at the moment so it is easy to put a finger on both crystals and their load capacitors. I did not see a reset or the heartbeat LED change. The 324pb has optiboot and it did not reset or jump from normal program flow. The 328pb is programmed with ISP and is more difficult to verify the software flow, but retains settings and seems to be working as expected. I really don't know what to think, but at this point I am fairly sure I have been deceiving myself about the 328pb because I needed it to work (needed two I2C ports).  I am going to be moving to an AVR128DA32 next since I am running out of room for software.

my projects: https://github.com/epccs

Debugging is harder than programming - don’t write code you can’t debug! https://www.avrfreaks.net/forum/help-it-doesnt-work

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

ron_sutherland wrote:

My 328pb (and 324pb) is running on my bench at the moment so it is easy to put a finger on both crystals and their load capacitors. I did not see a reset or the heartbeat LED change. The 324pb has optiboot and it did not reset or jump from normal program flow. The 328pb is programmed with ISP and is more difficult to verify the software flow, but retains settings and seems to be working as expected. I really don't know what to think, but at this point I am fairly sure I have been deceiving myself about the 328pb because I needed it to work (needed two I2C ports).  I am going to be moving to an AVR128DA32 next since I am running out of room for software.

And then you don't have an oscillator at all.

I'm using pb devices only with external clock. Just a little 74hc1gu04 gate does a wonderful job. Depending of your frequency requirements, it can serve both 328pb and 324pb.

Well, you can use this with the newer DA/0-series/1-series too....

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

You could modify the bootloader for 'spm protection', if wanted. I'm not sure why the spm instruction is not more closely guarded.

 

 

I created Vector Selector Security maybe a decade+ ago, and I guess it never caught on.

 

Something like this-

https://godbolt.org/z/FzvFXA

 

Since ivsel is a spare bit that is also protected (ivce), it makes for a good protection bit (interrupts not being used either). It takes a little work to change it, and the value is determined after ivce is set so you have to go through the ivce=1 instruction to make the change. The spm function also does the ivsel checking inside the 4cycle window so you have to both go through the initial setting of spmen (via cmd) and also have ivsel==1 before spm instruction will run.

 

There are still probabilities remaining as a random pc counter is not going to be clearing ivsel that may have been correctly set previously, but you also would have had to get the ext reset flag set (and only that flag set) to first get ivsel set. If you are not pressing a reset button, then the probabilities of errant spm go way way down.

 

 

The more simple answer- keep your fingers off the circuit board.

 

 

 

 

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

rammon wrote:
74hc1gu04 gate does a wonderful job. Depending of your frequency requirements, it can serve both 328pb and 324pb.

 

This is what I need to try, thanks for that, it had not occurred to me.

 

update: add notes to help the crystal impaired (e.g., me). It needs to be an unbuffered CMOS inverter.

 

http://www.ti.com/lit/an/szza043/szza043.pdf

my projects: https://github.com/epccs

Debugging is harder than programming - don’t write code you can’t debug! https://www.avrfreaks.net/forum/help-it-doesnt-work

Last Edited: Sat. May 23, 2020 - 09:06 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ron_sutherland wrote:

rammon wrote:
74hc1gu04 gate does a wonderful job. Depending of your frequency requirements, it can serve both 328pb and 324pb.

 

This is what I need to try, thanks for that, it had not occurred to me.

 

update: add notes to help the crystal impaired (e.g., me). It needs to be an unbuffered CMOS inverter.

 

http://www.ti.com/lit/an/szza043/szza043.pdf

Unbuffered. The 'U' in the gu04 is very important.

I'm using this scheme for PB variants and for STM32 and STM8 chips (very 'weak' internal oscillators also).

When using resonators (CSTCR, CSTNE) you need only a Rf=1M. The crystals seems to need also an Rs, I use 1K value for that.

This simple scheme with a single gate 'U' inverter is so small and works so great that I really wonder why the chip manufacturers aren't able to put one inside their MCUs. 

Well, it seems that the oscillator alone consumes 2.5-3.5mA. That may be too much for an application.... OTOH, if you need real good noise immunity (esd, eft,...) it is the solution.

Or use mega's with full swing oscillators.

Or use specialized external oscillators (there are quite new MEMS parts, very impressive, but only 3.3V and below, not 5V)

 

 

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

I see copper fills but no effective ground plane. The net effect is you have many antennas that like to radiate.

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

I see copper fills but no effective ground plane. The net effect is you have many antennas that like to radiate.

The copper PLANE should be one sheet of copper or as close as you can get (at least in the areas you want a common plane)...having it chopped up into top & bottom portions can rapidly make it it rather poor.  Tieing them using one via is bleh from an RF effectivity. If you have room to put a piece of plane on top, that means you probably had room to put traces there instead.  Try keeping the traces on top & just "dip down"  to the plane making small, short, cuts for needed jumps & you'll end up with a still decent coverage.  Yes, sometimes this won't be possible, but if you start willy-nilly throwing traces all over top and bottom, you will lock yourself out of having a decent plane.   Every trace you gouge down  into the plane area, ask yourself if you absolutely have to --or can you find a way not to, or reduce the incursion.  

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. May 24, 2020 - 09:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rammon wrote:
Well, it seems that the oscillator alone consumes 2.5-3.5mA.

...

Or use specialized external oscillators (there are quite new MEMS parts, very impressive, but only 3.3V and below, not 5V)

Estimated 1.5mA for 16MHz MEMS into an XMEGA

Abracon | Abracon Releases New Series of Low Power MEMS

 

A PB megaAVR follow-on is megaAVR 0-series which can clock switch; so, enable/disable a Pierce oscillator.

ATmega3208/3209 Data Sheet

[page 83]

10. CLKCTRL - Clock Controller

...

 

• Main Clock Features:

– Safe run-time switching

...

via ATMEGA3208 - 8-bit Microcontrollers

though only one megaAVR 0-series is in DIP :

 

edit :

Understanding the basics of the Pierce oscillator (Abracon)

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Tue. May 26, 2020 - 03:50 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rammon wrote:
Well, it seems that the oscillator alone consumes 2.5-3.5mA.

Last time I checked on a STM8, with a 16MHz CSTNE rezonator and a 1gu04 gate. The lowest power shutdown mode was 2.5mA in shutdown.  Without it the shutdown is 16uA. So the external osc alone is 2.5mA. 5V though.

Doing a research for a low power project I just cut the power from the 1gu04 gate, and connected a GPIO pin. Controlling the external oscillator ON/OFF. Very simple and effective. But working on devices that can switch clocks at runtime. Because you need to switch to an internal oscillator before cutting down the external one :-)

As you said, no megas, no PBs.

But for the newer ones, it is possible, just like for the STM8. Use a GU04 gate and power it with a GPIO, not directly with VCC/VDD!

 

LE: I also tested an ATmega644P with a full swing osc (the same CSTNE 16MHz). An impressive 0.5uA in shutdown! The run mode was more power hungry than the STM8, at full 16MHz, (20mA) but I managed to make it 4mA with 8MHz (same 16MHz rezonator but /2 internally) and using sleep whenever possible (a simple scheduler which sleeps when doing nothing).

Last Edited: Tue. May 26, 2020 - 04:18 PM