Arduino Polska Forum

Pełna wersja: Nieprawidłowa praca WDT
Aktualnie przeglądasz uproszczoną wersję forum. Kliknij tutaj, by zobaczyć wersję z pełnym formatowaniem.
Stron: 1 2
Cześć, dodałem do swojego projektu WDT i testowałem jego pracę okazało się iż zaczyna resetować cały czas w kółko kilka razy na sekundę a nie jednorazowo jak dopiero ponownie sie zawiesi co to może być za przyczyna? sprzęt to klon Arduino nano na atmedze328 dodam że jak robiłem oddzielny projekt w którym wykorzystałem sam mikrokontroler atmega328 z własnymi komponentami oraz na innym oryginalnym arduino np leonardo to działało wszystko poprawnie. Czyżby to wina chińskich podróbek?
Niewykluczone, choć może tylko częściowo. Jak masz stary bootloader, taki działający w okolicach 57600 baudrate to wgraj nowy. Płytki sprzedawane z Chin ciągle mają stary bootloader, choć w oryginałach ten problem został rozwiązany wiele lat temu.
To może wrzuć projekt by była jasność. Bo przyczyn może być sporo mi na klonach na starym bootloaderze normalnie działa. Miałem tylko problem jak trzeba było budzić ze SLEP-u.
A no fakt w ardu IDE muszę zaznaczyć staty bootloader bo na normalnym nie wgrywa programu. Oki spróbuję wgrać nowy bootloader i jak nie pomoże to wrzucę projekt i będziemy dalej kombinowali, dzięki!!!
Niestety nie udało mi się wgrać booloadera wyskakują jakieś błędy urządzenie się zresetuje jak chce wgrywać i wyskakuje taki komunikat
Błąd przy wgrywaniu bootloadera.
avrdude: Expected signature for ATmega328P is 1E 95 0F
Double check chip, or use -F to override this check.
OVERRIDE! OVERRIDE! Nie no, sprawdź lupą dokładnie jakie masz oznaczenie, najprawdopodobniej właśnie tak jest, że nieco inny uC, zainstaluj mini core, tam jest więcej uC do wyboru. Z poziomu Arduino IDE nie zrobisz OVERRIDE, bo tu nie ma żadnych opcji by coś dopisać w parametry programowania. No jest w pliku bards.txt.
Miałem podobny przypadek z uC w NANO dla Atmaga168, otworzyłem PDFy tych dwóch uC, porównałem, że niczym istotnym się nie różnią, coś tam było tylko z napięciami, nic od strony programowej, w pliku boards.txt zrobiłem kopię sekcji UNO z inną nazwą i podmieniłem nazwę uC, FUSE i bootloader wziąłem z NANO 168, w MENU pojawiła się nowa płytka dla tych ustawień.
Nie mniej jednak ciągle korzystam z możliwości takiego dodania płytki z palca, bo, choć bardzo rzadko, to jednak się zdarza, że coś może działać gorzej z mini core, tam nieco "poprawili" również funkcje, na pewno coś mi się wywaliło. Chodziło o wielkość wsadu, miałem jeden projekt ściągnięty z internetu, zrobiony dla UNO, ale się nie mieścił. W minicore jest opcja użycia płytki bez bootloadera i dostaje się te 512 bajów więcej, ale projekt skompilowany w minicore zwiększył się o więcej niż 512, zrobiona kopia UNO bez botloadera i projekt skompilowany dla standardowego CORE zmieścił się do Flash.
Kurcze nie wiem co to mini core wiem tylko że mam dodane w menadżerze płytek i tam do wyboru mam jakąś atmege ale to nie całą płytke Arduino. Próbowałem zrobić tą sztuczkę w notatniku (w sensie skopiować i przerobić aby mieć nową płytke do wyboru) lecz pogubiłem się tam bo nie wiem dokłądnie jak co gdzie skopiować aby nie narobić szkody. Jesteś w stanie skopiować mi to abym mógł wgrać nowy bootloader? Ciężko było coś przez lupę zobaczyć ale na pewno są dwa znaki za MEGA328 wiec wychodzi na to że to jest chyba Atmega328PB.     Chyba że robię coś źle w WDT lecz na innej atmedze i innym projekcie tak działało dodaje biblioteke WDT inicjaluzje w setupie wdt i ustawiam czas i resetuje go w loopie i tyle czy może jakaś inna technika WDT?

