Hallo Forum, ich komme mit einem atmega168pa nicht klar. Ich wollte ein auf einem atmega8 schon laufendes Programm - mal eben - auf diesem in Gang setzen. Letztlich läuft irgendwie gar nichts. Inzwischen habe ich ein simples Testprogramm geschrieben und geflasht.
1 | #include <avr/io.h> |
2 | |
3 | int main(void) |
4 | {
|
5 | |
6 | DDRC = 0xff; |
7 | PORTC = 0x00; |
8 | |
9 | while(1) { |
10 | }
|
11 | |
12 | }
|
1 | avr-gcc -mmcu=atmega168 -Wall -DF_CPU=1000000UL -Os -Wall -I/usr/lib/avr/include -c main.c -o obj/Release/main.o |
2 | avr-g++ -L/usr/lib -o bin/Release/Testprojekt.elf obj/Release/main.o -mmcu=at90s2313 -Wl,-Map=bin/Release/Testprojekt.elf.map,--cref |
3 | Output size is 3,36 KB |
4 | Running project post-build steps |
5 | avr-objcopy -O ihex -R .eeprom -R .eesafe bin/Release/Testprojekt.elf bin/Release/Testprojekt.elf.hex |
6 | avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex bin/Release/Testprojekt.elf bin/Release/Testprojekt.elf.eep.hex |
7 | Process terminated with status 0 (0 minutes, 0 seconds) |
8 | 0 errors, 0 warnings (0 minutes, 0 seconds) |
Die fuses habe ich nicht verändert:
1 | Testprojekt$ avrdude -P /dev/ttyS0 -c stk500 -p m168p -U lfuse:r:-:h -U hfuse:r:-:h -U efuse:r:-:h |
2 | |
3 | avrdude: AVR device initialized and ready to accept instructions |
4 | Reading | ################################################## | 100% 0.01s |
5 | avrdude: Device signature = 0x1e940b |
6 | |
7 | avrdude: reading lfuse memory: |
8 | Reading | ################################################## | 100% 0.00s |
9 | avrdude: writing output file "<stdout>" |
10 | 0x62 |
11 | |
12 | avrdude: reading hfuse memory: |
13 | Reading | ################################################## | 100% 0.00s |
14 | avrdude: writing output file "<stdout>" |
15 | 0xdf |
16 | |
17 | avrdude: reading efuse memory: |
18 | Reading | ################################################## | 100% 0.00s |
19 | avrdude: writing output file "<stdout>" |
20 | 0x1 |
21 | |
22 | avrdude: safemode: Fuses OK |
23 | avrdude done. Thank you. |
Der atmega168pa steckt in einem STK500, PC0 ist mit LED0 verbunden. Ich habe erwartet, daß die LED einfach leuchtet, sie blinkt jedoch mit einigen Hz. Für mich sieht das aus, als würde der Controller ständig einen reset machen. Nicht ganz das, was ich wollte. Habt Ihr einen Rat für mich? Gruß, Stephan