Sie sind auf Seite 1von 20

myAVR

Technische Beschreibung technical description

mySmartUSB MK3
Hardware-Version 3.17 Software-Version 1.11
Inhalt
Allgemeine Beschreibung............................................... 3 berblick..................................................................... 3 Programmierung......................................................... 3 Kommunikation........................................................... 3 Eigenschaften............................................................. 4 Technische Daten .......................................................... 4 Betriebsdaten ............................................................. 4 Mechanische Daten ....................................................... 4 Anschlsse..................................................................... 5 Pinbelegung................................................................ 6 10 poliger Wannenstecker .......................................... 6 ISP6 (6 poliger Wannenstecker)................................. 6 LED-Statusanzeige ........................................................ 7 UART-Konfiguration und Baudraten............................... 8 Beschreibung des myMode............................................ 9 Allgemeine Befehle..................................................... 9 Men: main................................................................. 9 Men: prog ................................................................. 9 Men: spi .................................................................. 11 Men: lines ............................................................... 11 Men: twi .................................................................. 11 Fehler-Codes............................................................ 12 Das mySmartUSB MK3 Protokoll................................. 13 Programmereinstellungen ............................................ 14 Programmereinstellungen SiSy AVR (ab 2.18d)....... 14 Programmereinstellungen in myAVR Workpad (1.6) 15 Programmereinstellungen in AVRDUDE (5.8) .......... 16 Programmereinstellungen in BASCOM (1.11.9.8) .... 17 Programmereinstellungen in Codevision (2.04.8)..... 18 Programmereinstellungen AVR Studio (4.18.700).... 19 Anwendungsbeispiele .................................................. 20 Allgemeine Sicherheitshinweise................................... 20 www.myAVR.de

Contents
General description ........................................................ 3 Overview .................................................................... 3 programming .............................................................. 3 communication ........................................................... 3 Properties ................................................................... 4 Technical Data ............................................................... 4 Operating Data ........................................................... 4 Mechanical Data ............................................................ 4 Ports............................................................................... 5 10 pin print plug pin allocation .................................... 6 10 pin print plug .......................................................... 6 ISP6 (6 pin, print plug)................................................ 6 LED status display ......................................................... 7 UART-configuration and baud rate................................. 8 myMode-description....................................................... 9 General Commands ................................................... 9 menu: main................................................................. 9 menu: prog ................................................................. 9 menu: spi.................................................................. 11 menu: lines ............................................................... 11 menu: twi .................................................................. 11 Error Codes .............................................................. 12 The mySmartUSB MK3 protocol .................................. 13 Programmer settings.................................................... 14 changing setting in SiSy AVR (from 2.18d) .............. 14 changing setting in myAVR WorkPad (1.6) .............. 15 changing setting in AVRDUDE (5.8)......................... 16 changing setting in BASCOM (1.11.9.8)................... 17 changing setting in Codevision (2.04.8).................... 18 changing setting in AVR Studio (4.18.700)............... 19 Exemples of use........................................................... 20 Safety Guidelines ......................................................... 20
www.myAVR.com

Laser & Co. Solutions GmbH 07/2011

Seite: 2/20

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17

Die Informationen in diesem Produkt werden ohne Rcksicht auf einen eventuellen Patentschutz verffentlicht. Warennamen werden ohne Gewhrleistung der freien Verwendbarkeit benutzt. Bei der Zusammenstellung von Texten und Abbildungen wurde mit grter Sorgfalt vorgegangen. Trotzdem knnen Fehler nicht vollstndig ausgeschlossen werden. Die Autoren knnen fr fehlerhafte Angaben und deren Folgen weder eine juristische Verantwortung noch irgendeine Haftung bernehmen. Fr Verbesserungsvorschlge und Hinweise auf Fehler sind die Autoren dankbar. Alle Rechte vorbehalten, auch die der fotomechanischen Wiedergabe und der Speicherung in elektronischen Medien. Die gewerbliche Nutzung der in diesem Produkt gezeigten Modelle und Arbeiten ist nicht zulssig. Fast alle Hardware- und Softwarebezeichnungen, die in diesem Dokument erwhnt werden, sind gleichzeitig auch eingetragene Warenzeichen und sollten als solche betrachtet werden. Laser & Co. Solutions GmbH Promenadenring 8 02708 Lbau Deutschland www.myAVR.de

In spite of the great care taken while writing this document the author is not responsible for the topicality, correctness, completeness or quality of the information provided. Liability claims regarding damage caused by the use of any information provided, including any kind of information which is incomplete or incorrect,will therefore be rejected. All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from the publisher. All trademarks and registered trademarks appearing in this document are the property of their respective owners.

Laser & Co. Solutions GmbH Promenadenring 8 02708 Lbau Germany www.myAVR.com

Tel: Fax:

++49 (0) 358 470 222 ++49 (0) 358 470 233

Tel: Fax:

++49 (0) 358 470 222 ++49 (0) 358 470 233

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17

Seite: 3/20

Allgemeine Beschreibung
Der mySmartUSB MK3 ist ein kompakter Highspeed-USBProgrammer fr Atmel Mikrocontroller. Sie knnen mit Hilfe dieses Boards eine Vielzahl von AVR-Systemen einfach ber die USB-Schnittstelle programmieren. Des Weiteren verfgt das Board ber einen JTAG- und ISP-Anschluss. Das Kommunikationsinterface fungiert als UART, TWI/IC oder SPI-Bridge. Die Kommunikation mit dem PC luft vllig transparent ber einen virtuellen COM-Port. Das Board wird per USBSchnittstelle mit dem PC verbunden und mit Spannung versorgt. Somit sind fr viele Anwendungsflle keine externen Spannungsquellen ntig. Es wird kein Paralleloder Serial-Port bentigt, was speziell fr NotebookBesitzer von Vorteil ist. berblick

