PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : [ERLEDIGT] Asuro Lib und Kollisionstest Problem



Marph
10.07.2015, 23:15
Hallo Roboternetz Community,

ich habe seit einer Weile einen Asuro. Bisher habe ich die originale Library von der AsuroCD verwendet, da ich mir aber ein Ultrasonic Bausatz geholt habe möchte ich die neuere Asuro Lib verwenden.

Installiert habe ich die Asuro Lib 2.80 rc2 und diese im Atmel Studio 6.2, welches ich zum programmieren verwende, eingebunden.

Als erstes habe ich den Code vom Kollisions Test (http://www.asurowiki.de/pmwiki/pmwiki.php/Main/KollisionsTestC) in ein neues Projekt eingefügt, es kompiliert und dann auf den Asuro geflasht.
Resultat: Der Asuro dreht permanent den linken Motor rückwärts.

Daraufhin habe ich den Tasten Sensor Test (http://www.asurowiki.de/pmwiki/pmwiki.php/Main/TastSensorTestC) durchgeführt, welcher mir aber jeweils die richtigen Werte im Terminal ausgibt. Nur manchmal erkennt er einen Taster erst nach zwei-dreimaligem drücken.

Danach habe ich nochmal den Kollisions Test auf den Asuro gelasht, dieses mal aber die bereits kompilierte hex Datei im examples/KollisionTest-Ordner. Erstaunlicher Weise funktioniert hier das Programm wie es soll, Asuro fährt vorwärts und bei Kollision fährt er rechts bzw links Rückwärts und wieder vorwärts bis zur nächsten Kollision.

Als weiteren Test habe ich den Code vom Kollisions Test in mein altes Projekt kopiert, bei dem ich noch die originale Library verwende. Hier musste ich nur die Funktion MSleep(), mit in den Quellcode schreiben, da diese nicht in der alten Library enthalten ist.
Siehe da auch hier funktioniert das Programm wie erwartet.

Leider bin ich jetzt an einem Punkt, wo ich nicht weiß wo ich den Fehler finden könnte.
Falls jemand dieses Verhalten kennt oder einen Ansatz hat, wonach ich suchen könnte, würde ich mich sehr freuen.

Mfg Marph

m.a.r.v.i.n
11.07.2015, 11:09
Hallo Marph,

willkommen im RN-Forum.

Zu deinem Problem würde ich vorschlagen, die Taster Kalibrierung (http://www.asurowiki.de/pmwiki/pmwiki.php/Main/TastenKalibrierungC) durchzuführen. Falls der gefundene Wert von der Voreinstellung (62) abweicht, muss die myasuro.h angepasst werden und die AsuroLib neu übersetzt werden.

Marph
12.07.2015, 23:18
Hallo m.a.r.v.i.n,

danke für deine Antwort.

Die Tastenkalibrierung liefert mir vernünftige Werte.
Da ich zwei kleine Ausreißer hatte, habe ich die MY_SWITCH_VALUE in der myasuro.h von 62 auf 63 gestellt.
Danach habe ich die make-lib.bat ausgeführt um die Library neu zu kompilieren, mein Projekt mit dem Kollisions Test Code ebenfalls neu kompiliert und dann auf den Asuro geflasht.
Resultat ist wieder: Permanent dreht der linke Motor rückwärts.

Anbei auch meine makefile (im txt Format) und ein Screenshot von meiner Atmel Studio Config.
Die asuro.c hab ich mittels "Add as Link" eingebunden, so dass auf die asuro.c im lib Ordner gezeigt wird und nicht auf eine Kopie im Project Ordner.




Tastsensor Kalibration

Press Key 6
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 5
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 4
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
Press Key 3
60 61 62 63 64 65 66 67
Press Key 2
61 62 63 64 ¦
Press Key 1
62 63
Press Key 6
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 5
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 4
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
Press Key 3
60 61 62 63 64 65 66 67
Press Key 2
61 62 63 64
Press Key 1
62 63 ¦¦
Press Key 6
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 5
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 4
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
Press Key 3
60 61 62 63 64 65 66 67
Press Key 2
61 62 63 64
Press Key 1
63 64
Press Key 6
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 5
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 4
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
Press Key 3
60 61 62 63 64 65 66 67
Press Key 2
61 62 63 64
Press Key 1
62 63 ¦ ¦¦h¦¦
Press Key 6
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 5
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 4
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
Press Key 3
60 61 62 63 64 65 66 67
Press Key 2
61 62 63 64
Press Key 1
62 63
Press Key 6
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 5
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 4
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
Press Key 3
60 61 62 63 64 65 66 67 ¦
Press Key 2
61 62 63 64
Press Key 1
63 64
Press Key 6
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 ¦
Press Key 5
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
Press Key 4
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
Press Key 3
60 61 62 63 64 65 66 67
Press Key 2
61 62 63 64
Press Key 1
62 63
¦¦¦¦¦¦¦¦¦¦

Valen
13.07.2015, 19:11
Das Bild das du an gehangen hat ist viel zu klein. Da kann man nichts auf erkennen.

Du hast auch den makefile angehangen. Das is nicht den Asuro.c lib datei.

Marph
13.07.2015, 21:24
Hallo Valen,

ich habe die makefile angehängt um mein Vorgehen darzulegen. Gerne hänge ich auch die asuro.c an.

Wieso das Bild so klein ist verstehe ich noch nicht ganz, jedes mal wenn ich ein Bild im Anhang hochlade wird es automatisch komprimiert.

So sollte es gehen:
https://picload.org/image/iioggod/atmelstudio.png

Ich verstehe halt (noch) nicht, wo ich den Fehler machen/finden kann.

Mfg Marph

Valen
13.07.2015, 21:58
Naja, die Asuro.c datei ist auch nicht so interessant. Weil du das nicht geändert hat,oder? Das können wir schon runter laden wenn wir es nicht schon haben. Dein eigene Programm hochladen ist wichtiger.

Gab es beim compilieren kein Meldungen? Ich kenne mich mit das Atmel Studio Programm nicht aus, aber ich vermute sie stecken dort auf das "Build Event" tab.

Und was ist diesen "libm" das du als Library eingesteckt hat?

Marph
13.07.2015, 22:21
Wie ich bereits in meinem ersten Post geschrieben habe, habe ich den Code vom Kollisions Test (http://www.asurowiki.de/pmwiki/pmwiki.php/Main/KollisionsTestC) in mein Projekt kopiert. Auch das muss nicht nochmal hochgeladen werden.

Die libm war automatisch im neu erstellten Projekt und verweißt auf: Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin
Es macht aber kein Unterschied, wenn ich die Lib lösche, was ich getan habe.

So sieht der Output Log aus wenn ich im Atmel Studio den Build-Befehl ausführe:

------ Build started: Project: Asuro-Project280, Configuration: Debug AVR ------
Build started.
Project "Asuro-Project280.cproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "D:\Programme\Office\Atmel Studio 6.2\Vs\Compiler.targets" from project "D:\Programme\Office\Asuro-Project280\Asuro-Project280.cproj" (target "Build" depends on it):
Task "RunCompilerTask"
Shell Utils Path D:\Programme\Office\Atmel Studio 6.2\shellUtils
D:\Programme\Office\Atmel Studio 6.2\shellUtils\make.exe -C "D:\Programme\Office\Asuro-Project280" -f "Makefile" all
make: Entering directory `D:/Programme/Office/Asuro-Project280'
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/version.lst D:/Programme/Office/Asuro-Project280/lib/version.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > version.d; \
[ -s version.d ] || rm -f version.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/ultrasonic.lst D:/Programme/Office/Asuro-Project280/lib/ultrasonic.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > ultrasonic.d; \
[ -s ultrasonic.d ] || rm -f ultrasonic.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/uart.lst D:/Programme/Office/Asuro-Project280/lib/uart.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > uart.d; \
[ -s uart.d ] || rm -f uart.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/time.lst D:/Programme/Office/Asuro-Project280/lib/time.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > time.d; \
[ -s time.d ] || rm -f time.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/switches.lst D:/Programme/Office/Asuro-Project280/lib/switches.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > switches.d; \
[ -s switches.d ] || rm -f switches.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/sound.lst D:/Programme/Office/Asuro-Project280/lib/sound.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > sound.d; \
[ -s sound.d ] || rm -f sound.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/rc5.lst D:/Programme/Office/Asuro-Project280/lib/rc5.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > rc5.d; \
[ -s rc5.d ] || rm -f rc5.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/printf.lst D:/Programme/Office/Asuro-Project280/lib/printf.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > printf.d; \
[ -s printf.d ] || rm -f printf.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/print.lst D:/Programme/Office/Asuro-Project280/lib/print.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > print.d; \
[ -s print.d ] || rm -f print.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/my_motor_low.lst D:/Programme/Office/Asuro-Project280/lib/my_motor_low.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > my_motor_low.d; \
[ -s my_motor_low.d ] || rm -f my_motor_low.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/motor_low.lst D:/Programme/Office/Asuro-Project280/lib/motor_low.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > motor_low.d; \
[ -s motor_low.d ] || rm -f motor_low.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/motor.lst D:/Programme/Office/Asuro-Project280/lib/motor.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > motor.d; \
[ -s motor.d ] || rm -f motor.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/leds.lst D:/Programme/Office/Asuro-Project280/lib/leds.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > leds.d; \
[ -s leds.d ] || rm -f leds.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/lcd.lst D:/Programme/Office/Asuro-Project280/lib/lcd.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > lcd.d; \
[ -s lcd.d ] || rm -f lcd.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/i2c.lst D:/Programme/Office/Asuro-Project280/lib/i2c.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > i2c.d; \
[ -s i2c.d ] || rm -f i2c.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/globals.lst D:/Programme/Office/Asuro-Project280/lib/globals.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > globals.d; \
[ -s globals.d ] || rm -f globals.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/encoder_low.lst D:/Programme/Office/Asuro-Project280/lib/encoder_low.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > encoder_low.d; \
[ -s encoder_low.d ] || rm -f encoder_low.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/encoder.lst D:/Programme/Office/Asuro-Project280/lib/encoder.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > encoder.d; \
[ -s encoder.d ] || rm -f encoder.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/adc_low.lst D:/Programme/Office/Asuro-Project280/lib/adc_low.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > adc_low.d; \
[ -s adc_low.d ] || rm -f adc_low.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/adc.lst D:/Programme/Office/Asuro-Project280/lib/adc.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > adc.d; \
[ -s adc.d ] || rm -f adc.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/asuro.lst D:/Programme/Office/Asuro-Project280/lib/asuro.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > asuro.d; \
[ -s asuro.d ] || rm -f asuro.d
set -e; avr-gcc -MM -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=Asuro-Project280.lst Asuro-Project280.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > Asuro-Project280.d; \
[ -s Asuro-Project280.d ] || rm -f Asuro-Project280.d
make: Leaving directory `D:/Programme/Office/Asuro-Project280'
make: Entering directory `D:/Programme/Office/Asuro-Project280'
-------- begin --------
avr-gcc --version
avr-gcc (AVR_8_bit_GNU_Toolchain_3.4.5_1522) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=Asuro-Project280.lst Asuro-Project280.c -o Asuro-Project280.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/asuro.lst D:/Programme/Office/Asuro-Project280/lib/asuro.c -o asuro.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/adc.lst D:/Programme/Office/Asuro-Project280/lib/adc.c -o adc.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/adc_low.lst D:/Programme/Office/Asuro-Project280/lib/adc_low.c -o adc_low.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/encoder.lst D:/Programme/Office/Asuro-Project280/lib/encoder.c -o encoder.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/encoder_low.lst D:/Programme/Office/Asuro-Project280/lib/encoder_low.c -o encoder_low.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/globals.lst D:/Programme/Office/Asuro-Project280/lib/globals.c -o globals.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/i2c.lst D:/Programme/Office/Asuro-Project280/lib/i2c.c -o i2c.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/lcd.lst D:/Programme/Office/Asuro-Project280/lib/lcd.c -o lcd.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/leds.lst D:/Programme/Office/Asuro-Project280/lib/leds.c -o leds.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/motor.lst D:/Programme/Office/Asuro-Project280/lib/motor.c -o motor.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/motor_low.lst D:/Programme/Office/Asuro-Project280/lib/motor_low.c -o motor_low.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/my_motor_low.lst D:/Programme/Office/Asuro-Project280/lib/my_motor_low.c -o my_motor_low.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/print.lst D:/Programme/Office/Asuro-Project280/lib/print.c -o print.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/printf.lst D:/Programme/Office/Asuro-Project280/lib/printf.c -o printf.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/rc5.lst D:/Programme/Office/Asuro-Project280/lib/rc5.c -o rc5.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/sound.lst D:/Programme/Office/Asuro-Project280/lib/sound.c -o sound.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/switches.lst D:/Programme/Office/Asuro-Project280/lib/switches.c -o switches.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/time.lst D:/Programme/Office/Asuro-Project280/lib/time.c -o time.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/uart.lst D:/Programme/Office/Asuro-Project280/lib/uart.c -o uart.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/ultrasonic.lst D:/Programme/Office/Asuro-Project280/lib/ultrasonic.c -o ultrasonic.o
avr-gcc -c -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=D:/Programme/Office/Asuro-Project280/lib/version.lst D:/Programme/Office/Asuro-Project280/lib/version.c -o version.o
avr-gcc -mmcu=atmega8 -DF_CPU=8000000UL -I. -g -Os -ID:/Programme/Office/Asuro-Project280/lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wa,-ahlms=Asuro-Project280.o Asuro-Project280.o asuro.o adc.o adc_low.o encoder.o encoder_low.o globals.o i2c.o lcd.o leds.o motor.o motor_low.o my_motor_low.o print.o printf.o rc5.o sound.o switches.o time.o uart.o ultrasonic.o version.o --output Asuro-Project280.elf -Wl,--gc-sections,-Map=Asuro-Project280.map,--cref -LD:/Programme/Office/Asuro-Project280/lib -lm
avr-objcopy -O ihex -R .eeprom Asuro-Project280.elf Asuro-Project280.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O ihex Asuro-Project280.elf Asuro-Project280.eep
d:\Programme\Office\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-objcopy.exe: --change-section-lma .eeprom=0x00000000 never used
avr-objdump -h -S Asuro-Project280.elf > Asuro-Project280.lss
Size after:
Asuro-Project280.elf :
section size addr
.text 1432 0
.data 10 8388704
.bss 35 8388714
.comment 48 0
.debug_aranges 376 0
.debug_info 3165 0
.debug_abbrev 1599 0
.debug_line 1800 0
.debug_frame 748 0
.debug_str 1026 0
.debug_loc 1169 0
.debug_ranges 240 0
Total 11648
Errors: none
-------- end --------
make: Leaving directory `D:/Programme/Office/Asuro-Project280'
Done executing task "RunCompilerTask".
Using "RunOutputFileVerifyTask" task from assembly "D:\Programme\Office\Atmel Studio 6.2\Extensions\Application\AvrGCC.dll".
Task "RunOutputFileVerifyTask"

Display Output File Size Skipped due to : Output File not found
Done executing task "RunOutputFileVerifyTask".
Done building target "CoreBuild" in project "Asuro-Project280.cproj".
Target "PostBuildEvent" skipped, due to false condition; ('$(PostBuildEvent)' != '') was evaluated as ('' != '').
Target "Build" in file "D:\Programme\Office\Atmel Studio 6.2\Vs\Avr.common.targets" from project "D:\Programme\Office\Asuro-Project280\Asuro-Project280.cproj" (entry point):
Done building target "Build" in project "Asuro-Project280.cproj".
Done building project "Asuro-Project280.cproj".

Build succeeded.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

Also keine Fehlermeldung oder dergleichen.

m.a.r.v.i.n
15.07.2015, 17:33
Hallo Marph,

das sieht soweit alles i. O. aus. Lass dir doch mal die eingelesenen Tasterwerte seriell ausgeben. Dann wird man ja sehen, welcher Taster spinnt. Den kann man dann ggfs. aus der Abfrage ausmaskieren.



...
else if (t1 && t2 && t1 == t2)
{
PrintInt(t1); /* Tastenwert senden */
SerWrite("\r\n", 2); /* Zeilenvorschub */

MotorStop();
if(t1 & 0x07) /* Tasten links gedrückt? */
{
MotorRwdL(); /* Rückwärtskurve links fahren */
FrontLED(OFF);
BackLED(ON,OFF);
}
if (t1 & 0x38) /* Tasten rechts gedrückt? */
{
MotorRwdR(); /* Rückwärtskurve rechts fahren */
FrontLED(OFF);
BackLED(OFF,ON);
}
Msleep(1000); /* 1 Sekunde fahren */
}
...

Marph
16.07.2015, 21:10
Hallo m.a.r.v.i.n,

ich hab den Code eingepflegt und mehrere Durchläufe gemacht. Nach einigen Durchläufen gabs eine Low Voltage Meldung. Hab dann die Batteriespannung gemessen, die bei 1,46V pro Batterie lag(keine Akkus, Jumpers ist nicht gesetzt).

Hab dann sicherheitshalber neue Batterien eingelegt und danach funktionierte es sogar zweimal mit dem Kollisionstest. Dann drehte er aber wieder permanent links rückwärts oder drehte vorwärts und reagierte auf überhaupt keinen Tastendruck. Und auch mit den neuen Batterien hatte ich zweimal eine Low Voltage Meldung.

Spaßeshalber hab ich dann noch den Kollisionstest mit der originalen Library geflasht und damit lief alles wieder tadellos.

Des Weiteren habe ich mir Programmers Notepad runtergeladen und auch dort den Kollisionstest mit der v2.80 rc2 Library kompiliert, allerdings mit dem gleichen Resultat wie bisher.



MY_SWITCH_VALUE = 62L

1
2
1
1
2
1
2
1
2
1
2
2
3
2
1
1
1
1
1
2
1
1
3
1
1
1
1
1
1
2
3
3

MY_SWITCH_VALUE = 63L
1
1
2
2
2
1
1
2
1
2
2
1
1
1
1
2
1
2
1
1
1
2
2
1
1
2
1
1
1
1

MY_SWITCH_VALUE = 63L

1
1
1
224
2
1
2
2
1
▒1
▒▒▒1
1
▒▒VLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVL VLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVL VLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVL VLVL

VLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVLVL▒1
2
1
1
1
1
2
1
1
1
1


Neue Batterien:
MY_SWITCH_VALUE = 63L

2
1
1
22
1
1
2
2
1
2
1
1
1
1

Mfg Marph

m.a.r.v.i.n
18.07.2015, 12:00
Hallo Marph,


tja das könnte alles mögliche sein. Wie man aus dem Log sieht, ist nicht nur Taster K1 sondern auch manchmal K2 zu sehen.


Fehlerursachen könnten sein:
* schlechte Lötstellen,
* miese Batterien (z.B. Zink Kohle) vielleicht besser Alkaline AA Zellen mit entsprechendem Batteriefach verwenden,
* bis hin zu Compiler Optimierungen die etwas wichtiges wegoptimieren (hatten wir in der Vergangenheit auch schon mal).

Zumal es mit dem Original Hex File scheinbar problemlos funktioniert. Die Original Hex Files wurden mit WinAVR-2010 erstellt.

Andere Idee, in irgendeinem alten Thread wurde bis zu 6x mal die Taster abgefragt und verglichen.



---
while(1)
{
t1 = PollSwitch();
t2 = PollSwitch();
t3 = PollSwitch();
t4 = PollSwitch();
t5 = PollSwitch();
t6 = PollSwitch();
if(t1 == 0 && t2 == 0 && t3 == 0 && t4 == 0 && t5 == 0 && t6 == 0)/* keine Taste */
{
MotorFwd(); /* vorwärts fahren */
FrontLED(ON);
BackLED(OFF,OFF);
}
elseif(t1 && t2 && t3 && t4 && t5 && t6 && t1 == t2 && t1 == t3 && t1 == t4 && t1 == t5 && t1 == t6)
...

Marph
19.07.2015, 10:26
Hallo m.a.r.v.i.n,

vielen Dank für deine Einschätzung.

Als Compilier verwende ich WinAVR-20100110. Zumindest habe ich diese Version installiert und wenn ich es richtig verstehe gebe ich in der Makefile ja vor, das WinAVR als compilier verwendet wird und nicht die AVR Toolchain, die mit Atmel Studio mitinstalliert wurde.

Als Batterien verwende ich wirklich sehr billige R03 AAA. Da ich aber sowieso auf Akkus umsteigen wollte habe ich jetzt ein 4x AA Bateriahalter mit hochwertigen NiMH-Akkus bestellt.

Zudem habe ich den Ansatz, die Taster häufiger abzufragen, probiert und damit erfolg gehabt. Bei 6-facher Abfrage, reagiert er wie er soll, ohne "falsche Kollision". Darauf hin habe ich die Anzahl der Tastenabfragen schrittweise reduziert und jedesmal das Verhalten überprüft.
Resultat:
Mit 4-facher Abfrage läuft die Kollisionserkennung stabil. Bei 3-facher Abfrage gibt es noch vereinzelt "falsche Kollisionen".

Ich verstehe jedoch immer noch nicht warum die vorkompilierte Version, die die Taster nur 2-fach abfragt, funktioniert und die selbst kompilierte 4-fach abfragen muss um das gleiche Resultat zu erzielen.
Da ja in beiden Fällen die gleiche Hardware verwendet wird, müsste man diese als Fehlerquelle doch ausschliessen können!? (zumindest von meinem Verständnis als Roboter-Anfänger)

Zumindest bin ich erstmal zufrieden, da ich jetzt mit der AsuroLib weiter programmieren kann.
Dafür vielen Dank!

Mfg Marph

P.S. Bevor ich das Thema als erledigt markiere will ich noch mit den Akkus testen, ob dann eine 2-fache Abfrage ausreicht.

m.a.r.v.i.n
19.07.2015, 12:54
Hallo Marph,




Als Compilier verwende ich WinAVR-20100110. Zumindest habe ich diese Version installiert und wenn ich es richtig verstehe gebe ich in der Makefile ja vor, das WinAVR als compilier verwendet wird und nicht die AVR Toolchain, die mit Atmel Studio mitinstalliert wurde.



das kann so nicht stimmen, aus den Log-Files entnehme ich GCC 4.8.1 als Compiler, WinAVR-1010 verwendet GCC 4.3.3.


Leider finde ich den Thread nicht mehr, in dem die Pollswitch Abfrage auf 6 Abfragen erhöht wurde. Dort ließen sich vielleicht weitere Infos entnehmen. Mit 4xAA NiMH Zellen liegst du auf jeden Fall auf der sicheren Seite.

Marph
11.08.2015, 22:22
Mit etwas Verspätung hier nun mein Feedback.

Nach dem Umbau auf 4xAA-NiMH-Stromversorgung läuft die Kollisionserkennung nun auch mit einer 3-fach-Abfrage zuverlässig.

Auch die Compilier Version habe ich mir noch mal angesehen.
Es gibt in den Projekt-Eigenschaften des Atmel Studio die Möglichkeit ein "Toolchain flavour" einzustellen, dort ist standardmäßig "Native" eingestellt, was wohl auf die AVR Toolchain verweißt und die GCC 4.8.1 Version erklärt.

Mittels dieser Anleitung (https://avrstudio5.wordpress.com/2013/03/07/using-winavr-with-atmel-studio-6-0-or-later/) habe ich dann WinAVR eingebunden und ausgewählt, woraufhin mir im make-Log auch GCC 4.3.3 angezeigt wird.

Obwohl ich etwas anderes erwartet habe, funktioniert der Code ,wenn ich ihn mit GCC 4.3.3 compiliere, leider wesentlich unzuverlässiger. Verwende ich GCC 4.8.1 läuft die Kollisionserkennung wie erwähnt mit 3-fach-Abfrage stabil. Verwende ich GCC 4.3.3 muss ich für die gleiche Zuverlässigkeit 5-fach abfragen.

Grundsätzlich bin ich aber mit der Lösung des Problems zufrieden.
Und da ich vor habe noch eine ganze Weile mit dem Asuro zu lernen, setze ich die Compiler-Geschichte auf meine ToDo-Liste und werde mich später noch in die Thematik einarbeiten. Vielleicht kommt dann auch das Verständnis für das beobachtete Verhalten unter zwei verschiedenen GCC Versionen.

Mfg Marph