Working Micro Pro

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

How to use the “Deek-Robot” “Leonardo Pro Micro” board

Device: Leonardo Pro Micro, 5V, 16 MHz, CPU is a MEGA32U4


bootloader: e.g. COM17 (do not use, but for Arduino/AVRdude bootloader access)
serial: e.g. COM18 (use in Arduino environment of for terminal program for serial monitor)
Note: the listed COM port numbers are specific for my system.

LEDs:
red: power
green – close to pin 7: serial RCV, can be set on/off via RXLED1 / RXLED0 macros, also via Arduino pin 17
green – close to pin 14: serial SND, can be set on/off via TXLED1 / TXLED0 macros, no Arduino pin #.

Connection via “Serial” object via USB-Serial


while (! Serial) {} ) waits until the connection is opened e.g. from a terminal program or from serial monitor in Arduino

Figure 1: The Deek-Robot Leonardo Pro Micro board


device connected via COM 18 bootloader is listening on COM17 for commands
driver manufacturer SparkFun Electronics driver manufacturer Arduino LLC (www.arduino.cc)
driver date 15.11.2007 driver date 01.01.2013
driver version 5.1.2600.0 driver version 1.0.0.0
additional USB-HID device (keyboard, mouse simulation) no USB-HID device

Figure 2 normal operation (after bootloader has ended). Figure 3: bootloader active (immediately after connection or after reset)

Note: it is important that the two modes (normal operation versus bootloader active) do not use the same COM port number. If so, the Arduino environment
cannot find the bootloader because it detects the bootloaders COM port by comparing ports before and after the bootloader starts.
As for the device one can use the Leonardo board too, but the “SparkFun Pro Micro” works better. As my board has a 16 MHz oscillator on board and the solder
jumper J1 was open, I selected the 5V 16 MHz variant. With Leonardo I was not able to get Serial() working, probably due to some pin numbering differences,
which I did not dare to explore.
Note that here we select the COM port for normal operation. This port is used for communication with running programs via Serial() only. The communication to
the bootloader uses its own COM port, which is dynamically detected and must be different.

For the dynamic detection I hold the RST pin to GND until the output window shows the first COM port search lines.
PORTS {COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM10, COM11, COM12, COM13, COM14, COM15,
COM16, } /
Then I open the connection and the reset forces the bootloader into action which adds the port COM17 to the list of COM ports in the device manager.

Note that the Deek-Robot board seems to use an older bootloader, which does not detect the reset via open/close of COM port. Also no “double-tap” is needed.
Here is the output from the Arduino IDE with abbreviated directory paths for readability

C:\Arduino-1.0.5\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-


