samostatný čip ATMega328P

Odpovědět
Maxim
Příspěvky: 128
Registrován: 22 led 2019, 20:32
Reputation: 0

Re: samostatný čip ATMega328P

Příspěvek od Maxim » 08 zář 2020, 20:35

RomanB píše:
08 zář 2020, 20:23
Použiješ bootloader s Internal 8 Mhz
a jak připojit ten čip, ale? když jsem to dal přímo do UNA, tak to nešlo viz příspěvek nahoře

Uživatelský avatar
pavel1tu
Příspěvky: 2054
Registrován: 26 říj 2017, 08:28
Reputation: 0
Bydliště: Trutnov
Kontaktovat uživatele:

Re: samostatný čip ATMega328P

Příspěvek od pavel1tu » 08 zář 2020, 21:21

Maxim píše:
08 zář 2020, 18:54
a existuje nějaká možnost jak nahrát bootloader bez krystalu?
Ano, bez krystalu ho lze také nahrát, a nahráváš takový bootloader, jak chceš potom ATmegu používat.
UNO, NANO, Mikro, PRO mini, DUE, ESP32S2, RPi PICO
Pavel1TU
"Správně napsaný kod lze číst jako knihu"

AstroMiK
Příspěvky: 592
Registrován: 08 pro 2017, 19:05
Reputation: 0

Re: samostatný čip ATMega328P

Příspěvek od AstroMiK » 08 zář 2020, 21:24

Tak já jsem to vyzkoušel následovně:

Připojil jsem prázdný procesor ATmega328P k ISP programátoru (druhé Arduino).
Zapojil jsem k Atmega328 8 MHz krystal + kondenzátory (2x 22pF).

Používám k tomu takový přípravek s paticí, co jsem kdysi koupil u Číňaů jako stavebnici - fotka v příloze.


V Arduinu IDE jsem zvolil desku Arduino NANO a nechal vypálit bootloader.

Když už jsem to měl připojené, tak jsem hned potom nahrál do ATmega328 program pomocí programátoru
(byl to jen nějaký blikač LEDkou na D5).

Až sem si myslím, že je to běžný postup.



Pak jsem se stále zapojeným krystalem přes AVRDUDESS přepsal FUSE z původních:

Kód: Vybrat vše

  LowFUSE   0xFF
  HighFuse  0xDA
  ExtFUSE   0XFD
na nové:

Kód: Vybrat vše

  LowFUSE   0xC2 (tohle se přepisuje)
  HighFuse  0xDA (zůstává)
  ExtFUSE   0xFD (zůstává)

Když bylo LowFUSE přepsáno na 0xC2, zasunul jsem procesor do nepájivého pole jen s napájením a LED na D5.
Pin RST jsem spojil s VCC.
Po zapnutí napájení začala LED blikat podle toho nahraného programu i bez krystalu.

Přikládám obrázky s nastavením FUSE.
Než se do toho ale pustíš, tak bych byl rád, kdyby to někdo zkušený potvrdil, protože si v těch FUSE nejsem úplně jistý.
Když se nastaví špatně, může to znamenat trvalé zablokování procesoru.

avrdudess.gif
fuse_bez_krystalu.gif
pripravek.jpg

Uživatelský avatar
pavel1tu
Příspěvky: 2054
Registrován: 26 říj 2017, 08:28
Reputation: 0
Bydliště: Trutnov
Kontaktovat uživatele:

Re: samostatný čip ATMega328P

Příspěvek od pavel1tu » 08 zář 2020, 21:28

RomanB píše:
08 zář 2020, 20:23
Použiješ bootloader s Internal 8 Mhz
To je mylná odpověď, a zavádějící - bootloader použiješ takový, jak ti potom bude fungovat ATmega - buď z krystalem nebo bez.
A můžeš ho nahrávat i když krystal nemáš, nebo máš. ATmega se stejně při nahrávání přes ISP přepíná do nějakého modu snad ještě na nižší frekvenci, ale nevím to jistě.

Já mám programátor na SMD verzi a jeden provozuji s krystalem a několik i bez krystalu, když mi došly.
UNO, NANO, Mikro, PRO mini, DUE, ESP32S2, RPi PICO
Pavel1TU
"Správně napsaný kod lze číst jako knihu"

Uživatelský avatar
pavel1tu
Příspěvky: 2054
Registrován: 26 říj 2017, 08:28
Reputation: 0
Bydliště: Trutnov
Kontaktovat uživatele:

Re: samostatný čip ATMega328P

Příspěvek od pavel1tu » 08 zář 2020, 21:40

FUSE se nemusejí zkoumat, pokud se bootloader nahrává z Arduino IDE, kde si naství jak napětí 3,3/5V, tak externí/interní oscilátor, tak frekvenci interního oscilátoru 8/1MHz. IDE nastaví FUSE správně.

