Go Down

Topic: Troubleshooting ATMEGA328P on breadboard (Read 201 times) previous topic - next topic

ChrisMeduna

Hello everyone,
Basically brand new to the arduino world and I'm a bit lost here. I have an ATMEGA328P that I took out of my arduino uno and moved over to a breadboard to run my pressure sensor and SD card module. Everything was working perfect before removed from the arduino and moved over. I have the 16mhz crystal and capacitors needed to run it on the breadboard. I have triple checked my wiring and everything seems to be correct and all of my connections are solid, so I'm pretty sure it has to be something with my programming. Sketch was loaded on the chip before it was moved over. Is there a different board selection I need to make and then reload the sketch while it's on the breadboard? Board selected for sketch load was the UNO. I have attached current code. Any advice or leads would be appreciated. Thanks in advance.

pert

Don't post screenshots of text! That is very unhelpful. When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar). It is almost never appropriate to post screenshots but in some cases it is helpful to post images. You should attach and embed the image following these instructions:
http://forum.arduino.cc/index.php?topic=364156

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags:
[code]// your code is here[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor you will not have access to this useful tool but it's still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.

Everything was working perfect before removed from the arduino and moved over.
And what now? You haven't told us what the problem is.

ChrisMeduna

I didn't have any errors in the code when uploading it on the chip. I did this while the chip was still in the UNO. After I moved it over to the breadboard it is not writing to the SD card, but was doing so when in the UNO.

spycatcher2k

Then it's down to your wiring, or power supply!
-=-
http://www.uk-pcb.co.uk - UK Based PCB Fab & Assembly Company
Design & Assembly work undertaken - Arduino repairs & testing - PM for details. Arduino & C# PC programming.

DrAzzy

Have you wired it correctly? Did you forget the 0.1uf decoupling caps between power and ground right next to the chip? What are you programming it with? If you're using a TTL serial adapter, did you remember to set up the autoreset (0.1uf cap between reset of '328p and DTR of serial adapter).
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

ChrisMeduna

I programmed the chip using arduino IDE while it was in the uno board. Once everything was working I moved the chip over to the breadboard. I have the sd card module hooked up, the bmp180 pressure and temperature module, and I've got two 22pf caps and a 16mhz clock wired to it as well. I followed the instructions on https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard. I wasn't aware I needed decoupling caps. I am powering the chip with a set of 4 AA batteries. Voltage is right around 6 volts.

spycatcher2k

Quote
Voltage is right around 6 volts.
Lets hope not, that is a outside the MAX for the ATMEGA, and well outside the 3.3V for the SD!
-=-
http://www.uk-pcb.co.uk - UK Based PCB Fab & Assembly Company
Design & Assembly work undertaken - Arduino repairs & testing - PM for details. Arduino & C# PC programming.

DrAzzy

#7
Nov 13, 2017, 07:00 pm Last Edit: Nov 13, 2017, 07:02 pm by DrAzzy
I programmed the chip using arduino IDE while it was in the uno board. Once everything was working I moved the chip over to the breadboard. I have the sd card module hooked up, the bmp180 pressure and temperature module, and I've got two 22pf caps and a 16mhz clock wired to it as well. I followed the instructions on https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard. I wasn't aware I needed decoupling caps. I am powering the chip with a set of 4 AA batteries. Voltage is right around 6 volts.
What spycatcher said (though - if you're using an SD card with on-board regulator and level shifter, that part isn't a problem; 6v is still inappropriate though. I would use 3 batteries instead of 4. The '328p is still in spec at 16mhz down to ~3.8v, and normally works even lower than that

 plus, that tutorial omits the decoupling caps. You need them, the board may reset or hand unpredictably without them (and this behavior is highly unpredictable - will vary part to part and with applied voltage and connected devices). Don't get me started about the official, bad tutorial - it's sad how many people are led astray by that awful tutorial. 0.1uf ceramic cap between Vcc/Avcc and Gnd on each side of the chip, right next to the chip. You should assume you need one for any digital IC unless the manufacturer database specifies otherwise. Because this is such a universal requirement, it usually is only mentioned in passing in the datasheet (since everyone knows to expect that).
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

ChrisMeduna

I thought I had read that it should run fine on 4 AA batteries.  And the SD module I'm running has a voltage regulator. It ran off the 5V when on the arduino board. I will try to go down to 3 batteries and I'll have to pick up some caps.

spycatcher2k

Put the chip back on the Arduino board to test it, you may have already damaged it!  :(
-=-
http://www.uk-pcb.co.uk - UK Based PCB Fab & Assembly Company
Design & Assembly work undertaken - Arduino repairs & testing - PM for details. Arduino & C# PC programming.

ChrisMeduna

I will test the chip in the arduino. Hopefully I didn't damage it! Hopefully these caps clear up my issue though. Thank you all for the help so far. Will update later after caps have been added and chip has been tested

ChrisMeduna

Chip tested good. Put the caps in and took a battery out and she's up and running! Thanks for the pointers everyone!

Go Up