General description
The mySmartUSB MK3 is a compact high-speed USB programmer for Atmel microcontroller. You can program different AVR-systems via the USB interface with his board. Furthermore the board contains a JTAG and ISP connection. The communication interface works as an UART, TWI/IC or SPI-bridge. The communication with the PC is completely transparent and realized by the help of a virtual COM-port. The power supply is assured by the connection of the board to the PC. Therefore many applications dont need an external power supply. A parallel port is not necessary, what is particularly an advantage for notebook users.

Overview

PC

USB 2.0 virtual COM

mySmartUSB MK3

? SPI, TWI (IC)


Mode: myMode AVR109,911,910 STK 500
protocollcommunication

Zielsystem target system

?? ??

ISP HV-Parallel

? ? ?
directcommunication programming

? ? 1 HV-Serial ? ? 3 TPI ? ? 4 TPI-HV


UART

Data Quite Power

AVR
Power

LED Status:

off

on

on

? on or off

blink

Auswahl durch Tastendruck: kurz=Mode, lang=Programmier-Mode Choice by button: short=mode, long=program-mode

Programmierung

programming

Kommunikation

communication

USB 2.0 ISP6 TPI,TPI-HV serial HV JTAG10 Power High-Voltage-Parallel

USB 2.0

UART Kommunikation

AVR

USB to TWI Bridge USB to SPI Bridge Power (VCC)

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Seite: 4/20

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17 Properties high-speed USB programmer for AVR microcontroller six program modes: ISP, high voltage parallel, high voltage serial, TPI, TPT high voltage, JTAG prepared the choice of the operational mode by software commandos or mode-button simple communication of the microcontroller with the PC or a notebook via USB interface; provides a virtual COM-port switchable between programming, communication, sleeping mode and myMode power supply via USB connection as well as switchable power-on and power-off modes by the user LED status display updateable via bootloader industrial standard controller (CP2102) USB 2.0 to serial converter quality printed circuit board FR4, industrial production

Eigenschaften High-Speed USB-Programmer fr AVR Mikrocontroller sechs Programmiermodi: ISP, High-Voltage parallel, High-Voltage seriell, TPI, TPI High-Voltage, JTAG vorbereitet Auswahl der Betriebsmodi erfolgt ber SoftwareKommandos oder Mode-Taster einfache Kommunikation des Mikrocontrollers mit dem PC oder Notebook ber USB-Schnittstelle; stellt virtuellen COM-Port zur Verfgung umschaltbar zwischen Programmier-, Kommunikations-, Ruhemodus und myMode Spannungsversorgung ber USB-Anschluss sowie Power-On und Power-Off durch Anwender schaltbar LED-Zustandsanzeige updatefhig ber Bootloader Industriestandard-Controller (CP2102) USB 2.0 zu seriell Konverter Qualittsleiterplatte FR4, Industriefertigung, robust

Technische Daten
Betriebsdaten Versorgungsspannung Betriebsstrom Betriebsspannung Betriebstemperatur Lagertemperatur Operating Data Supply Voltage Operating Current

Technical Data

5 V ber den USB-Bus 10-20 mA typisch ohne weitere Verbraucher bis 100 mA bei Anschluss an Zielsysteme 5V 0 30 C -20 C bis + 70 C

Operating Voltage Operating Temperature Storage Temperature

5 V via USB bus 10-50 mA typical without other loads up to 100 mA if connected to target system 5V 0 30 C -20 C 70 C

Mechanische Daten
Abmessungen Platine (L x B x H) Masse Rasterma Leiterplattenmaterial: 60 x 30 x 16 mm 13 g 2,54 mm FR8, 1,5 mm Dicke, 0,35 m Cu Auflage, zweiseitig, Ltstoppmaske, verzinnt, durchkontaktiert

Mechanical Data
Dimensions of the board (L X B X H) Weight Grid dimensions PCB material 60 x 30 x 16 mm 13 g 2.54 mm FR8, thickness 1.5 mm, Cu layer 0.35 m, two-sided, soldering resist mask, tin-plated, plate through

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17

Seite: 5/20

Anschlsse
Funktionsschema Functional diagram

Ports

USB
ISP TPI/TPI-HV

Aufbau USB-Anschluss USB interface

Structure

HV - seriell JTAG

L10 L9 L8 L7 HV - parallel L6 TWI L5 L4 L3 L2 L1

R10 R9 R8 R7 R6 R5 R4 R3 R2 R1

ISP Power SPI UART HV - seriell HV - parallel TPI TPI-HV

ISP / TPI / TPI-HV (6-polig) ISP / TPI / TPI-HV (6 pin)

HV-seriell / JTAG (10-polig) HV-serial / JTAG (10 pin)

Status-LEDs State-LEDs

Mode-Taster Mode-button

Leiste links interface left

Leiste rechts interface right

Spannungskonfiguration power configuration

Controller

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Seite: 6/20

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17

Pinbelegung

pin allocation

L10 L9 L8 L7 L6 L5 L4 L3 L2 L1

R10 R9 R8 R7 R6 R5 R4 R3 R2 R1

Pin L10 L9 L8 L7 L6 L5 L4 L3 L2 L1 R10 R9 R8 R7 R6 R5 R4 R3 R2 R1

ISP Programming-Mode (rescue clock)

GND VCC

Reset MOSI MISO SCK

