Bootloader írása AVR-Duino -ba AVR Studio-val - HIBA!!!

Processing/Wiring (illetve C) nyelvű programozási fogások, tippek. (AVR-Duino, Arduino, EthDuino, Diecimila, Severino, Nano, LilyPad)
Avatar
norton
Újonc
Újonc
Hozzászólások: 13
Csatlakozott: 2008. április 24. csütörtök, 6:00

Bootloader írása AVR-Duino -ba AVR Studio-val - HIBA!!!

Hozzászólás Szerző: norton »

Sziasztok!

Tegnap hozzájutottam Robitól a duino panelemhez! Super jószág, az biztos! :D
Próbálgattam egy-két dolgot és töröltem a bootloadert. Van egy stk500 -am, szintén Robitól, és most szeretném visszatölteni a bootloadert, hogy kipróbáljam a duino-t a arduino 0012 vel.
A következő lépéseket követtem :

Update !
Lemaradt, hogy AVR Studio val égetem a bootloadert!
*ATmega168 Fuse Settings*

Once set the fuses should read 0xF8, 0xDF and 0xFF, which is equivalent to:

* Boot Flash section size = 1024 words Boot start address = $1C00;
[BOOTSZ=00]; default value
* Boot Reset Vector Enabled (default address = $0000); [BOOTRST=0]
* Brown-out detection disabled; [BODLEVEL=111]
* Ext. Crystal Osc.; Frequency 8.0 - MHz; Startup time PWRDWN/RESET:
16K CK/14 CK + 64ms; [CKSEL=1111 SUT=0]

10. Click the "LockBits" panel of the software.

*ATmega8 and ATmega168 LockBit Settings*

Once set the lockbits should read 0xFF for ATmega8 and 0xCF for ATmega168, which is equivalent to:

* Mode1: No memory lock features enabled
* Application Protection Mode1: No lock on SPM and LPM in
Application Section
* Boot Loader Protection Mode3: LPM and SPM prohibited in Boot
Loader Section

11. With the above settings entered, AVR PROG can automatically burn chips. On the Auto panel, select the following:

* Erase Device
* Program FLASH
* Verify FLASH
* Program Fuses
* Verify Fuses
* Program lock bits
* Verify lock bits

Hit "Start" to program. It should be automatic from there. To program another, just connect it to the programmer, and hit 'Auto.'
Szuperül lefutott a dolog.
Majd a duino 0012 vel próbáltam ezt elküldeni a flashbe:

Kód: Egész kijelölése

int ledPin = 13; // LED connected to digital pin 13

void setup() // run once, when the sketch starts
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}

void loop() // run over and over again
{
digitalWrite(ledPin, HIGH); // sets the LED on
delay(1000); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delay(1000); // waits for a second
}
Majd ezt a hibát kaptam:
Binary sketch size: 1124 bytes (of a 14336 byte maximum)


avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
Robival már konzultáltam, eddig semmi bíztató. Valakinek valami ötlete?

Előre is kössz!
A hozzászólást 2 alkalommal szerkesztették, utoljára norton 2009. március 15. vasárnap, 23:01-kor.
Avatar
norton
Újonc
Újonc
Hozzászólások: 13
Csatlakozott: 2008. április 24. csütörtök, 6:00

Hozzászólás Szerző: norton »

Sziasztok!

Nos, még mielőtt avr-duino üzemmódba kapcsolnék, megpróbáltam bascommal egy led villogtatást:

Kód: Egész kijelölése

$regfile = "m168def.dat"
$crystal = 1600000
$baud = 9600

Config Portb = Output

Do
  Portb = 255
  Waitms 50
  Portb = 0
  Waitms 50
Loop

End
A tapsztalat a következő: a zöld led (PORTB.13) folyamatosan világít. A reset működik, mert mikor megnyomom a gombot, elalszik.

Lehet, hogy valami baj van a Atmega168 al??? A bootloader nem megy, az biztos....
Avatar
kapu48
Elektronbűvölő
Hozzászólások: 3375
Csatlakozott: 2008. augusztus 29. péntek, 6:00

Hozzászólás Szerző: kapu48 »

Ilyen nincsen (PortB.13), Csak PortB.1, és PortB.3 van! :D
A PortB-n van a programozó is miért pont oda tetted a ledeket?
:?:
Avatar
norton
Újonc
Újonc
Hozzászólások: 13
Csatlakozott: 2008. április 24. csütörtök, 6:00

Hozzászólás Szerző: norton »

Szia!

ÁÁÁ, nem portb.13 :oops:, az Arduinoban ledpin=13 ra van rakva a led a minta programban. Megkevert... :)
Azért portb, mert a pb5(sck)-n van a felforrasztott led (avr-duino v3).
De vajon miért világít folyamatosan? Az isp kábelt eltávolítom, amikor próbálom, szóval az nem lehet.
Avatar
kapu48
Elektronbűvölő
Hozzászólások: 3375
Csatlakozott: 2008. augusztus 29. péntek, 6:00

