Go Down

Topic: [Solved] ATmega328 on 3.3v - strangely enough does not work... (Read 5402 times) previous topic - next topic

AlfaOmega

Nov 16, 2013, 08:50 pm Last Edit: Nov 25, 2013, 04:48 pm by AlfaOmega Reason: 1
Hi all!

I'm trying to connect a 3.2" TFT LCD to ATmega328P-PU on a breadboard. LCD requires 3.3v on logic lines, my Arduino board is 5v. It seemed easier to set up a uC on breadboard than use 4 level shifters... Problem is that the chip does nothing  :)

Setup. On one breadboard I upload the code to the chip with USBasp programmer, on another breadboard chip gets connected to the screen. 8MHz crystals (with 22pF capacitors) on both boards. 5v for programming supplied by programmer, 3.3v for running the screen provided by a repurposed PC PSU.

That is I first upload the code, disconnect programmer from PC, pull the chip out, reinsert it in another board and then connect power.

On programming board everything works fine - "blink" example flashes an LED, if to upload LCD code and check pins with oscilloscope there are bursts of activity.

Once the chip is transferred to LCD board problems ensue. Supply voltage reads at 3.344 (PSU is rated for 13amps@3.3v). With LCD connected chip remains idle. Reset pin is high, usual jitter on crystal pins. But LCD pins and unused pins stay low. Pulling reset to ground have no effect. Disconnecting all the LCD wires (so that only 4 wires for power and ground and 2 for crystal remain) have no effect.

"Blink" sketch works at 3.3v unreliably (tried digital pins 13 and 12). It takes a second or two for the chip to "start".
Also tested "Hello world" sketch for alphanumeric LCDs. Once power is applied occasionally the chip starts. Pulling reset to ground have no effect. Touching voltage pin with oscilloscope probe and then touching one of IO pins seem to "jump start" the chip (this is more of an impression, rather an observation).

Uploaded code specifying board as just "Arduino UNO" and as "Arduino pro or Arduino pro mini (3.3V, 8MHz) w/ ATmega328" but it made no difference.

Tried another ATmega328P-PU uC with same results.

Please share your thoughts on what might be wrong here :)

olf2012

Brownout reset comes to mind. If you are using a chip out of an arduino board, it is most probably programmed for a brown out level of 2.7 volts. This may be the problem

AlfaOmega



Brownout...  Unfortunately no. Just tested the PSU with oscilloscope, it remains rock solid. That actually make sense, PC PSU must have good load regulation.

Will add a large capacitor just in case (here is an output LRC filter in PSU, but more wount hurt), thanks for idea!

fungus

Advanced Arduino

feralbeagle

Check to make sure you have power and ground _at_the_device_. The symptoms could all be power related.

These two symptoms may be related to a bad oscillator. If the oscillator is not working well, nothing will be happy.
  - Blink sketch works unreliably.
  - Jitter on xtal oscillator. (assuming you are checking the output of the oscillator and not the input)

Try this:
  - Check the resonator or crystal that you are using and make sure it is good. Replace it.
  - Check the load capacitor values for the crystal you are using if you are using a crystal.
  - Check the connections between the processor and the caps and crystal.
  - You may want to try testing with the internal oscillator. If the blink sketch still does not work, it is not an oscillator problem.
 

AlfaOmega

Unfortunately dont have anywhere to move - thats my only breadboard. Though it supposed to be a good one..
As per  mrburnette suggestion have tried different bootloaders - for Fio, Lilipad and Arduino pro or Arduino pro mini (3.3V, 8MHz) w/ ATmega328, but no luck here either.

So I've abandoned attempts to setup 328 on 3.3v@8MHz and employed 4050 level shifters, for 16 bit mode that's 4 of them. Everything works fine, enough breadboard is now like a bowl of spaghetti. Never mind, that will sort itself out later once pcb is done.

Big thanks to everyone who replied!

mauried

Did you change the BOD fuse in the Micro to suit the lower supply voltage.
http://www.atmel.com/Images/doc8161.pdf
See sect 28.4 which gives the fuse values for differant BOD detect voltages, or you can disable BOD altogether.
Otherwise the chip will simply keep resetting itself and wont start.


Docedison

I've probably used 10 or 12 Pro-Mini's @ 3V3 with no failures... But there is one small possibility here... trty with lower value crystal loading caps... The breadboard may have a little too much parasitic capacity. 10 - 15 pF worked for me the one time I had that issue. It's very possible that this is your issue.. the hint comes from: 
Quote
Once power is applied occasionally the chip starts. Pulling reset to ground have no effect. Touching voltage pin with oscilloscope probe and then touching one of IO pins seem to "jump start" the chip (this is more of an impression, rather an observation).

This is a really positive indication of improper loading caps..

Doc
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

dc42

Was there a decoupling capacitor between Vcc and Gnd? Was Avcc connected to Vcc?
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

AlfaOmega

dc42
I used to have a decoupling capacitor (220uF) between positive and negative rails of the breadboard but later removed it as it was on the way. Avcc is connected to +ve rail as per datasheet and ref pin is left floating. Just tried it with Avcc disconnected - to see what happens.. Barely works. Kind of make sense, datasheet describes it as power for portA and ADC, not critical hence everything kind of works.

Docedison
Loading caps!.. Since the crystal gets moved about I'v turned it in to a "module" of a sort - attached a picture. Two SMD capacitors soldered between PCB pin headers and with a crystal on top  :) Unfortunately crystal was bought in a general electronics store (Maplin electronics) and they are not keen on keeping track of datasheets of at least manufacturers and part numbers...
Added  10, 12, 15 and 18 pF capacitors to my shopping list along with five crystals (as load capacitance is 18pF) , will order them tomorrow at RS Components (along with some other stuff), will be delivered on friday. Than hopefully over the weekend this matter can be put to rest. :smiley-mr-green:

mauried
I have not touched fuse settings :) Only uploaded bootloader.  Power is supplied by a repurposed PC PSU and it's a storage oscilloscope I'm using which enables me to look over a period of time. Voltage remains around 3.32V +-0.03V, no spikes or sudden falls.
Few weeks ago when I've used 55W light bulb as a resistive load voltage indeed sagged from 12 to almost 11 volt.  To bring 3.3v down to 2.7 there have to be a few amps load, a uC and a screen take about 0.3A. Hence with current setup condition for brownout are unachievable in theory and I've confirmed it with practical observation.

dc42


dc42
I used to have a decoupling capacitor (220uF) between positive and negative rails of the breadboard but later removed it as it was on the way.


You don't need a 220uf decoupling capacitor unless you are running a high current device from the same supply, but you do need a 0.1uF ceramic decoupling capacitor, connected as close to the Vcc and ground pins as possible (i.e right next to the chip, not between the bus rails).

It's a good idea to ground the case of the crystal.

While you are waiting for your other capacitors to arrive, you could try with no loading caps at all. The capacitance of the breadboard and the chip itself may well be enough, especially if you ground the case of the crystal.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

AlfaOmega

Hurray! Works perfectly with both 18 and 12pF loading capacitors! And also works without any capacitors XD
Cool, "Hello world" LCD example counts at half speed!

Thanks a lot guys!!

Go Up