Parallel Programming-Mode READY BS2 XTAL1 DATA6 DATA5 DATA4 XA1 XA0 BS1 DATA7 GND VCC WR OE Reset DATA2 DATA3 DATA1 DATA0 PAGEL

HV-seriell Programming Mode CLK

TPI, TPI-HV Programming Mode

Bridge IC/TWI-SDA IC/TWI-SCL

GND VCC

GND VCC

GND VCC UART-RxD (PC) URT-TxD (PC) SPI-MOSI SPI-MISO SPI-SCK SPI-SS

Reset SDI SII SDO CLK/SCI

Reset DATA CLK

10 poliger Wannenstecker Pin 1 2 3 4 5 6 7 8 9 10 HV-seriell / HV-serial Pinbelegung / Pin description SDO GND SII Vcc CLK/SCI Reset n.c. n.c. SDI GND

10 pin print plug JTAG / JTAG Pinbelegung / Pin description TCK GND TDO VTREF TMS Reset n.c. n.c. TDI GND ISP6 (6 pin, print plug)

10 8 6 4 2

9 7 5 3 1

ISP6 (6 poliger Wannenstecker) Pin 1 2 3 4 5 6

Pinbelegung / Pin description ISP TPI, TPI-HV MISO DATA VCC VCC SCK CLK MOSI Reset Reset GND GND

6 4 2

5 3 1

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17

Seite: 7/20

LED-Statusanzeige
mode LED-Anzeige LED display Programmier-Mode program-mode In-System-Programmierung In-System-Programming Hochvolt-parallel High Voltage parallel Hochvolt-seriell High Voltage serial TPI TPI TPI-Hochvolt TPI-High Voltage

LED status display


Beschreibung Im myMode kann der Programmer durch Befehle ber ein Terminalprogramm angesprochen werden (s. Beschreibung des myMode). description In the myMode, the programmer can be controlled by commands, that are sent by a terminal program (commands see myMode-description).

Betriebsmode Operating mode

myMode

1 3 4

Data-Mode

Quiet

AVR109/911/910 Kompatibilitts-Mode Compatibility mode

1 3 4

STK500

1 3 4

Bootloader

Error

Im Data-Mode leitet der mySmartUSB MK3 alle Daten 1:1 in beide Richtungen weiter. Der Programmer verhlt sich stumm. In-System-Programmierung In diesem Mode wird In-System-Programming durch den mySmartUSB MK3 ein Hochvolt-parallel AVR109,911 bzw. 910 High Voltage parallel Programmer emuliert. Hochvolt-seriell High Voltage serial TPI TPI TPI-Hochvolt TPI-High Voltage In-System-Programmierung Wenn sich der In-System-Programming mySmartUSB MK3 im STK500-Mode befinHochvolt-parallel det, kann er in den High Voltage parallel ProgrammereinstelHochvolt-seriell lungen als ein STK500 High Voltage serial Programmer genutzt TPI werden. TPI TPI-Hochvolt TPI-High Voltage In diesem Modus wird der Bootloader aktualisiert bzw. neu eingespielt. mySmartUSB MK3 hat ein Problem festgestellt und geht fr ca. 7 s in den Error-Mode. = off =on = blink

In the Data-Mode, the programmer directs the data traffic unmodified bidirectional. The programmer acts dumb. In this mode, the mySmartUSB MK3 emulates an AVR109, 911 or 910 programmer.

In this mode, the mySmartUSB MK3 emulates an STK500 programmer, so in the setup of the IDE must be selected such a programmer.

KompatibilittsCompatibility

In this mode, the bootloader is updating or reinstalling. mySmartUSB MK3 noticed an error and switch into Error-Mode for circa 7 s.

Die Auswahl des Mode und des Programmier-Mode kann mittels des Tasters erfolgen: kurz tippen = Wechsel des Mode lange drcken = Wechsel des Programmier-Mode The mode and program-mode can be selected by pushing the button: short tip = change mode hold long = change program-mode

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Seite: 8/20

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17

UART-Konfiguration und Baudraten


mode myMode AVR109/911/910 STK500 Quiet Data-Mode Data-Mode UART 500000,8,N,1 19200,8,N,1 115200,8,N,1 500000,8,N,1 500000,8,N,1

UART-configuration and baud rate


Hinweis / Notes

nur fr mySmartUSB MK3 Protokoll- Kommandos only for mySmartUSB MK 3 protocol-commandos nur fr mySmartUSB MK3 Protokoll- Kommandos only for mySmartUSB MK 3 protocol-commandos

Data Bits: 5, 6, 7, 8 (1) Stop Bits: 1, 1.5 , 2 Parity Type: None, Even, Odd, Mark, Space Baud Rates: 300, 600, 1200, 1800, 2400, 4000, 4800, 7200, 9600, 14400, 16000, 19200, 28800, 38400, 51200, 56000, 57600, 64000, 76800, 115200, 128000, 153600, 230400, (2) 250000, 256000, 460800, 500000, 576000, 921600 Hinweis/Notes: (1) nur 5-bit / 5-bit only (2) nur 7 oder 8 Datenbits / 7 or 8 data bits only Zustzliche Baudraten werden untersttzt, vgl. AN205 von Silicon Labs Additional baud rates are supported. See AN205 by Silicon Labs.

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17

Seite: 9/20

Beschreibung des myMode


Um die myMode-Befehle nutzen zu knnen, muss sich der mySmartUSB MK3 im myMode befinden (siehe LED- Statusanzeige). Fr die Kommunikation eignet sich jedes beliebige Terminalpprogramm, welches eine Baudrate von 500000 Baud untersttzt. Alle Befehle mssen mit LF (=10, bzw. 0x0A) abgeschlossen werden. Beachten Sie die exakte Schreibweise und vermeiden Sie unntige Leerzeichen. Allgemeine Befehle