sections -mmcu=atmega32u4 -DF_CPU=16000000L -MMD -DUSB_VID=0x2341 -DUSB_PID=0x8036 -DARDUINO=105 -
IC:\Arduino-1.0.5\hardware\arduino\cores\arduino -IC:\Arduino-1.0.5\hardware\arduino\variants\leonardo
C:\DOK\build45206.tmp\BlinkLeonardo.cpp -o C:\DOK\build45206.tmp\BlinkLeonardo.cpp.o
Using previously compiled: C:\DOK\build45206.tmp\malloc.c.o
. . . more comments on using previously compiled object files
Using previously compiled: C:\DOK\build45206.tmp\WString.cpp.o
C:\Arduino-1.0.5\hardware\tools\avr\bin\avr-ar rcs C:\DOK\build45206.tmp\core.a
C:\DOK\build45206.tmp\malloc.c.o
. . . more ar lines
C:\Arduino-1.0.5\hardware\tools\avr\bin\avr-ar rcs C:\DOK\build45206.tmp\core.a
C:\DOK\build45206.tmp\WString.cpp.o
C:\Arduino-1.0.5\hardware\tools\avr\bin\avr-gcc -Os -Wl,--gc-sections -mmcu=atmega32u4 -o
C:\DOK\build45206.tmp\BlinkLeonardo.cpp.elf C:\DOK\build45206.tmp\BlinkLeonardo.cpp.o
C:\DOK\build45206.tmp\core.a -LC:\DOK\build45206.tmp -lm
C:\Arduino-1.0.5\hardware\tools\avr\bin\avr-objcopy -O ihex -j .eeprom --set-section-
flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
C:\DOK\build45206.tmp\BlinkLeonardo.cpp.elf C:\DOK\build45206.tmp\BlinkLeonardo.cpp.eep
C:\Arduino-1.0.5\hardware\tools\avr\bin\avr-objcopy -O ihex -R .eeprom
C:\DOK\build45206.tmp\BlinkLeonardo.cpp.elf C:\DOK\build45206.tmp\BlinkLeonardo.cpp.hex
Binäre Sketchgröße: 4.826 Bytes (von einem Maximum von 28.672 Bytes)
PORTS {COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM10, COM11, COM12, COM13, COM14, COM15,
COM16, } / {COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM10, COM11, COM12, COM13, COM14, COM15,
COM16, } => {}
. . . here I open the RST-GND connection to create the new bootloader port and allow detection of this port
PORTS {COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM10, COM11, COM12, COM13, COM14, COM15,
COM16, } / {COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM10, COM11, COM12, COM13, COM14, COM15,
COM16, } => {}
PORTS {COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM10, COM11, COM12, COM13, COM14, COM15,
COM16, } / {COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM10, COM11, COM12, COM13, COM14, COM15,
COM16, COM17, } => {COM17, }
Found Leonardo upload port: COM17
C:\Arduino-1.0.5\hardware/tools/avr/bin/avrdude -CC:\Arduino-1.0.5\hardware/tools/avr/etc/avrdude.conf -v -
v -v -v -patmega32u4 -cavr109 -P\\.\COM17 -b57600 -D -
Uflash:w:C:\DOK\build45206.tmp\BlinkLeonardo.cpp.hex:i

avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36


Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "C:\Arduino-1.0.5\hardware/tools/avr/etc/avrdude.conf"

Using Port : \\.\COM17


Using Programmer : avr109
Overriding Baud Rate : 57600
AVR Part : ATmega32U4
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled


Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 10 8 0 no 1024 8 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : butterfly


Description : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .avrdude: Send: . [1b]


avrdude: Send: S [53]
avrdude: Recv: C [43]

avrdude: Recv: A [41] T [54] E [45] R [52] I [49] N [4e]


avrdude: Send: V [56]
avrdude: Recv: 1 [31] 0 [30]
avrdude: Send: v [76]
avrdude: Recv: ? [3f]
avrdude: Send: p [70]
avrdude: Recv: S [53]
Found programmer: Id = "CATERIN"; type = S
Software Version = 1.0; No Hardware Version given.
avrdude: Send: a [61]
avrdude: Recv: Y [59]
Programmer supports auto addr increment.
avrdude: Send: b [62]
avrdude: Recv: Y [59]
avrdude: Recv: . [00]
avrdude: Recv: . [80]
Programmer supports buffered memory access with buffersize=128 bytes.
avrdude: Send: t [74]

Programmer supports the following devices:


avrdude: Recv: D [44]
Device code: 0x44
avrdude: Recv: . [00]

avrdude: Send: T [54] D [44]


avrdude: Recv: . [0d]
avrdude: devcode selected: 0x44
avrdude: Send: P [50]
avrdude: Recv: . [0d]
avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: Send: s [73]


avrdude: Recv: . [87] . [95] . [1e]
################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587


avrdude: Send: A [41] . [03] . [fc]
avrdude: Recv: . [0d]
avrdude: Send: g [67] . [00] . [01] E [45]
avrdude: Recv: . [ff]
avrdude: Send: A [41] . [03] . [fd]
avrdude: Recv: . [0d]
avrdude: Send: g [67] . [00] . [01] E [45]
avrdude: Recv: . [ff]
avrdude: Send: A [41] . [03] . [fe]
avrdude: Recv: . [0d]
avrdude: Send: g [67] . [00] . [01] E [45]
avrdude: Recv: . [ff]
avrdude: Send: A [41] . [03] . [ff]
avrdude: Recv: . [0d]
avrdude: Send: g [67] . [00] . [01] E [45]
avrdude: Recv: . [ff]
avrdude: reading input file "C:\DOK\build45206.tmp\BlinkLeonardo.cpp.hex"
avrdude: writing flash (4826 bytes):

Writing | avrdude: Send: A [41] . [00] . [00]


