Eigenbau Bodenfeuchtesensor wireless, < 20€, v2

Begonnen von tante ju, 07 September 2016, 13:57:27

Vorheriges Thema - Nächstes Thema

darkness

Danke. Bin schon weiter gekommen.

mit
avrdude -P /dev/ttyUSB0 -c arduino -p m328p -B 20.96 -e -U flash:w:Bodenfeuchte_no_5_v2.4.ino.with_bootloader.arduino_standard.hex:a -U lfuse:w:0xE2:m -U hfuse:w:0xD9:m -U efuse:w:0xFD:m -b 57600

Kommt jetzt

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: erasing chip
avrdude: reading input file "Bodenfeuchte_no_5_v2.4.ino.with_bootloader.arduino_standard.hex"
avrdude: input file Bodenfeuchte_no_5_v2.4.ino.with_bootloader.arduino_standard.hex auto detected as Intel Hex
avrdude: writing flash (32768 bytes):

Writing | ################################################## | 100% 2.58s

avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against Bodenfeuchte_no_5_v2.4.ino.with_bootloader.arduino_standard.hex:
avrdude: load data flash data from input file Bodenfeuchte_no_5_v2.4.ino.with_bootloader.arduino_standard.hex:
avrdude: input file Bodenfeuchte_no_5_v2.4.ino.with_bootloader.arduino_standard.hex auto detected as Intel Hex
avrdude: input file Bodenfeuchte_no_5_v2.4.ino.with_bootloader.arduino_standard.hex contains 32768 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.99s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x7e00
         0x0e != 0x11
avrdude: verification error; content mismatch

avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you.


Was bedeutet das

avrdude: verification error, first mismatch at byte 0x7e00
         0x0e != 0x11
avrdude: verification error; content mismatch


PeMue

Hallo darkness,

es könnte sein (je nach Bootloader), dass Dein Sketch etwas zu groß (32768 Byte) ist. Ich gehe mal davon aus, dass Du den Arduino Bootloader geflasht hast, korrekt? Ich weiß leider auf die Schnelle nicht, wie groß dass da der Sketch sein darf  ???

Gruß Peter
RPi3Bv1.2 rpiaddon 1.66 6.0 1xHM-CC-RT-DN 1.4 1xHM-TC-IT-WM 1.1 2xHB-UW-Sen-THPL-O 0.15 1x-I 0.14OTAU  1xCUNO2 1.67 2xEM1000WZ 2xUniroll 1xASH2200 3xHMS100T(F) 1xRFXtrx 90 1xWT440H 3xTFA30.3150 5xFA21
RPi1Bv2 LCDCSM 1.63 5.8 2xMAX HKT 1xMAX RT V200KW1 Heizung Wasser

juergs

#272
... oder, wenn schon was im Flash ist, sollte man diesen erst Löschen  ;)

ZitatC:\Windows\SysWOW64>avrdude -h | clip
avrdude: unknown option -- h
Usage: avrdude [options]
Options:
  -p <partno>                Required. Specify AVR device.
  -b <baudrate>              Override RS-232 baud rate.
  -B <bitclock>              Specify JTAG/STK500v2 bit clock period (us).
  -C <config-file>           Specify location of configuration file.
  -c <programmer>            Specify programmer type.
  -D                         Disable auto erase for flash memory
  -i <delay>                 ISP Clock Delay [in microseconds]
  -P <port>                  Specify connection port.
  -F                         Override invalid signature check.
  -e                         Perform a chip erase.
  -O                         Perform RC oscillator calibration (see AVR053).
  -U <memtype>:r|w|v:<filename>[:format]
                             Memory operation specification.
                             Multiple -U options are allowed, each request
                             is performed in the order specified.
  -n                         Do not write anything to the device.
  -V                         Do not verify.
  -u                         Disable safemode, default when running from a script.
  -s                         Silent safemode operation, will not ask you if
                             fuses should be changed back.
  -t                         Enter terminal mode.
  -E <exitspec>[,<exitspec>] List programmer exit specifications.
  -x <extended_param>        Pass <extended_param> to programmer.
  -y                         Count # erase cycles in EEPROM.
  -Y <number>                Initialize erase cycle # in EEPROM.
  -v                         Verbose output. -v -v for more.
  -q                         Quell progress output. -q -q for less.
  -?                         Display this usage.