myMode-description
To use the myMode commands, you need to have the mySmartUSB MK3 in myMode (see LED - Status Display for details). For the communication, you can use any terminal program, which supports baud rates of 500000 baud. All commands must be confirmed with LF (=10, resp. 0x0A). Please note the exact spelling and avoid unnecessary spaces.

General Commands m:<menuName>

wechselt in angegebenes Men (prog fr Programmieren, main fr Hauptmen) listet mgliche Mens auf

m:prog ok m:? m:? ok, main, prog, spi, lines, twi

changes in the specified menu (prog for programming, main for main menu) Lists possible menu

listet alle Befehle auf

? ? ok, burnFlash readFlash @<menuName> <befehl> <para> @prog ispSpeed scan 3333333 error 294117 ok

Lists all commands

direkte Befehlseingabe, ohne das aktuelle Men zu verlassen

Direct command request leaving the current menu

without

Men: main

menu: main ver ver ok, mySmartUSB MK3, V 1.08, b1530 reset reset ok mode <m|d|a|s|q|+|-> mode d ok

Name, Firmware-Version und Build auslesen

read name, firmware-version and build

Reset des Programmers auslsen in anderen Modus wechseln, z.B. myMode, Data-Mode, avr109/910/911, stk500, quiet Power-On/Off auf angeschlossenem Board startet Firmwareupdate

resets the programmer

switch into an other mode, e.g. myMode, Data-Mode, avr109/910/911, stk500, quiet Power-on/off on attached board

bootloader bootloader ok

starts firmware update

Men: prog Das Men prog beinhaltet Befehle fr Kommunikation mit dem Zielsystem, u.a. Brenn- und Auslesebefehle.

menu: prog The menu "prog" includes instructions for communicating with the target system, including Burning and selection commands. burns the flash from the start address with the specified length

brennt den Flash ab der festgelegten Startadresse mit der angegebenen Lnge

burnFlash <start> <length> burnFlash 0 300 ok, send 256 <256 Byte Data> ok, send 44 <44 Byte Data> ok

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Seite: 10/20 liest den Flash von der angegebenen Startadresse mit der festgelegten Lnge

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17 readFlash <start> <length> readFlash 0 12 www.myavr.deok sumFlash <start> <length> sumFlash 0 12 ok, 1209 burnEeprom <start> <length> burnEeprom 0 262 ok, send 256 <256 Byte Data> ok, send 6 <6 Byte Data> ok readEeprom <start> <length> readEeprom 0 20 www.myavr.dewww.myavok sumEeprom <start> <length> sumEeprom 0 12 ok, 2057 burnFuseLock <typ> <byte> burnFuseLock L 0xff ok readFuseLock <typ><typ> readFuseLock L123 ok, 0xff 0x2a 0xf9 0xff enterPm enterPm ok leavePm leavePm ok readSig readSig ok, 0x1e9007 progMode <i|p|s|t|T> progMode i ok reads out the content of the flash with the specified length

Bildet die Summe des Speicherinhaltes von der angegebenen Startad resse mit der angegebenen Lnge brennt den EEPROM ab der festgelegten Startadresse mit der angegebenen Lnge

sums up the contents of the momory from start to the specified length

Burn EEPROM from start to specified length

liest den EEPROM von der angegebenen Startadresse mit der festgelegten Lnge Bildet die Summe der Registerinhalte von der angegebenen Startadresse mit der angegebenen Lnge Brennt die Fuse- und Lockbits

Read EEPROM from start to specified length

sums up the contents of the registers from start to the specified length

Burns the fuse- and lock-bits

Auslesen der aktuellen Fuseund/oder Lockbits Schaltet in den Programmiermodus Verlassen des Programmiermodus liest die Signatur des Prozessors aus (32 bit Zahl) festlegen des Programmiermodus i = ISP p = HV-parallel s = HV-seriell t = TPI T = TPI-HV Festlegen der ISP-Baudrate (ohne Parameterangabe wird aktuelle Baudrate angegeben) ISP-Baudraten testen

Reads out the recent fuse/lock configuration Switch into the programming mode

Leave the programming mode

Reads out the signature of the controller (32 bit integer) Specify the programming mode i = ISP p = HV-parallel s = HV-serial t = TPI T = TPI-HV Set the ISP baudrate (request without parameters will show current baudrate) scan possible ISP-baud rates

ispSpeed <baud> ispSpeed ok, 33222 ispSpeed scan ispSpeed scan 3333333 error 294117 ok parSpeed <waits> parSpeed 20 ok, 20

Festlegen der Waits fr die parallele Programmierung (ohne Parameterangabe werden aktuelle Waits angegeben) Geschwindigkeit im parallelen Programmiermodus testen

determine the waits for parallel programming (without specifying parameters, current waits will be shown) Scans possible parallel-speeds

parSpeed scan parSpeed scan error 355552 ok 182232

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17 Men: spi Das Men spi beinhaltet Befehle fr Kommunikation per SPI (Serial Peripheral Interface). Es werden jeweils 8 Bit gesendet / empfangen ( Fhrende Flanke = steigend = Sample SCK = low wenn idle)

Seite: 11/20

menu: spi The menu "spi" includes instructions for the communication via SPI (Serial Peripheral Interface). Sending / receiving always 8 bit ( Leading edge = rising = sample SCK = low when idle) starts the communication via SPI

start

startet die Kommunikation per SPI