avrdude: Recv: . [0d]
avrdude: Send: B [42] . [00] . [80] F [46] . [0c] . [94] u [75] . [01] . [0c] . [94] . [9d] . [01] . [0c] .
[94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] .
[0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] .
[01] . [0c] . [94] . [fd] . [04] . [0c] . [94] . [84] . [05] . [0c] . [94] . [9d] . [01] . [0c] . [94] .
[9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] .
[94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] .
[0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [bc] . [01] . [0c] . [94] . [9d] .
[01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] .
[9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01]
. . . more Send/Recv blocks
avrdude: Recv: . [0d]
##avrdude: Send: B [42] . [00] Z [5a] F [46] . [01] P [50] . [10] @ [40] . [01] . [15] . [11] . [05] q [71]
. [f7] . [ce] . [01] . [df] . [91] . [cf] . [91] . [1f] . [91] . [0f] . [91] . [ff] . [90] . [ef] . [90] .
[df] . [90] . [cf] . [90] . [08] . [95] . [ee] . [0f] . [ff] . [1f] . [05] . [90] . [f4] . [91] . [e0] -
[2d] . [09] . [94] . [f8] . [94] . [ff] . [cf] . [11] . [00] . [00] . [e1] . [00] . [00] . [00] . [00] .
[00] . [00] . [01] . [01] . [00] . [00] . [00] . [00] . [2e] . [07] % [25] . [09] . [cd] . [06] . [f4] .
[06] . [db] . [06] V [56] . [07] Z [5a] . [07] . [00] . [00] . [00] . [00] . [fe] . [07] % [25] . [09] .
[a0] . [08] ] [5d] . [08] P [50] . [08]
avrdude: Recv: . [0d]
# | 100% 0.75s

avrdude: 4826 bytes of flash written


avrdude: verifying flash memory against C:\DOK\build45206.tmp\BlinkLeonardo.cpp.hex:
avrdude: load data flash data from input file C:\DOK\build45206.tmp\BlinkLeonardo.cpp.hex:
avrdude: input file C:\DOK\build45206.tmp\BlinkLeonardo.cpp.hex contains 4826 bytes
avrdude: reading on-chip flash data:

Reading | avrdude: Send: A [41] . [00] . [00]


avrdude: Recv: . [0d]
avrdude: Send: g [67] . [00] . [80] F [46]
avrdude: Recv: . [0c] . [94] u [75] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] .
[94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] .
[0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [fd] .
[04] . [0c] . [94] . [84] . [05] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] .
[9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] .
[94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] .
[0c] . [94] . [9d] . [01] . [0c] . [94] . [bc] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] .
[01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] .
[9d] . [01] . [0c] . [94] . [9d] . [01] . [0c] . [94] . [9d] . [01]
. . . more Send/Recv blocks
##avrdude: Send: g [67] . [00] Z [5a] F [46]
avrdude: Recv: . [01] P [50] . [10] @ [40] . [01] . [15] . [11] . [05] q [71] . [f7] . [ce] . [01] . [df] .
[91] . [cf] . [91] . [1f] . [91] . [0f] . [91] . [ff] . [90] . [ef] . [90] . [df] . [90] . [cf] . [90] .
[08] . [95] . [ee] . [0f] . [ff] . [1f] . [05] . [90] . [f4] . [91] . [e0] - [2d] . [09] . [94] . [f8] .
[94] . [ff] . [cf] . [11] . [00] . [00] . [e1] . [00] . [00] . [00] . [00] . [00] . [00] . [01] . [01] .
[00] . [00] . [00] . [00] . [2e] . [07] % [25] . [09] . [cd] . [06] . [f4] . [06] . [db] . [06] V [56] .
[07] Z [5a] . [07] . [00] . [00] . [00] . [00] . [fe] . [07] % [25] . [09] . [a0] . [08] ] [5d] . [08] P
[50] . [08]
# | 100% 0.41s

avrdude: verifying ...


avrdude: 4826 bytes of flash verified
avrdude: Send: L [4c]
avrdude: Recv: . [0d]
avrdude: Send: E [45]
avrdude: Recv: . [0d]

avrdude done. Thank you.

Setting baud rate to 57600 on COM2

You might also like