avrdude version 5.10, URL: <http://savannah.nongnu.org/projects/avrdude/>

Sorry, sehe gerade war -e schon gesetzt ....

Vieleicht doch mal die richtigen Fuse-Settings einholen.... wenn z.B. Lockbits-Fuses nicht auf 0x3F gesetzt ist.

Bei 0x7E00 ist suspekt.... Bootloader ist protected? Lockbits-Fuses?

Kannst Du mal das HexFile hier anhängen ?

Mit zusätzlichem Parameter :
-v -v   doppelt! sieht man mehr .... ;)

ZitatDetected 1e9315 = ATtiny841
Bodenfeuchte_433MHz_ATiny841_V1.ino.hex: 8.138 / 8.192 Bytes (99,34%)
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

avrdude.exe: set SCK frequency to 32000 Hz
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% -0.00s

avrdude.exe: Device signature = 0x1e9315 (probably t841)
avrdude.exe: erasing chip
avrdude.exe: set SCK frequency to 32000 Hz
avrdude.exe: reading input file "C:\Users\Jürgen\AppData\Local\Temp\arduino_build_132827\Bodenfeuchte_433MHz_ATiny841_V1.ino.hex"
avrdude.exe: input file C:\Users\Jürgen\AppData\Local\Temp\arduino_build_132827\Bodenfeuchte_433MHz_ATiny841_V1.ino.hex auto detected as Intel Hex
avrdude.exe: writing flash (8138 bytes):

Writing | ################################################## | 100% 38.65s

avrdude.exe: 8138 bytes of flash written
avrdude.exe: verifying flash memory against C:\Users\Jürgen\AppData\Local\Temp\arduino_build_132827\Bodenfeuchte_433MHz_ATiny841_V1.ino.hex:
avrdude.exe: load data flash data from input file C:\Users\Jürgen\AppData\Local\Temp\arduino_build_132827\Bodenfeuchte_433MHz_ATiny841_V1.ino.hex:
avrdude.exe: input file C:\Users\Jürgen\AppData\Local\Temp\arduino_build_132827\Bodenfeuchte_433MHz_ATiny841_V1.ino.hex auto detected as Intel Hex
avrdude.exe: input file C:\Users\Jürgen\AppData\Local\Temp\arduino_build_132827\Bodenfeuchte_433MHz_ATiny841_V1.ino.hex contains 8138 bytes
avrdude.exe: reading on-chip flash data:

Reading | ################################################## | 100% 21.51s

avrdude.exe: verifying ...
avrdude.exe: 8138 bytes of flash verified

avrdude.exe done.  Thank you.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

avrdude.exe: set SCK frequency to 32000 Hz
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe: Device signature = 0x1e9315 (probably t841)
avrdude.exe: erasing chip
avrdude.exe: set SCK frequency to 32000 Hz
avrdude.exe: reading flash memory:

Reading | ################################################## | 100% 21.55s

avrdude.exe: Flash is empty, resulting file has no contents.
avrdude.exe: writing output file "C:\Users\Jürgen\AppData\Local\Temp\arduino_build_132827\Bodenfeuchte_433MHz_ATiny841_V1.ino.hex"
avrdude.exe: output file C:\Users\Jürgen\AppData\Local\Temp\arduino_build_132827\Bodenfeuchte_433MHz_ATiny841_V1.ino.hex auto detected as Intel Hex

avrdude.exe done.  Thank you.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