start ok send <byte> <byte> send 0x55 12 45 ok, 0x55 0xa 0xd2 end end ok

Daten senden Antwort = Datenbytes vom Slave Beendet die Kommunikation per SPI

sends data

return = databytes from salve


ends the communication via SPI

Men: lines Das Men lines beinhaltet Befehle fr die Konfiguration und Statusabfrage der Anschlussleisten (links und rechts) am Programmer setzt alle Lines inaktiv = Input inactive

menu: lines The menu "lines" includes instructions for the configuration and status request of the interface (left and right) from the programmer. sets all lines inactive = input

inactive rst <0|1>

Reset (R6) zurcksetzen (0=low) oder setzen (1=high) Aufruf ohne Parameter gibt den aktuellen Status zurck setzen der Leitung auf 0=low oder 1=high

rst 1 ok, 1 rst ok, 1

reset (R6) restore (0=low) or set (1=high) call without parameter returns actual state

l1|l2|l3|l4|l5|l6|l7|l7|l8|l9|l10|r1|r2|r3|r4|r5|r7|r8 <1|0> l1 1 sets the line to 1=high or 0=low ok, 1 l1 ok, 1 call without parameter returns actual state

Aufruf ohne Parameter gibt den aktuellen Status zurck

Men: twi Das Men twi beinhaltet Befehle fr die Kommunikation mittels TWI (IC). In geschweiften Klammern ist der Status des Registers TWSR angegeben (siehe TWI Status Codes) Initialisierung TWI-Master Rckgabe passende errechnete Baudrate TWI-Start senden TWI-Stop senden

menu: twi The menu "twi" includes instructions for the communication via TWI (IC). In cambered brackets the state of the register TWSR is shown (watch TWI state codes). init TWI-master

ima <baud> ima ok, 50000 {f8} ima 60000 ok, 60240 {f8} sta sta ok, {08} sto

Returns compatible calculated baud rate sends TWI-start

sto ok, {f8} sla adr <r|w> sla 0x40 r ok, {48} sla 0x40 w ok, {20}

sends TWI-stop

setzt Slave-Adresse und Status fr nchstes Kommando r = lesen w = schreiben Adr 0x000xFE, Bit0=0

Sets slave-adress and state for next command r = read w = write Adr 0x000xFE, Bit0=0

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Seite: 12/20 setzen/lschen des bereitgelegten Acknowledge-Bits fr die nchste Datenbertragung Bytes per TWI schreiben x Bytes per TWI lesen ack 0 ok, {08}

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17 ack <0|1> setting/cleaning of the place acknowledge-bits for the next transmission writes bytes via TWI

x Bytes lesen + Auto Acknowledge ack=1 vor dem Ersten ack=0 vor dem Letzten TWI-Status ausgeben (beachte TWI Status Codes) TWI deaktivieren/beenden

wr <byte> <byte> wr 12 45 ok, {28} rd <Anzahl Byte> rd 3 ok, 0 255 104 {50} rda <Anzahl Byte> rda 3 ok, 0 255 104 {50}

reads x bytes via TWI

reads x Bytes + Auto Acknowledge ack=1 before the first ack=0 before the last
returns TWI-state

state state ok, 248ok {f8} end end ok, {f8}

(watch TWI Status Codes) deactivate/finish the TWI

TWI Status Codes

TWI state codes


0x00 0x08 0x10 0x18 0x20 0x28 0x30 0x38 0x40 0x48 0x50 0x58 0x60 0x68 0x70 0x78 0x80 0x88 0x90 0x98 0xA0 0xA8 0xB0 0xB8 0xC0 0xC8 0xF8

Bus-Fehler aufgrund einer unerlaubten START oder STOP-Bedingung START Bedingung wurde gesendet Wiederholter-START-Bedingung wurde gesendet SLA+W wurde gesendet; ACK wurde empfangen SLA+W wurde gesendet; NOT ACK wurde empfangen Datenbyte wurde gesendet, ACK wurde empfangen Datenbyte wurde gesendet, NOT ACK wurde empfangen Arbitrage verloren bei SLA+W oder Datenbyte Arbitrage verloren bei SLA+R oder NOT ACK Bit SLA+R wurde gesendet; ACK wurde empfangen SLA+R wurde gesendet; NOT ACK wurde empfangen Datenbyte wurde empfangen; ACK wurde erwidert Datenbyte wurde empfangen; NOT ACK erwidert Eigenes SLA+W wurde empfangen; ACK erwidert Arbitrage verloren bei SLA+R/W als Master; eigenes SLA+W wurde empfangen; ACK wurde erwidert Allg. Sprung-Adresse wurde empfangen, ACK wurde erwidert Arbitrage verloren bei SLA+R/W als Master; allg. Sprung-Adresse wurde empfangen, ACK wurde erwidert Vorherig adressiert mit eigenem SLA+W; Daten wurden empfangen, ACK wurde erwidert Vorherig adressiert mit eigenem SLA+W; Daten wurden empfangen; NOT ACK wurde erwidert Vorherig adressiert mit allg. Sprung-Adresse; Daten wurden empfangen; ACK wurde erwidert Vorherig adressiert mit allg. Sprung-Adresse; Daten wurden empfangen; ACK wurde erwidert Eine STOP- oder Wiederholter-START-Bedingung wurde empfangen, obwohl noch als Slave adressiert Eigenes SLA+R empfangen; ACK wurde erwidert Arbitrage verloren bei SLA+R/W als Master; eigenes SLA+R empfangen; ACK wurde erwidert Datenbyte in TWDR wurde gesendet; ACK wurde empfangen Datenbyte in TWDR wurde gesendet; NOT ACK wurde empfangen Letztes Datenbyte in TWDR wurde gesendet (TWEA=0); ACK wurde empfangen Keine wichtigen Statusinformation verfgbar