No, ATmega328 mi funguje i bez přepsání CKDIV8, který když je z výroby nastaven na 1, tak podle toho jestli najde nebo nenajde externí krystal - buď jede přes externí, nebo na interním 8MHz, pokud se CKDIV8 přepíše na 0, jede interní oscilátor na 1MHz
Někdo mi tvrdil, že když je ATmega napájen z 3,3V jede automaticky na 8MHz, no, mne se na 3,3V když je nahrán na 5V a externí 16MHz krystal - nerozeběhne.

Jinak jsem se řídil podle tohoto a je pravda že když se to přepíše blbě - pápá, už se nespojíš a můžeš to zahodit
Low Byte Fuses
Bit-7 : CKDIV8 : When set divides the clock speed by 8
Bit-6 : CKOUT : When set clock pulses are output on PB0 (Pin 14)
Bit-5 : SUT1 : Startup time delay
Bit-4 : SUT0 : Startup time delay
Bit-3 : CKSEL3 : Set the clock source
Bit-2 : CKSEL2 : Set the clock source
Bit-1 : CKSEL1 : Set the clock source
Bit-0 : CKSEL0 : Set the clock source

High byte Fuses
Bit-7 : RSTDISBL : External Reset disable
Bit-6 : DWEN : Debug Wire enable
Bit-5 : SPIEN : Enable serial programming and data downloading
Bit-4 : WDTON : Watchdog timer always on
Bit-3 : EESAVE : Preserve EEPROM memory through chip erase
Bit-2 : BOOTSZ1 : Sets the bootloader memory size
Bit-1 : BOOTSZ0 : Sets the bootloader momory size
Bit-0 : BOOTRST : Select the reset vector
UNO, NANO, Mikro, PRO mini, DUE, ESP32S2, RPi PICO
Pavel1TU
"Správně napsaný kod lze číst jako knihu"

Maxim
Příspěvky: 128
Registrován: 22 led 2019, 20:32
Reputation: 0

Re: samostatný čip ATMega328P

Příspěvek od Maxim » 20 zář 2020, 18:38

Ahoj,
zkoušel jsem tam nahrávat program přímo přes programátor USBasp, ale taky neúspěšně.
Stahoval jsem tyto ovladače.
https://zadig.akeo.ie/
Na PC mi to ale nejde nainstalovat... nevidí to programátor. Na notebooku mi to jde. Nevěděl by někdo čím to může být? Na PC i notebooku mam win 10.

Na notebooku jsem zkoušel nahrávat program pomocí příkazového řádku příkazem make burn.
Vypadá to, že program to tam nahrává, ale nefunguje.

výpis nahrávání programu:

Kód: Vybrat vše

#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(TEXI2DVI) $(TEXI2DVI_FLAGS) $<

# Not a target:
.sh:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        cat $< >$@
        chmod a+x $@

# Not a target:
.cc:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@

# Not a target:
.cc.o:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(COMPILE.cc) $(OUTPUT_OPTION) $<

# Not a target:
.def:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.r.o:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(COMPILE.r) $(OUTPUT_OPTION) $<

# Not a target:
.r:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(LINK.r) $^ $(LOADLIBES) $(LDLIBS) -o $@

# Not a target:
makefile:
#  A default, MAKEFILES, or -include/sinclude makefile.
#  Implicit rule search has been done.
#  File does not exist.
#  File has been updated.
#  Failed to be updated.
# variable set hash-table stats:
# Load=0/32=0%, Rehash=0, Collisions=0/0=0%

# Not a target:
.info:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.elc:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.l.c:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        @$(RM) $@
        $(LEX.l) $< > $@

# Not a target:
.out:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.r.f:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(PREPROCESS.r) $(OUTPUT_OPTION) $<

# Not a target:
.texinfo.info:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@

# Not a target:
.c:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@

# Not a target:
.w.tex:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(CWEAVE) $< - $@

# Not a target:
.c.ln:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(LINT.c) -C$* $<

# Not a target:
.s.o:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(COMPILE.s) -o $@ $<

# Not a target:
.s:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(LINK.s) $^ $(LOADLIBES) $(LDLIBS) -o $@

# Not a target:
.texinfo.dvi:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(TEXI2DVI) $(TEXI2DVI_FLAGS) $<

# Not a target:
.SUFFIXES: .out .a .ln .o .c .cc .c .cpp .p .f .f .r .y .l .s .s .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo .w .ch .web .sh .elc .el
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.el:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.texinfo:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.y.c:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(YACC.y) $<
        mv -f y.tab.c $@

# Not a target:
.web.tex:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(WEAVE) $<

# Not a target:
.texi.info:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@

