Ab der Softwareversion 8.03 ist es nun auch möglich via Bluetooth die Neue Software einzuspielen. :D:D Das soll heisen, es muss zuerst mal die 8.03er auf den Atmega 168 drauf sein, den in der ist das Neue Future. Habe jetzt mal via USB und Bluetooth den Atmega 168 über den Bootloader programmiert. Alles super gegangen.
Saubere Arbeit Dete!!!!!!!! Mein Atmega 168 von gestern habe ich voll platt gemacht.:(:(:( Habe aber ein STK500 Board und konnte den Atmega via High Voltage wieder ins Leben zurück holen.
Wenn nichts mehr läuft einfach mal den Bootloder wieder über den Prozessor bügeln, war bei mir in der Spielphase auch ein paar mal nötig. Dann steht im gesamt Speicher wieder was vernünftiges drin und danach kann man wieder normal die Software aufspielen.
Kreppel jetzt auch schon ein paar Stunden rum und will den Bluetooth Adapter einen anderen Namen geben (REHOILER). Aber dieses blöde Ding will einfach nicht die AT Befehle schlucken. Mal gut das Winter wird [rolling_eyes].
Hi Dete, du hast glaube ich den gleichen Bluetooth-adapter!?!? HC-06 Ich habe da noch eine Anleitung für den HC-04, hast du die schon? Hilft vielleicht weiter?
Der normale Befehle wäre ja AT+NAMEREHOILER auch AT+NAME=REHOILER habe ich versucht. Baudrate rauf und runter nicht passiert, sonst das Daten auslesen am Rehoiler und Software Update alles keine Problem. Ich habe das so kapiert das du ja über die Serielle Seite die Befehle schickst, morgen werde ich das mal auf einen anderen Rechner versuchen. Evtl. hängt das auch irgend welchen W8 Treiberproblemen.
Hab mir die HC-06 Anleitung auch mal angesehen. Mein English ist zwar nicht so gut,verstehe ich aber auch so. Jetzt muss ich aber noch ein schönes Bier trinken. Morgen ist auch noch ein Monat.:D:D:D Grüsse turboschleicher
So, hab's geschafft.:D:D:D Meine Vorgehensweise: Wichtig!!! Bluetooth-Modul darf keine Bluetoothverbindung haben. USB-Modul mit Bluetooth-Modul verbunden. Achtung!!! je nach Hardware, wenn es nicht geht RXT und TXD tauschen. USB-Modul am Computer angeschlossen, beide Module werden mit Strom versorgt. Mit Terminalprogramm Verbindung hergestellt. 9600,8,keine,1,keine Verbindungskontrolle mit eingabe von AT.Anwort OK. Dann AT+NAMERehoiler ohne Leerzeichen. Fertig:D:D:D
Mit was hat sich den dein Adapter ursprünglich gemeldet, meiner schmipft sich BT-Uart. Ich meine es funktioniert ja, aber es nervt mich das dieses Teil nicht die einfachsten Befehle schlucken will.
Ich kann jetzt nur vermuten das da von der Software auf dem Chip was falsch ist, ansonsten habe ich aktuell keine Idee mehr.
Der Bluetoothadapter muss sich ja garnicht melden. Ein Comport, egal was für einer, ob ein echter Comport oder ein virtueller Comport, baut die Verbindung zum Bluetoothadapter auf. Das heisst, du schliesst deinen Comport vom Computer am Bluetoothadapter an den RXT und TXD Leitungen an. Dann mit einem Terminalprogramm deiner Wahl lädst du dein txt hoch. Habe es mehrmals ausprobiert. Hat immer funktioniert. Abruf der Firmwareversion, bei mir auch ohne Probleme, Version 1.6 Eventuell hast du noch eine alte Firmware drauf, die erwartet immer COM1. Wenn du also einen COM1 mit dem Bluetoothmodul verbindest, dann sollte es eigentlich funktionieren. Wenn es nicht geht, schick mir deine Bluetoothadapter, ich werde mir diese mal ansehen.
erstmal ein gutes neues Jahr und dann gleich mal mein Anliegen:
Ich erwarte in Kürze meine Bluetooth-Adapter. Nun wollte ich in Vorbereitung meinen Öler auf 8.03 updaten, aktuell ist Version 8.01 drauf. Nur ich bekomme es nicht hin. Ich hab den Bootloader und die 8.03.bin und .hex Datei. Den Bootloader stelle ich in den Optionen auf Com3 ein und 9600Baud. Die 8.03 Datei geladen und beim Senden schreibt das Prog nur ständig irgendwas von send #123 oder so ähnlich. Dabei bleibt es dann und der Loader lässt sich nicht beenden. Auf dem USB-Adapter blinkt ein Lämpchen , also irgendwas sendet das Ding wohl. Da sich nach Minuten nix tut, hab ich abgebrochen. Am Ende hab ich den Öler nochmals ausgelesen und es ist immernoch 8.01 draf.
Was muss ich tun fürs Update oder geht BT auch mit der 8.01 Version.
Das Software-Update bis zur Version 8.03 macht man so:
Zitat von Dete USB Adapter an den PC anstecken, Platine anschlie0en bis auf die -5V (Gnd). Nun die Bootloader Software starten und den Upload beginnen. Wenn das #123.. kommt schnell die -5V (Gnd) anstöpseln. Wenn alles geklappt sollte der Upload auf den Prozessor beginnen
Sobald man 8.03 dann drauf hat (noch ein Dete-Zitat ^^):
Zitat von Dete So ich habe das jetzt noch mal überarbeitet, ein Software Update ab Version 8.03 ist wie folgt zu machen:
DIP 1 und 4 auf ON stellen, Platinentaster betätigen. Mit der MCS Bootloader Software den File Upload starten. Wenn das Handshake erfolgreich und der Upload beginnt, kann der Taster los gelassen werden.
Wichtig beim Update von 8.01 oder 8.02 auf 8.03 muss noch mit trennen der Spannung (Gnd) gearbeitet werden. Die neue Update Funktion ist erst ab der Version 8.03 aktiv. Der Vorteil vom neuen Updateverfahren ist das nicht mehr die Spannung getrennt werden muss und auch ein Update per Bluetooth Adapter möglich ist.
Hallo Roland, zuerst musst du dir den Bootloader herunderladen und diesen dann für den Atmega 168 einstellen. Sollte dann so aussehen::D:D:D '---------------------------------------------------------------- ' (c) 1995-2009, MCS ' Bootloader.bas ' This sample demonstrates how you can write your own bootloader ' in BASCOM BASIC ' VERSION 2 of the BOOTLOADER. The waiting for the NAK is stretched ' further a bug was resolved for the M64/M128 that have a big page size '----------------------------------------------------------------- 'This sample will be extended to support other chips with bootloader 'The loader is supported from the IDE
$crystal = 8000000 '$crystal = 14745600 $baud = 9600 'this loader uses serial com 'It is VERY IMPORTANT that the baud rate matches the one of the boot loader 'do not try to use buffered com as we can not use interrupts
'possible return codes of the PC bootloader.exe ' -6005 Cancel requested ' -6006 Fatal time out ' -6007 Unrecoverable event during protocol ' -6008 Too many errors during protocol ' -6009 Block sequence error in Xmodem ' -6016 Session aborted
'Dim the used variables Dim Bstatus As Byte , Bretries As Byte , Bblock As Byte , Bblocklocal As Byte Dim Bcsum1 As Byte , Bcsum2 As Byte , Buf(128) As Byte , Csum As Byte Dim J As Byte , Spmcrval As Byte ' self program command byte value
Dim Z As Long 'this is the Z pointer word Dim Vl As Byte , Vh As Byte ' these bytes are used for the data values Dim Wrd As Word , Page As Word 'these vars contain the page and word address Dim Bkind As Byte , Bstarted As Byte 'Mega 88 : 32 words, 128 pages
Disable Interrupts 'we do not use ints
'Waitms 100 'wait 100 msec sec 'We start with receiving a file. The PC must send this binary file
'some constants used in serial com Const Nak = &H15 Const Ack = &H06 Const Can = &H18
'we use some leds as indication in this sample , you might want to remove it Config Pinb.2 = Output Portb.2 = 1 'the stk200 has inverted logic for the leds Config Pinb.3 = Output Portb.3 = 1
$timeout = 400000 'we use a timeout 'When you get LOADER errors during the upload, increase the timeout value 'for example at 16 Mhz, use 200000
Bretries = 5 'we try 5 times Testfor123: #if Cdebug Print "Try " ; Bretries Print "Wait" #endif Bstatus = Waitkey() 'wait for the loader to send a byte #if Cdebug Print "Got " #endif
Print Chr(bstatus);
If Bstatus = 123 Then 'did we received value 123 ? Bkind = 0 'normal flash loader Goto Loader Elseif Bstatus = 124 Then ' EEPROM Bkind = 1 ' EEPROM loader Goto Loader Elseif Bstatus 0 Then Decr Bretries If Bretries 0 Then Goto Testfor123 'we test again End If
For J = 1 To 10 'this is a simple indication that we start the normal reset vector Toggle Portb.2 : Waitms 100 Next
#if Cdebug Print "RESET" #endif Goto _reset 'goto the normal reset vector at address 0
'this is the loader routine. It is a Xmodem-checksum reception routine Loader: #if Cdebug Print "Clear buffer" #endif Do Bstatus = Waitkey() Loop Until Bstatus = 0
For J = 1 To 3 'this is a simple indication that we start the normal reset vector Toggle Portb.2 : Waitms 50 Next
If Bkind = 0 Then Spmcrval = 3 : Gosub Do_spm ' erase the first page Spmcrval = 17 : Gosub Do_spm ' re-enable page End If
Bretries = 10 'number of retries
Do Bstarted = 0 ' we were not started yet Csum = 0 'checksum is 0 when we start Print Chr(nak); ' firt time send a nack Do
Bstatus = Waitkey() 'wait for statuse byte
Select Case Bstatus Case 1: ' start of heading, PC is ready to send Incr Bblocklocal 'increase local block count Csum = 1 'checksum is 1 Bblock = Waitkey() : Csum = Csum + Bblock 'get block Bcsum1 = Waitkey() : Csum = Csum + Bcsum1 'get checksum first byte For J = 1 To 128 'get 128 bytes Buf(j) = Waitkey() : Csum = Csum + Buf(j) Next Bcsum2 = Waitkey() 'get second checksum byte If Bblocklocal = Bblock Then 'are the blocks the same? If Bcsum2 = Csum Then 'is the checksum the same? Gosub Writepage 'yes go write the page Print Chr(ack); 'acknowledge Else 'no match so send nak Print Chr(nak); End If Else Print Chr(nak); 'blocks do not match End If Case 4: ' end of transmission , file is transmitted If Wrd > 0 And Bkind = 0 Then 'if there was something left in the page Wrd = 0 'Z pointer needs wrd to be 0 Spmcrval = 5 : Gosub Do_spm 'write page Spmcrval = 17 : Gosub Do_spm ' re-enable page End If ' Waitms 100 ' OPTIONAL REMARK THIS IF THE DTR SIGNAL ARRIVES TO EARLY Print Chr(ack); ' send ack and ready
Portb.3 = 0 ' simple indication that we are finished and ok Waitms 20 Goto _reset ' start new program Case &H18: ' PC aborts transmission Goto _reset ' ready Case 123 : Exit Do 'was probably still in the buffer Case 124 : Exit Do Case Else Exit Do ' no valid data End Select Loop If Bretries > 0 Then 'attempte left? Waitms 1000 Decr Bretries 'decrease attempts Else Goto _reset 'reset chip End If Loop
'write one or more pages Writepage: If Bkind = 0 Then For J = 1 To 128 Step 2 'we write 2 bytes into a page Vl = Buf(j) : Vh = Buf(j + 1) 'get Low and High bytes lds r0, {vl} 'store them into r0 and r1 registers lds r1, {vh} Spmcrval = 1 : Gosub Do_spm 'write value into page at word address Wrd = Wrd + 2 ' word address increases with 2 because LS bit of Z is not used If Wrd = Maxword Then ' page is full Wrd = 0 'Z pointer needs wrd to be 0 Spmcrval = 5 : Gosub Do_spm 'write page Spmcrval = 17 : Gosub Do_spm ' re-enable page
Page = Page + 1 'next page Spmcrval = 3 : Gosub Do_spm ' erase next page Spmcrval = 17 : Gosub Do_spm ' re-enable page End If Next
Else 'eeprom For J = 1 To 128 Writeeeprom Buf(j) , Wrd Wrd = Wrd + 1 Next End If Toggle Portb.2 : Waitms 10 : Toggle Portb.2 'indication that we write Return
Do_spm: Bitwait Spmcsr.0 , Reset ' check for previous SPM complete Bitwait Eecr.1 , Reset 'wait for eeprom
Z = Page 'make equal to page Shift Z , Left , Maxwordshift 'shift to proper place Z = Z + Wrd 'add word lds r30,{Z} lds r31,{Z+1}
#if _romsize > 65536 lds r24,{Z+2} sts rampz,r24 ' we need to set rampz also for the M128 #endif
Spmcsr = Spmcrval 'assign register spm 'this is an asm instruction nop nop Return
'How you need to use this program: '1- compile this program '2- program into chip with sample elctronics programmer '3- select MCS Bootloader from programmers '4- compile a new program for example M88.bas '5- press F4 and reset your micro ' the program will now be uploaded into the chip with Xmodem Checksum ' you can write your own loader.too 'A stand alone command line loader is also available
'How to call the bootloader from your program without a reset ??? 'Do ' Print "test" ' Waitms 1000 ' If Inkey() = 27 Then ' Print "boot" ' Goto &H1C00 ' End If 'Loop
'The GOTO will do the work, you need to specify the correct bootloader address 'this is the same as the $LOADER statement.
Diesen bügelst du dann auf deinen Atmega 168 :D:D Jetzt kannst du die 8.03 mit der Bootloader.exe 1. Bootloader.exe starten. 2. Baudrate auf 9600 einstellen 3. Comport deines Adapters einstellen. 4. Pfad zu deiner 8.03 einstellen. 5. Upload starten. 6. Das war's auch schon. Ab jetzt geht ein Softwareupdate mit der Konfigurationsoftware via USB und BT-Adapter.
Zitat von Ensomhet USB Adapter an den PC anstecken, Platine anschlie0en bis auf die -5V (Gnd). Nun die Bootloader Software starten und den Upload beginnen. Wenn das #123.. kommt schnell die -5V (Gnd) anstöpseln. Wenn alles geklappt sollte der Upload auf den Prozessor beginnen
Das hat geklappt, 8.03 ist drauf.:D
Super, vielen Dank. Die Voreinstellungen haben es auch überlebt.
Wenn nun die BT-Adapter da sind, was muss ich dann beachten? Reicht es die Teile anzuschliessen und in die Box zu packen und dann per App darauf zu zugreifen oder muss ich noch was beachten?
DIP Schalter 1+4 müssen auf ON bleiben, sehr wahrscheinlich musst du die Stiftleiste für den Adapter auslöten und die Leitung zum Adapter direkt verlöten (ich stell moirgen mal ein Foto ein). Das spart Bauhöhe, wenn Platz im Motorrad Platz kannst du auch alles so lassen und das Gehäuse gegen ein das 5mm hoher ist austuaschen.
Das mit den Spannungs trennen zum Updaten hat folgenden Hintergrund, ein bstimmter Bereich vom Prozsssor wird nur bemi Starten angesprochen und genau in diesen befindet sich der Bootloader. In der 8.03 Version wurde das anders gelöst, hier weiß der Prozessor durch das drücken des Platinentaster das er beim Aufbau einer seriellen Verbindung ist den Bootloader Bereich springen soll.
Die 168 Prozessoren welche ich in den Fingern hatte, haben alle den Bootloader installiert und da reicht das Spannungs trennen.