Bus error due to an illegal START or STOP condition A START condition has been transmitted A repeated START condition has been transmitted SLA+W has been transmitted; ACK has been received SLA+W has been transmitted; NOT ACK has been received Data byte has been transmitted; ACK has been received Data byte has been transmitted; NOT ACK has been received Arbitration lost in SLA+W or data byte Arbitration lost in SLA+R or NOT ACK bit SLA+R has been transmitted; ACK has been received SLA+R has been transmitted; NOT ACK has been received Data byte has been received; ACK has been returned Data byte has been received, NOT ACK has been returned Own SLA+W has been received; ACK has been returned Arbitration lost in SLA+R/W as Master: own SLA+W has been received; ACK has been returned General call address has been received; ACK has been returned Arbitration lost in SLA+R/W as Master; General call address has been received; ACK has been returned Previously addressed with own SLA+W; data has been received; ACK has been returned Previously addressed with own SLA+W; data has been received; NOT ACK has been returned Previously addressed with general call; data has been received; ACK has been returned Previously addressed with general call; data has been received; NOT ACK has been returned A STOP condition or repeated START condition has been received while still addressed as Slave Own SLA+R has been received; ACK has been returned Arbitration lost in SLA+R/W as Master; own SLA+R has been received; ACK has been returned Data byte in TWDR has been transmitted; ACK has been received Data byte in TWDR has been transmitted; NOT ACK has been received Last data byte in TWDR has been transmitted (TWEA= 0); ACK has been received No relevant state information available

Fehler-Codes Bei der Rckgabe der folgenden Werte liegt der dem Code zugeordnete Fehler vor. Unbekannter Befehl Unbekanntes Men Ungltige Daten Zeitberschreitung Nicht erfolgreich berprfung nicht erfolgreich Sonstiger Fehler

Error Codes In return to the following values, the assigned error occurred. error 01 error 02 error 13 error 99 error 100 error 101 error 255 unknown command unknown menu invalid data timeout not succeeded incorrect verify other error

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17

Seite: 13/20

Das mySmartUSB MK3 Protokoll


Die Firmware des mySmartUSB MK3 ber ein eigenes Protokoll um die zustzlichen Funktionen des mySmartUSB MK3 anzusprechen. Das mySmartUSB MK3 Protokoll wird ber eine Kennung aktiviert die den eigentlichen Kommandos als Prfix vorangestellt werden muss. Baudrate: je nach Mode, z.B. 500000,8,n,1 fr myMode, Quiet, Data andere Baudraten siehe UARTKonfiguration und Baudraten Prfix: ""+Kommando als ASCII-Zeichen (= 0xE6 0xB5 0xBA 0xB9 0xB2 0xB3 0xA9)

The mySmartUSB MK3 protocol


The firmware of the mySmartUSB MK3 uses an own protocol to perform additional tasks. The mySmartUSB MK3 protocol will be activated over a specific character string that has to precede the instructions.

baud rate:

depending on mode, e.g. 500000,8,n,1 for myMode, Quiet, Data other baud rates see UART-configuration and baud rate

prefix: ""+instruction in ASCII code (= 0xE6 0xB5 0xBA 0xB9 0xB2 0xB3 0xA9) commands:

Kommandos: + r i I m p d s a q v C c E Board-Power-On Board-Power-Off Reset Board Status wird zurckgegeben ProgMode wird zurckgegeben myMode Programmiermodus Daten-Bypass/ DurchreichModus UART STK500-Modus AVR910-Modus Quiet-Modus Versionsnummer wird zurckgegeben Rescue-Clock an Rescue-Clock aus aktueller Mode und Progmode werden in EEPROM geschrieben

+ r i I m p d s a q v C c E

board power on board power off reset board return state return ProgMode myMode programming-mode data-bypass mode STK500-mode AVR910-mode quiet mode (neutral) return version Rescue-Clock on Rescue-Clock off write current mode and ProgMode to EEPROM

Beispiel: q schaltet den Programmer in den quietmode Hinweis: Verwenden Sie die aktuelle Firmware des mySmartUSB MK3.

Example: q switches the programmer into the quiet-mode Notice: Please use the current firmware of mySmartUSB MK3.

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Seite: 14/20

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17

Programmereinstellungen
Programmereinstellungen SiSy AVR (ab 2.18d) Versetzen Sie den USB-Programmer mySmartUSB MK3 in den myMode (nheres dazu finden Sie im Abschnitt zur Tochterplatine mySmartUSB MK3, sowie der Technischen Beschreibung zum mySmartUSB MK3). Starten Sie SiSy und legen Sie ein neues Projekt an. Im Programmfenster von SiSy klicken Sie das Symbol kleines Programm mit der rechten Maustaste an und whlen Definieren.... Im sich ffnenden Fenster entfernen Sie das Hkchen Vorgabe benutzen und klicken auf Hardware einstellen. Im myAVR ProgTool whlen Sie den USB Programmer mySmartUSB MK3 und klicken auf Test. SiSy bernimmt die Taktfrequenz, den verwendeten Controller und den COM-Port. Klicken Sie auf den erkannten Controller und anschlieend auf Speichern. Fr das Beispiel wurde das myAVR Board MK3 256 verwendet. Status-LEDs status-LEDs Mode: myMode

