I have a sketch which I uploaded to my Atmega328 over SPI with my Arduino Nano as ISP, and the sketch does not appear to be running.
Please post the output produced when you do the upload
What evidence do you have that the sketch is not running ?
The output is what you would expect. My evidence is that there is nothing happening on any of the pins.
Please humour us and post the output and please post the full sketch as well while you are at it, explaining what it should do, any peripherals attached to the chip and how it is powered
You describe the target system as
Is it an Arduino board or a standalone chip with supporting passive components. If the latter then seeing a schematic of the project would be helpful as would details of how it is put together, ie on a PCB, matrix board or maybe a breadboard
It's a standalone chip this Atmega
Does it have a crystal with the proper capacitors?
Does it have the necessary reset circuit?
Does it have all the required bypass capacitors?
Are ALL the power and ground pins connected?
Is it a 328P and NOT a 328PB?
You are making it very difficult to help you
Please post the details that I asked for previously. I assume that the target system is more than just an Atmega chip
Here is the output. Well at least the red text.
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\matej\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"
Using Port : COM8
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\matej\AppData\Local\Temp\arduino\sketches\9E21CA9208F94117DB84232F370FC32D/sketch.ino.hex"
avrdude: writing flash (4192 bytes):
Writing | ################################################## | 100% 6.95s
avrdude: 4192 bytes of flash written
avrdude: verifying flash memory against C:\Users\matej\AppData\Local\Temp\arduino\sketches\9E21CA9208F94117DB84232F370FC32D/sketch.ino.hex:
avrdude: load data flash data from input file C:\Users\matej\AppData\Local\Temp\arduino\sketches\9E21CA9208F94117DB84232F370FC32D/sketch.ino.hex:
avrdude: input file C:\Users\matej\AppData\Local\Temp\arduino\sketches\9E21CA9208F94117DB84232F370FC32D/sketch.ino.hex contains 4192 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 3.75s
avrdude: verifying ...
avrdude: 4192 bytes of flash verified
avrdude done. Thank you.
I used a board that does not require the crystal, and I have changed the fuses to use the internal clock of the Atmega.
It is really a 328P, not 328PB.
My target system is just a standalone Atmega328P.
How did you do that ?
I changed the fuse bytes in the boards.txt file.
Do I also have to connect 5V to AVCC?
Please bear in mind that we don't know how anything is connected in your project
Can you see how it would have helped if you had given full details in your first post ?
Yes, Yes, Yes.
I changed the fuse bytes in the boards.txt file.
I do't think that will reprogram the fuses, unless you burn the bootloader and even then I don't think it makes a difference.
I am trying to make a thermometer with an LED display. I will post the sketch here.
sketch.ino (7,7 KB)
The digit anodes are driven with PNP transistors (strong enough NOT gates also suffice), and the cathodes are driven by the Atmega's pins.
I advise you to install MCUdudes MiniCore board instead of messing around with files. You get all the ATmega MCU's and a lot of settings including internal / external clocks.
Have you managed to successfully upload any sketches using your current method, Blink, for example ?
I suggest you install MCUdude/minicore.
Even though you might not use the bootloader, you should burn the bootloader with the 8MHz internal clock, that will correctly set the fuse bits. If you try to do it yourself, you could brick the IC.