Hozzászólás Szerző: kapu48 »

Túl kicsi a Waitms 50?
Avatar
norton
Újonc
Újonc
Hozzászólások: 13
Csatlakozott: 2008. április 24. csütörtök, 6:00

Hozzászólás Szerző: norton »

Viszont haladás van :)

Hobbielektronikás tutoriálból kiindúlva avr studióban gcc fordítóval a Led villogtatás megy :

Kód: Egész kijelölése

#include <avr/io.h>
#include <util/delay.h>

void led()
{
    for(uint8_t i=0; i<10; i++)
   {
     _delay_ms(200);   
   }
}
int main(void)
{
   DDRD=0xFF;
   while(1)
   {
	PORTB=0x00;
	led();
	PORTB=0xFF;
	led();
    }
}
Viszont továbbra sem értem, hogy a bootloader miért nem megy? Fuse ill. Lock bitekkel lehet a baj?
Avatar
norton
Újonc
Újonc
Hozzászólások: 13
Csatlakozott: 2008. április 24. csütörtök, 6:00

Hozzászólás Szerző: norton »

kapu48:

Szia, nem tudom, addig nem jutottam el, de ebben a pillanatban éledt fel avr-studioval. Viszont a bootloader dolog még mindig nyitva....
Avatar
kapu48
Elektronbűvölő
Hozzászólások: 3375
Csatlakozott: 2008. augusztus 29. péntek, 6:00

Hozzászólás Szerző: kapu48 »

Érthető itt 10*200mSec-et vársz! Ezt már érzékeli a szemed!
void led()
{
for(uint8_t i=0; i<10; i++)
{
_delay_ms(200);
}
}
Avatar
norton
Újonc
Újonc
Hozzászólások: 13
Csatlakozott: 2008. április 24. csütörtök, 6:00

Hozzászólás Szerző: norton »

Ok, most már értem! Igazad van, nem figyeltem eléggé, kicsit zavar már az a bootloader dolog. Órák óta böngészem a netet, de semmi eredmény, szinte már mindent kipróbáltam... :x
Avatar
kapu48
Elektronbűvölő
Hozzászólások: 3375
Csatlakozott: 2008. augusztus 29. péntek, 6:00

Hozzászólás Szerző: kapu48 »

Minek az? Én még sosem használtam, csak foglalja a helyet!
Megvan a forráskódja?
Avatar
norton
Újonc
Újonc
Hozzászólások: 13
Csatlakozott: 2008. április 24. csütörtök, 6:00

Hozzászólás Szerző: norton »

Egy hex fájlom van, mellékelik az ar-duinohoz. Robi avr-duino -ja is ezt tartalmazza. Eredetileg a 0012 volt benne.
Követem a lépéseket és nem tetszik neki... (első bejegyzés a témában)
Avatar
kapu48
Elektronbűvölő
Hozzászólások: 3375
Csatlakozott: 2008. augusztus 29. péntek, 6:00

Hozzászólás Szerző: kapu48 »

Fene DEMO/BETA > 4096!
8O
A hozzászólást 2 alkalommal szerkesztették, utoljára kapu48 2009. március 15. vasárnap, 23:29-kor.
Avatar
norton
Újonc
Újonc
Hozzászólások: 13
Csatlakozott: 2008. április 24. csütörtök, 6:00

Hozzászólás Szerző: norton »

Hmm, mivel fordítottad? Avr-studio azt mondja mindenre, hogy ok. :?: http://www.arduino.cc/playground/Learning/Burn168 oldalról szedtem a lépéseket.
Csak az a baj, hogy amikor először kipróbáltam itthon, akkor tökéletesen ment az alapból benne lévő bootloaderrel, egy ledvillogtató program cicergett benne. Aztán töröltem, hogy próbálgassam avr-studioval....
Avatar
norton
Újonc
Újonc
Hozzászólások: 13
Csatlakozott: 2008. április 24. csütörtök, 6:00

Hozzászólás Szerző: norton »

Nos, reggel 10 -től éjfélig tartó szenvedés után siker!!!!!!! :D

Ha valaki törölte a bootloadert, akkor a következő oldalon található lépésekkel visszatöltheti: http://dma.ucla.edu/senselab/node/390

Azthiszem ott rontottam el a dolgokat, hogy mkii isp leírását követtem....
Egyébként az oldalon a atmega 8 hoz van leírás, de értelemszerűen lecserelve a lényeget, használható lesz 168 -hoz is!

Jóccakát :)
Avatar
norton
Újonc
Újonc
Hozzászólások: 13
Csatlakozott: 2008. április 24. csütörtök, 6:00

Hozzászólás Szerző: norton »

Egy kis észtevétel a bootloader töltéshez tegnapró!
Egy kis kutakodás alapján (annak ellenére hogy működik), nem biztos, hogy ezek a legjobb paraméterek

A batch fie a fenti oldalról:

Kód: Egész kijelölése