Programmer settings
changing setting in SiSy AVR (from 2.18d) Put the mySmartUSB MK3 into the myMode compatibility modus (you find more informations to that in the section of the mySmartUSB MK3 and in the technical description of the mySmartUSB MK3). Open an project or create a new one. To adjust the hardware, choosing right click on the project and "Definieren ...". Remove the checkmark "Vorgabe benutzen" and click on Hardware einstellen.

Adjusts via myAVR ProgTool the mySmartUSB MK3 Programmer and click on Test button. SiSy get the used controller, the COM port and the frequency. Now you click on the recognized controller and after that, on the Speichern button. In the example, the myAVR Stamp 256 PLUS was used with an ATmega2650. Mode-Taster mode-button

?
Prog-Mode: abhngig vom Zielsystem prog-mode: depending on target system Auswahl: Taster kurz tippen Choice: press button short

Nach dem Speichern ffnet sich ein Informationsfenster welches anzeigt, dass die Einstellungen bernommen wurden.
www.myAVR.de

An information window opens, after you clicked on the Speichern button and confirms that the attitudes were taken on.
www.myAVR.com

Laser & Co. Solutions GmbH - 07/2011

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17 Programmereinstellungen in myAVR Workpad (1.6) Versetzen Sie den USB-Programmer mySmartUSB MK3 in den myMode (nheres dazu finden Sie im Abschnitt zur Tochterplatine mySmartUSB MK3, sowie der Technischen Beschreibung zum mySmartUSB MK3). Starten Sie myAVR Workpad und whlen Sie im Menpunkt Extras/Einstellungen den mySmartUSB MK3 Programmer aus, klicken Sie auf Test. Den gefunden Controller bernehmen Sie, indem Sie diesen anklicken. Schlieen Sie die Einstellungen mit der Schaltflche Speichern ab. Fr das Beispiel wurde das myAVR Board MK3 256 verwendet. Status-LEDs status-LEDs Mode: myMode

Seite: 15/20

changing setting in myAVR WorkPad (1.6) Put the mySmartUSB MK3 into the myMode compatibility modus (you find more informations to that in the section of the mySmartUSB MK3 and in the technical description of the mySmartUSB MK3). Choose in the menue under Extras/Einstellungen the mySmartUSB MK3 programmer and click on the Test Button. Click on the controller to take this. In the example was used the myAVR Stamp 256 PLUS with an ATmega2650. To complete the attitudes, use the Speichern button.

Mode-Taster mode-button

?
Prog-Mode: abhngig vom Zielsystem prog-mode: depending on target system Auswahl: Taster kurz tippen Choice: press button short

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Seite: 16/20

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17 changing setting in AVRDUDE (5.8) Put the mySmartUSB MK3 into the AVR 109,911,910 compatibility modus (you find more informations to that in the section of the mySmartUSB MK3 and in the technical description of the mySmartUSB MK3). After that start the AVRDUDE with the command line. That will show you all instructions, which are available. Here a clipping. Mode-Taster mode-button

Programmereinstellungen in AVRDUDE (5.8) Versetzen Sie den mySmartUSB MK3 Programmer in den Mode AVR 109,911,910 (nheres dazu finden Sie im Abschnitt zur Tochterplatine mySmartUSB MK3, sowie der Technischen Beschreibung zum mySmartUSB MK3). Starten Sie AVRDUDE ber die Kommandozeile. Es werden Ihnen alle verfgbaren Befehle angezeigt. Hier ein Ausschnitt. Status-LEDs status-LEDs Mode: myMode

?
Prog-Mode: abhngig vom Zielsystem prog-mode: depending on target system Auswahl: Taster kurz tippen Choice: press button short

Hier sehen Sie einen Beispielbefehl zum Brennen eines Beispielprogramms.

Here you see a command example to burn a program.

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17 Programmereinstellungen in BASCOM (1.11.9.8) Versetzen Sie den mySmartUSB MK3 Programmer in den STK500 Mode (nheres dazu finden Sie im Abschnitt zur Tochterplatine mySmartUSB MK3, sowie der Technischen Beschreibung zum mySmartUSB MK3). Unter dem Menpunkt Options/Programmer knnen Sie die Einstellungen fr den Programmer vornehmen. Hierzu whlen Sie, wie auf den Bildern ersichtlich, den Modus STK500 extended, sowie den COM-Port aus. Abschlieend klicken Sie auf Ok und Ihre Einstellungen werden bernommen. Status-LEDs status-LEDs Mode: myMode

Seite: 17/20

changing setting in BASCOM (1.11.9.8) Put the mySmartUSB MK3 into the STK 500 compatibility modus (you find more informations to that in the section of the mySmartUSB MK3 and in the technical description of the mySmartUSB MK3). You can carry out the attitudes for the Programmer under the menu item Options/Programmer. Then you will select the STK500 extended mode and as well as the respective COM port. In conclusion click on Ok and her attitudes were taken on. Mode-Taster mode-button

?
Prog-Mode: abhngig vom Zielsystem prog-mode: depending on target system Auswahl: Taster kurz tippen Choice: press button short

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Seite: 18/20

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17 changing setting in Codevision (2.04.8) Put the mySmartUSB MK3 into the STK 500 compatibility modus. (you find more informations to that in the section of the mySmartUSB MK3 and in the technical description of the mySmartUSB MK3). After that, you select in the menu Settings/ Programmer and you carry out the attitudes for the mySmartUSB MK3 Programmer. For that you choose the STK500 modus as well as the port. Confirm at the end. After that you configurate the Programmer under the menu item Tools/Chip Programmer, according to the processor on the myAVR Stamp and confirm. In the example was used the myAVR Stamp 256 PLUS with an ATmega2650.