# Not a target:
.h:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
burn:
#  Command-line target.
#  Implicit rule search has been done.
#  File does not exist.
#  File has not been updated.
# variable set hash-table stats:
# Load=0/32=0%, Rehash=0, Collisions=0/0=0%

# Not a target:
.tex.dvi:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(TEX) $<

# Not a target:
.cpp.o:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(COMPILE.cpp) $(OUTPUT_OPTION) $<

# Not a target:
.cpp:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(LINK.cpp) $^ $(LOADLIBES) $(LDLIBS) -o $@

# Not a target:
.ln:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.texi:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.txinfo:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.tex:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
m328p:
#  Command-line target.
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.txinfo.info:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@

# Not a target:
.ch:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
GNUmakefile:
#  A default, MAKEFILES, or -include/sinclude makefile.
#  Implicit rule search has been done.
#  File does not exist.
#  File has been updated.
#  Failed to be updated.
# variable set hash-table stats:
# Load=0/32=0%, Rehash=0, Collisions=0/0=0%

# Not a target:
.S.s:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(PREPROCESS.S) $< > $@

# Not a target:
.mod:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(COMPILE.mod) -o $@ -e $@ $^

# Not a target:
.mod.o:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(COMPILE.mod) -o $@ $<

# Not a target:
.F.f:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(PREPROCESS.F) $(OUTPUT_OPTION) $<

# Not a target:
.w:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.c.o:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(COMPILE.c) $(OUTPUT_OPTION) $<

# Not a target:
.web:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.sym:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.

# Not a target:
.f:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@

# Not a target:
.f.o:
#  Implicit rule search has not been done.
#  Modification time never checked.
#  File has not been updated.
#  commands to execute (built-in):
        $(COMPILE.f) $(OUTPUT_OPTION) $<

# files hash-table stats:
# Load=64/1024=6%, Rehash=0, Collisions=255/1438=18%
# VPATH Search Paths

# No `vpath' search paths.

# No general (`VPATH' variable) search path.

# # of strings in strcache: 0
# # of strcache buffers: 0
# strcache size: total = 0 / max = 0 / min = 4096 / avg = 0
# strcache free: total = 0 / max = 0 / min = 4096 / avg = 0

# Finished Make data base on Sun Sep 20 18:24:28 2020
samostatný krystal ani kondenzátory nemám, bez toho to nejde?

Hanz
Příspěvky: 262
Registrován: 25 dub 2019, 23:52
Reputation: 0

Re: samostatný čip ATMega328P

Příspěvek od Hanz » 20 zář 2020, 23:52

hned na začátku píšeš
Mám Arduino s vyndavacím čipem nebo ISP programátor, případně můžu něco dokoupit, pokud bude potřeba.
tak pokud nemáš krystal a kondy použij ISP programátor ;)
viz.návod zde : https://blog.laskarduino.cz/oprava-arduino-bootloaderu/
tady jsou popsány obě programovací varianty
myslím si, že je jedno jestli bootloader v Amega328 chybí nebo je poškozen, ty ho potřebuješ nahrát / přehrát
A pokud můžu poradit, vyzkoušej variantu s ISP programátorem, který máš doma. :lol:

Maxim
Příspěvky: 128
Registrován: 22 led 2019, 20:32
Reputation: 0

Re: samostatný čip ATMega328P

Příspěvek od Maxim » 21 zář 2020, 08:34

připojil sem programátor na čim viz foto.
Můžu si v IDE jen nějak ověřit, že ten programátor správně komunikuje?
Přílohy
IMG_20200921_083045[1].jpg
IMG_20200921_083040[1].jpg

Maxim
Příspěvky: 128
Registrován: 22 led 2019, 20:32
Reputation: 0

Re: samostatný čip ATMega328P

Příspěvek od Maxim » 21 zář 2020, 15:13

Tak jsem připojil čip na desku UNO a v IDE nastavil desku ATmega328 on breadbord a podařilo se mi získat informace o desce.

BN: Arduino Uno
VID: 2341
PID: 0043
SN: 7573532343035111C1A2

to je ale asi komunikace té desky UNo, že?
když dám vypálit zavaděč, tak mi to selže..
výpis:

Kód: Vybrat vše

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x03
Chyba při vypalování zavaděče.
Přílohy
IMG_20200921_151133[1].jpg
IMG_20200921_151151[1].jpg

Hanz
Příspěvky: 262
Registrován: 25 dub 2019, 23:52
Reputation: 0

Re: samostatný čip ATMega328P

Příspěvek od Hanz » 21 zář 2020, 16:23

Máš tam špatně zapojený ATmega / vodič navíc z + / a nezapomeň, že může být více pinů VCC a GND na IO viz.tady https://www.danielealberti.it/2013/06/a ... alone.html
Na ATmega - GND propojeny máš a co VCC ?

Odpovědět

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 9 hostů