: Set fuse bits, lock bits, voltages
Stk500.exe -dATmega168 -ut5.2 -ua5.0 -!3686400 -lFF -L -fCADF -F
: Burn Arduino hex bootloader file
Stk500.exe -dATmega168 -pf -e -vf -ifATmegaBOOT_168_diecimila.hex 
: Lock it down
Stk500.exe -dATmega168 -lCF -L
-STK500 command line programmer, v 2.2 Atmel Corp (C) 2004-2005.

Command Line Switches:
[-d device name] [-m s|p] [-if infile] [-ie infile] [-of outfile]
[-oe outfile] [-s] [-O address] [-Sf addr] [-Seaddr] [-e] [-p f|e|b]
[-r f|e|b] [-v f|e|b] [-l value] [-L value] [-y] [-f value] [-E value]
[-F value] [-G value] [-q] [-Y] [-Z address] [-c port] [-ut value]
[-Wt value] [-ua value] [-wt] [-wa] [-b h|s] [-! freq] [-t] [-I freq]
[-J] [-h] [-?]

Examples:
STK500.EXE -dATmega128 -e -ifFlash.hex -pf -vf
STK500.EXE -dATmega128 -fF73A -FF73A -EFF -GFF

Note that there are no spaces between switches and their parameters
and that hexadecimal values do not have a '0x' prefix.

Parameters:
d -- Device name. For a list of supported devices use STK500.EXE -?
m -- Select programming mode; serial (s) or parallel/high-voltage (p).
Serial mode is the default mode if this parameter is ommitted.
if -- Name of FLASH input file. Required for programming or verification
of the FLASH memory. The file format is Intel Extended HEX.
ie -- Name of EEPROM input file. Required for programming or verification
of the EEPROM memory. The file format is Intel Extended HEX.
of -- Name of flash output file. Required for readout of the FLASH memory.
The file format is Intel Extended HEX.
oe -- Name of EEPROM output file. Required for readout of the EEPROM
memory. The file format is Intel Extended HEX.
s -- Read signature bytes.
O -- Read oscillator callibration byte. 'address' is the address of the
calibration byte as decribed in the data sheet of the device.
Sf -- Write oscillator call. byte to FLASH memory. 'addr' is byte address
Se -- Write oscillator call. byte to EEPROM memory. 'addr' is byte address
e -- Erase device. If applied with another programming parameter, the
device will be erased before any other programming takes place.
p -- Program device; FLASH (f), EEPROM (e) or both (b). Corresponding
input files are required.
r -- Read out device; FLASH (f), EEPROM (e) or both (b). Corresponding
output files are required
v -- Verify device; FLASH (f), EEPROM (e) or both (b). Can be used with
-p or stand alone. Corresponding input files are required.
l -- Set lock byte. 'value' is an 8-bit hex. value.
L -- Verify lock byte. 'value' is an 8-bit hex. value to verify against.
y -- Read back lock byte.
f -- Set fuse bytes. 'value' is a 16-bit hex. value describing the
settings for the upper and lower fuse.
E -- Set extended fuse byte. 'value' is an 8-bit hex. value describing the
extend fuse settings.
F -- Verify fuse bytes. 'value' is a 16-bit hex. value to verify against.
G -- Verify extended fuse byte. 'value' is an 8-bit hex. value describing
the extend fuse settings.
q -- Read back fuse bytes.
af -- FLASH address range. Specifies the address range of operations. The
default is the entire FLASH. Addresses are byte oriented.
ae -- EEPROM address range. Specifies the address range of operations.
The default is the entire EEPROM. Byte addresses.
Y -- Perform the oscillator calibration sequence. See appnote AVR053 for more information.
Z -- Loads a value from an EEPROM location prior to chip erase which then can be programmed into FLASH or EEPROM using the S option. Address is
a hex value. See appnote AVR053 for more information.
c -- Select communication port; 'com1' to 'com8'. If this parameter is
ommitted the program will scan the comm. ports for the STK500
ut -- Set target voltage VTARGET in Volts. 'value' is a floating point
value between 0.0 and 6.0, describing the new voltage.
ua -- Set adjustable voltage AREF in Volts. 'value' is a floating point
value between 0.0 and 6.0, describing the new voltage.
wt -- Get current target voltage VTARGET.
wa -- Get current adjustable voltage AREF.
Wt -- Verify that VTARGET is within 5% of the given value. 'value' is a
floating point value between 0.0 and 6.0.
b -- Get revisions; hardware revision (h) and software revision (s).
! -- Set oscillator frequency; 'freq' can be whole Hz, or kHz or MHz
t -- Get oscillator frequency.
I -- Set ISP frequency; 'freq' can be whole Hz, or kHz or MHz
J -- Get ISP frequency.
g -- Silent operation.
z -- Not used. Supported for backwards compability.
h -- Help information (overrides all other settings)

Supported devices:
To display supported devices type "STK500.EXE -?"

Ezek alapján lehet, hogy más paramétereket kellene választani a avr-duino programozásához.
Valakinek ötlete?
Válasz küldése