avrdude.exe: Version 6.3, compiled on Feb 17 2016 at 09:25:53
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch

             System wide configuration file is "D:\Work_DotNet\AVRDUDESS-master\src\avrdudess\bin\Debug\avrdude.conf"

             Using Port                    : usb
             Using Programmer              : usbasp
             Setting bit clk period        : 21.0
             AVR Part                      : ATtiny841
             Chip Erase delay              : 4500 us
             PAGEL                         : P00
             BS2                           : P00
             RESET disposition             : possible i/o
             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     6     4    0 no        512    4      0  4000  4500 0xff 0xff
               flash         65    10    16    0 yes      8192   16    512  4500  4500 0xff 0xff
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
               lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

             Programmer Type : usbasp
             Description     : USBasp, http://www.fischl.de/usbasp/

avrdude.exe: set SCK frequency to 32000 Hz
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% -0.00s

avrdude.exe: Device signature = 0x1e9315 (probably t841)
avrdude.exe: erasing chip
avrdude.exe: set SCK frequency to 32000 Hz
avrdude.exe: reading flash memory:

Reading | ################################################## | 100% 21.55s

avrdude.exe: Flash is empty, resulting file has no contents.
avrdude.exe: writing output file "C:\Users\Jürgen\AppData\Local\Temp\arduino_build_132827\Bodenfeuchte_433MHz_ATiny841_V1.ino.hex"
avrdude.exe: output file C:\Users\Jürgen\AppData\Local\Temp\arduino_build_132827\Bodenfeuchte_433MHz_ATiny841_V1.ino.hex auto detected as Intel Hex

avrdude.exe done.  Thank you.


Mit einer GUI: http://blog.zakkemble.co.uk/avrdudess-a-gui-for-avrdude/  für avrdude geht das komfortabler ... auch für den Raspi unter Mono ..


darkness

Hallo,

schon mal vielen Dank für die Unterstützung. Leider bin ich noch nicht erfolgreich gewesen  :'(

Ich habe mir jetzt mal einen Arduino Uno zugelegt, da der (China)Nano scheinbar nicht so recht wollte (wurde in der Arduino IDE unter Boardinformationen nicht erkannt)

Jetzt habe ich folgendes gemacht:

Arduino as ISP Sketch auf den Uno geladen.

Anschließend den Sensor mit dem Arduino verkabelt:

Arduino --> Sensor

Pin 11 --> Pin 4
Pin 12 --> Pin 1
Pin 13 --> Pin 3
Pin 10 --> Pin 5
3.3V --> Pin 2
GND --> Pin 6

Auf dem Uno zwischen Reset und GND einen 10 µF Kondensator

Ergebniss:


Zitat~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: erasing chip
avrdude: reading input file "/home/darkness/Downloads/Bodenfeuchte_no_5_v2.4/Bodenfeuchte_no_5_v2.4.ino.arduino_standard.hex"
avrdude: input file /home/darkness/Downloads/Bodenfeuchte_no_5_v2.4/Bodenfeuchte_no_5_v2.4.ino.arduino_standard.hex auto detected as Intel Hex
avrdude: writing flash (8336 bytes):

Writing | ################################################## | 100% 1.35s

avrdude: 8336 bytes of flash written
avrdude: verifying flash memory against /home/darkness/Downloads/Bodenfeuchte_no_5_v2.4/Bodenfeuchte_no_5_v2.4.ino.arduino_standard.hex:
avrdude: load data flash data from input file /home/darkness/Downloads/Bodenfeuchte_no_5_v2.4/Bodenfeuchte_no_5_v2.4.ino.arduino_standard.hex:
avrdude: input file /home/darkness/Downloads/Bodenfeuchte_no_5_v2.4/Bodenfeuchte_no_5_v2.4.ino.arduino_standard.hex auto detected as Intel Hex
avrdude: input file /home/darkness/Downloads/Bodenfeuchte_no_5_v2.4/Bodenfeuchte_no_5_v2.4.ino.arduino_standard.hex contains 8336 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.08s

avrdude: verifying ...
avrdude: 8336 bytes of flash verified
avrdude: reading input file "0xE2"
avrdude: writing lfuse (1 bytes):

Writing |  ***failed; 
################################################## | 100% 0.06s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xE2:
avrdude: load data lfuse data from input file 0xE2:
avrdude: input file 0xE2 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x00 != 0xe2
avrdude: verification error; content mismatch