Programmereinstellungen in Codevision (2.04.8) Versetzen Sie den mySmartUSB MK3 Programmer in den STK500 Mode. (nheres dazu finden Sie im Abschnitt zur Tochterplatine mySmartUSB MK3, sowie der Technischen Beschreibung zum mySmartUSB MK3). Im Menpunkt Settings/Programmer nehmen Sie als erstes die Einstellungen fr den mySmartUSB MK3 Programmer vor. Hierzu whlen Sie den Mode STK500, sowie den Port. Besttigen Sie die Einstellungen. Danach whlen Sie unter dem Menpunkt Tools/Chip Programmer den passenden Prozessor aus, entsprechend dem Prozessor auf der myAVR Stamp und besttigen ebenfalls. Im Beispiel wurde die myAVR Stamp 256 PLUS mit einem ATmega2650 verwendet. Status-LEDs status-LEDs Mode: myMode

Mode-Taster mode-button

?
Prog-Mode: abhngig vom Zielsystem prog-mode: depending on target system Auswahl: Taster kurz tippen Choice: press button short

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17 Programmereinstellungen AVR Studio (4.18.700) Schlieen Sie das myAVR Board MK3 an das Rechnersystem an und versetzen den mySmartUSB MK3 Programmer in den Mode STK500 (nheres dazu, finden Sie im Abschnitt zur Tochterplatine mySmartUSB MK3, sowie der Technischen Beschreibung zum mySmartUSB MK3). Starten Sie AVR Studio und whlen Sie den Menpunkt Tools/Programm AVR/Connect... Whlen Sie hier, unter Platform STK500, sowie den Port. Mithilfe der Schaltflche Connect wird nun die Hardware konfiguriert. Abhngig von der myAVR Stamp knnen Sie den Controller auswhlen. Im Beispiel wurde die myAVR Stamp 256 PLUS mit einem ATmega2650 verwendet. Anschlieend ndern Sie Programming Mode und speichern die Einstellungen ber die Schaltflche Read Signatur. Als Ergebnis sehen Sie die Signatur der Hardware (vgl. Bild). Programme knnen Sie nun in der Registerkarte Program mit Hex-Files laden. Status-LEDs status-LEDs Mode: myMode

Seite: 19/20

changing setting in AVR Studio (4.18.700) At first you attach the myAVR Board MK3 to the computer system and put the mySmartUSB MK3 into the STK500 modus (you find more informations to that, in the section of the mySmart USB MK3 and in the technical description of the mySmartUSB MK3). Start the AVR Studio an choose in the menu Tool/Programm AVR/Connect Now you select in the platform list STK500, your port and press on the Connect Button. The Software search the myAVR Board MK3. Addicted from the myAVR Stamp you can select the processor. In the example the myAVR Stamp 256 was used plus with an ATmega2650. After that, you must be changed the programmer mode and press the Read Signature button, to safe the settings. The results of that, you see the signature of the hardware (cf. picture). Your programms can be load with hex-files in the programm tab. Mode-Taster mode-button

?
Prog-Mode: abhngig vom Zielsystem prog-mode: depending on target system Auswahl: Taster kurz tippen Choice: press button short

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Seite: 20/20

Technische Beschreibung mySmartUSB MK3, HW-Version 3.17

Anwendungsbeispiele

Exemples of use

Abbildung / picture: myAVR Board MK3 mit mySmartUSB MK3 myAVR Board MK3 with mySmartUSB MK3

Abbildung / picture: myMultiProg MK2 mit dem USB-Programmer mySmartUSB MK3 myMultiProg MK2 with USB-programmer mySmartUSB MK3

Abbildung / picture: mySmartUSB MK3 mittels ISP ConnectKit mit mySmartControl MK2 16K verbunden mySmartUSB MK3 is connected with ISP ConnectKit to mySmartControl MK2 16K

Abbildung / picture: mySmartUSB MK3 mit myAVR Stamp mySmartUSB MK3 with myAVR Stamp

Allgemeine Sicherheitshinweise
Grundstzlich ist mySmartUSB MK3 nur zum Einsatz unter Lern- und Laborbedingungen konzipiert. Er ist nicht vorgesehen und nicht dimensioniert zur Steuerung realer Anlagen. Bei vorschriftsmigem Anschluss und Betrieb treten keine lebensgefhrlichen Spannungen auf. Beachten Sie trotzdem die Vorschriften, die beim Betrieb elektrischer Gerte und Anlagen Gltigkeit haben. Wir versichern, dass die Leiterplatte durch den Hersteller getestet wurde. Fr fehlerhaften und/oder vorschriftswidrigen Einsatz des Boards bernehmen wir keine Garantie.

Safety Guidelines
mySmartUSB MK3 is designed for educational and experimental use only. It is not intended and not dimensioned to control real industrial facilities. At correct use there will not occur extremely dangerous voltages. Nevertheless, be aware of general guidelines for using electronic devices. We assure that the PCB has been tested by the producer. For incorrect use and/or application contrary to technical regulations we are not liable. .

Die aktuellen Dokumente zum mySmartUSB MK3 finden Sie unter www.myAVR.de im Downloadbereich. The latest documents for the mySmartUSB MK3 you can find at our homepage www.myAVR.com under Download. Abbildungen knnen vom Inhalt abweichen. nderungen im Sinne des technischen Fortschrittes behlt sich der Hersteller vor. Images may vary from the content. The manufacturers retains changes in terms of technical advances.

www.myAVR.de

Laser & Co. Solutions GmbH - 07/2011

www.myAVR.com

Das könnte Ihnen auch gefallen