Wyskakuje taki ciąg informacji o błędzie 
avrdude: Version 6.3-20190619
        Copyright © 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright © 2007-2014 Joerg Wunsch

        System wide configuration file is "C:\Users\mateu\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

        Using Port                    : usb
        Using Programmer              : usbasp
        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 : usbasp
        Description    : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: Expected signature for ATmega328P is 1E 95 0F
        Double check chip, or use -F to override this check.

avrdude done.  Thank you.

Failed chip erase: uploading error: exit status 1
probably m328pb - to masz nowszy chip, ten ma dwa UART.
Normalnie wpisz w Google "Arduino Mini core", jest instrukcja krok po kroku, kopiujesz linijkę w odpowiednie okienko Arduino, potem w managerze płytek dodajesz ten core (instalujesz), chwile ściąga pliki i masz dodatkowy zestaw płytek Arduino, między innymi jest 328PB.
Kod:
How to install
Boards Manager Installation

This installation method requires Arduino IDE version 1.6.4 or greater.

    Open the Arduino IDE.

    Open the File > Preferences menu item.

    Enter the following URL in Additional Boards Manager URLs:

    https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json

    Open the Tools > Board > Boards Manager... menu item.

    Wait for the platform indexes to finish downloading.

    Scroll down until you see the MiniCore entry and click on it.

    Click Install.

    After installation is complete close the Boards Manager window.

    Note: If you plan to use the *PB series, you need the latest version of the Arduino toolchain. This toolchain is available through IDE 1.8.6 or newer. Here's how you install/enable the toolchain:
        Open the Tools > Board > Boards Manager... menu item.
        Wait for the platform indexes to finish downloading.
        The top is named Arduino AVR boards. Click on this item.
        Make sure the latest version is installed and selected
        Close the Boards Manager window.
No to może masz to mini core, nie musisz mieć płytki z Atmega328PB, wybierasz po prostu Atmega328 i masz tam wszystkie jej warianty, wybierasz właściwy, wgrywasz bootloader. Mikrokontroler jest ważny, a nie płytka, układ pinów jest taki sam (prawie), trzeba uważać by nie używać dodatkowych pinów wersji PB, bo w UNO mogą być podłączone do GND, obejrzyj sobie pinouty tych chipów.
No i to: "*PB series, you need the latest version of the Arduino toolchain. This toolchain is available through IDE 1.8.6 or newer."
Dobra dzięki udało się wgrać bootloader wybierając właśnie atmege328 z wariantem PB lecz teraz nie idzie wgrywać programu moje głównego. Znaczy się tak wgrywałem przez konwerter USB UART i normlanie przez przewód usb a bootloader wgrałem przez USBasp. Wszystko dobrze, np zwykły program blink idzie wgrać lecz jak chcę wgrać mój to są błędy od eepromu bo w projekcie używam eepromu lecz kiedy wybiore normalnie płytke arduino nano to kompiluje się dobrze bez żadnych błędów tak jak to działało przed wgraniem bootloadera i zaczyna wgrywać lecz przestaje i wyskakują różne komunikaty w zależności jaki wariant wybiore

Taki komunikat jak wgrywam normalnie mój program przez usb z wybraną płytką nano:
avrdude: Version 6.3-20190619
Copyright © 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright © 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Users\mateu\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

Using Port : COM17
Using Programmer : arduino
Overriding Baud Rate : 57600
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xfe
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xfe
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xfe
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xfe
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xfe
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xfe
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xfe
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xfe
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xfe
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xfe

avrdude done. Thank you.

Failed uploading: uploading error: exit status 1


a taki błąd juz w trakcie kompilacji jak mam wybraną opcje atmegi bez płytki. i takich jest wiele linijek pewnie do każdego miejsca gdzie używam eeprom


In file included from C:\Users\mateu\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3\cores\MCUdude_corefiles/USBAPI.h:25:0,
from C:\Users\mateu\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3\cores\MCUdude_corefiles/Arduino.h:300,
from C:\Users\mateu\AppData\Local\Temp\arduino-sketch-2F07BC2C867A2B31B457F83ADFDF64FA\sketch\Sterownik pieca dla Sebastian Jarzabek v1.9 AKTUALNY.ino.cpp:1:
c:\users\mateu\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr\eeprom.h:187:6: note: initializing argument 2 of 'void eeprom_write_block(const void*, void*, size_t)'
void eeprom_write_block (const void *__src, void *__dst, size_t __n);
^~~~~~~~~~~~~~~~~~
exit status 1

Compilation error: invalid conversion from 'volatile void*' to 'void*' [-fpermissive]
Stron: 1 2