avrdude done.  Thank you.


juergs

#274
Hallo darkness,

ich glaube Du hast noch Probleme mit den Fuses ...

Bei meinem Arduino-Nano sind folgende Fuses (externer Quarz!) gesetzt:

L: 0xFF
H: 0xDA
E: 0xFD
LOCK:  0xFF

Anmerkung:
E: EE gibt es nicht! Geht nur von 0xFC ... 0xFF   -> Brown-Out-Detection (FF = disabled)
L: E2 Steht noch auf 8MHz internal Clock, das ist falsch für den Nano/Uno, für die Bodenfeuchte-Platine wohl aber richtig.

Du kannst die Checkbox "set fuses" weglassen wenn sie richtig eingestellt wurden sonnst brennt er sie bei jedem Flashvorgang unnötig mit.

Der Flashspeicher wurde korrekt geschrieben!

Die Fehlermeldungen hier sagen eigentlich nur aus, dass er E2 nicht auf das L- und Extended Fuse Byte schreiben konnte
was ja stimmt:

Zitatavrdude: verifying ...
avrdude: 8336 bytes of flash verified

avrdude: reading input file "0xE2"
avrdude: writing lfuse (1 bytes):

Writing |  ***failed;
################################################## | 100% 0.06s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xE2:
avrdude: load data lfuse data from input file 0xE2:
avrdude: input file 0xE2 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x00 != 0xe2
avrdude: verification error; content mismatch

Da stimmt noch was nicht!


Grüße,
Jürgen




darkness

Jetzt hat er was gemacht  :o

Ich musste im ArduinoSketch noch

#define USE_OLD_STYLE_WIRING auskommentieren, obwohl dort steht das es auf dem uno nicht notwendig ist.

Jetzt teste ich mal weiter  ;D

Zumindest blinkt die rote LED und weiße LED!

juergs

#276
Probiere erst mal einfache Sachen wie den Blink-Sketch, wenn das geht, kann es weiter gehen  :)

PeMue hat hier auch noch einen Super Port-Test-Sketch eingestellt, der wäre ebenfalls hilfreich....
https://forum.fhem.de/index.php/topic,55274.msg511471.html#msg511471


darkness

Also das Sketch und Bootloader wurden geflash und die weiße LED blinkt 5 mal wie beschrieben.

Allerdings blinkt danach die rote durchgehend.

juergs

Ok, dann wäre ich mal raus...
Vielleicht kann Dir jemand aus der Mysensors-Bodenfeuchte-Sparte weiterhelfen.  ;) ;) ;) ;) ;) ;)

darkness

Ich habe gerade noch mal E: 0xFF geflasht.

Danach war auch die Fehlermeldung weg.

Nun habe ich eine weiße und rote leuchtende LED  :o

Aber nochmal ein riesiges Danke für deine Geduld und Unterstützung!

juergs

#280
Wäre noch mal interessant zu wissen, wie die Lock-Bytes bei Deinem Board stehen.
Hier sollte 0xFF stehen.

Wenn 0xCF dort steht, ist der Bootloader protected!


darkness

Jaja, habe den Beitrag ja schon zurück genommen  ;)

Dort steht

0xCF

Das bedeutet?

juergs

#283
Der Bereich für den Bootloader ist geschützt, dieser steht normalerweise sehr weit "hinten" im Flash-Speicherbereich.

Werden Sketche größer kann es sein, dass dieser Bereich unwissentlich überschrieben werden soll bzw. beim Schreiben auf dann auf einen Schreib-Fehler stößt,
wie z.B. bei Dir.  ;)

Der Bootloader wird aber nur zum Flashen über USB/Seriell benötigt. Benutzt man einen Programmer, dann braucht man den Bootloader 
nicht mehr und kann ihn löschen. Damit gewinnt man mehr Platz für das eigentliche Programm ...

darkness

So, läuft alles.   ;D

Nochmals Danke an Alle!