Teensy 2.0 alternatives, ATmega32U4

User avatar
scottc

16 Jul 2014, 15:20

Muirium wrote: What's the startup time like in ordinary use? I've heard these use a bootloader which waits to check if you're grounding RST for some seconds on every USB start. Annoying for keyboard wake from sleepers like me!
I actually couldn't reproduce any delay at all on my own Pro Micro, which is really nice. Even with all of the plugging and unplugging when debugging, my Soarer converter worked instantly.

User avatar
Muirium
µ

16 Jul 2014, 15:23

Ah, promising! I have my eye on these for putting inside keyboards as dedicated converters. Once they're configured right (running Soarer or TMK) I'd like to be able to just forget about them, and treat the boards as native USB.

User avatar
scottc

16 Jul 2014, 15:33

With the bootloader problem likely a non-issue, it seems a bit pointless to post a full tutorial now. Instead, I'll probably just copy my pinout diagram scrawl into the GIMP.

User avatar
alinh

16 Jul 2014, 15:42

scottc wrote: With the bootloader problem likely a non-issue, it seems a bit pointless to post a full tutorial now. Instead, I'll probably just copy my pinout diagram scrawl into the GIMP.
Full tutorial might help someone who wants to use it and doesn't know which threads to read...

User avatar
scottc

16 Jul 2014, 15:45

Sure, if you think so then I'll definitely do it. I suppose that flashing it is actually pretty difficult due to avrdude being pretty annoying. I only figured out how to flash it by grepping through console output of the Arduino IDE for "avrdude". :D

User avatar
Muirium
µ

16 Jul 2014, 15:49

Yes, definitely make it something the rest of us can check, and (just as importantly) link to in future!

User avatar
matt3o
-[°_°]-

16 Jul 2014, 15:51

arbitrarycombination wrote: I’ve been using the SparkFun Pro Micro for a while, and I’m satisfied with it. Biggest plus to me is the Micro-USB connector, since I refuse to buy any more Mini-USB stuff (this is one of my pet peeves). It doesn’t have space for ISP pin headers though. More annoyingly, it does not have any mounting holes :(

The Arduino Pro Micro is nice as well. Has Micro-USB and ISP pin headers, but comes with the pin rows pre-soldered (at least mine did), so it’s hard to stuff in a keyboard case.

For anyone concerned with bootloader times: if you tinker with AVR processors regularly, I recommend getting an AVR Dragon for about 50€. This allows you to flash anything to a wide range of AVR processors via ISP or JTAG, without worrying about bootloader stuff. Highly recommended if you can justify the expense :)
problem with SparkFun is import taxes, you can find some of their stuff in EU but they are quite expensive.

ps: arduino can be bought without pin headers.

User avatar
alinh

16 Jul 2014, 15:54

Oh yeah, not sure it matters to anyone, but I got my package from Belgium even though it said shipping from China. Guess they have an .eu stash.

User avatar
scottc

16 Jul 2014, 15:56

Ooh interesting, good to know. What seller was it and how long did it take?

User avatar
alinh

16 Jul 2014, 15:58

info is here ;)

User avatar
scottc

16 Jul 2014, 16:01

Thanks for the info! Mine was about half the price, but the items have since disappeared from eBay... :(

User avatar
Muirium
µ

16 Jul 2014, 16:39

Here's the one I got (and I think it was your link, Scott):

http://www.ebay.co.uk/itm/360681719211

Took a week or two to show up, but not a bad price. £4.58 shipped, at the time.

User avatar
scottc

16 Jul 2014, 16:55

A week or two is certainly not bad, mine took closer to 3 or 4. Looks good to me!

User avatar
alinh

20 Jul 2014, 21:43

I can't seem to get pro micro to do a "software reset" into bootloader mode.

I used

Code: Select all

enum function_id {
    TEENSY_KEY
};
void action_function(keyrecord_t *event, uint8_t id, uint8_t opt)
{
    print("action_function called\n");
    print("id  = "); phex(id); print("\n");
    print("opt = "); phex(opt); print("\n");
    if (id == TEENSY_KEY) {
        clear_keyboard();
        print("\n\nJump to bootloader... ");
        _delay_ms(250);
        bootloader_jump(); // should not return
        print("not supported.\n");
    }
}

const uint16_t PROGMEM fn_actions[] = {
    ACTION_LAYER_MOMENTARY(1),
    ACTION_FUNCTION(TEENSY_KEY)
};
and it reboots, but not in bootloader mode.

I might have to wire a switch of some sort so I can connect RST and GND externally - so I don't have to open up the case every time I want to upload new firmware

User avatar
Igthorn

20 Jul 2014, 22:30

With Grendel's BootHID bootloader on a blue pro micro, I can get tmk to jump to bootloader with 'magic key'+pause. The same config (adjusted for 4k boot area size) with the bootloader and fuses it came with just reboots.

Using this calc for reference, I changed fuses from 'lfuse:FF - hfuse: D8 - efuse: CB' to 'lfuse:FF - hfuse: D9 - efuse: C3' and hitting 'magic key'+pause jumps to bootloader for 8secs then loads tmk. Since I'm new to all of this I'm not exactly sure what all the fuses do yet. I think bootrst = 1 and HWBE = 0 fuses need to be set.

User avatar
Muirium
µ

20 Jul 2014, 22:45

A different bootloader? Cool. Got some links?

I just tried flashing Soarer's Converter onto my blue Pro Micro (at last). The GND+RST reset thing is a bit of a pain to do. But I did manage to get the .hex onto it via avrdude, following some instructions Scott told me a while ago.

For notes to remind myself what I just learned:

On OS X, you install CrossPack to get Avrdude. Then you identify the port to flash to by running this command in Terminal, while zapping those pins to get the Pro Micro in loader mode:

ls -l /dev/cu.*

In my case three things turned up, and the only one that wasn't a built in device on my Mac was:

/dev/cu.usbmodem1451

So for me the flashing command is:

avrdude -p atmega32u4 -P /dev/cu.usbmodem1451 -c avr109 -U flash:w:filename.hex

A few attempts at flashing it with Soarer's Converter then followed:

Code: Select all

Johns-MacBook-Pro:~ John$ avrdude -p atmega32u4 -P /dev/cu.usbmodem1451 -c avr109 -U flash:w:/Users/John/Dropbox/Keybored/Soarer_Converter_v1.10/firmware/Soarer_at2usb_v1.12_atmega32u4.hex 

Connecting to programmer: .avrdude: butterfly_recv(): programmer is not responding
Johns-MacBook-Pro:~ John$ avrdude -p atmega32u4 -P /dev/cu.usbmodem1451 -c avr109 -U flash:w:/Users/John/Dropbox/Keybored/Soarer_Converter_v1.10/firmware/Soarer_at2usb_v1.12_atmega32u4.hex 
avrdude: ser_open(): can't open device "/dev/cu.usbmodem1451": No such file or directory
Eavrdude: butterfly_recv(): programmer is not responding
Johns-MacBook-Pro:~ John$ avrdude -p atmega32u4 -P /dev/cu.usbmodem1451 -c avr109 -U flash:w:/Users/John/Dropbox/Keybored/Soarer_Converter_v1.10/firmware/Soarer_at2usb_v1.12_atmega32u4.hex 

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "/Users/John/Dropbox/Keybored/Soarer_Converter_v1.10/firmware/Soarer_at2usb_v1.12_atmega32u4.hex"
avrdude: input file /Users/John/Dropbox/Keybored/Soarer_Converter_v1.10/firmware/Soarer_at2usb_v1.12_atmega32u4.hex auto detected as Intel Hex
avrdude: writing flash (14414 bytes):

Writing | ################################################## | 100% 1.09s

avrdude: 14414 bytes of flash written
avrdude: verifying flash memory against /Users/John/Dropbox/Keybored/Soarer_Converter_v1.10/firmware/Soarer_at2usb_v1.12_atmega32u4.hex:
avrdude: load data flash data from input file /Users/John/Dropbox/Keybored/Soarer_Converter_v1.10/firmware/Soarer_at2usb_v1.12_atmega32u4.hex:
avrdude: input file /Users/John/Dropbox/Keybored/Soarer_Converter_v1.10/firmware/Soarer_at2usb_v1.12_atmega32u4.hex auto detected as Intel Hex
avrdude: input file /Users/John/Dropbox/Keybored/Soarer_Converter_v1.10/firmware/Soarer_at2usb_v1.12_atmega32u4.hex contains 14414 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.12s

avrdude: verifying ...
avrdude: 14414 bytes of flash verified

avrdude: safemode: Fuses OK (H:CB, E:D8, L:FF)

avrdude done.  Thank you.
Yay! Soarer's utilities seem to kinda sorta work. For instance:

Code: Select all

Johns-MacBook-Pro:10.6 intel John$ ./scwr ../10.5\ ppc/SpaceInvader
scwr v1.10
scwr: looking for Soarer's Converter: found
scwr: reading file: 179 bytes: ok
scwr: sending info request: ok
device: failed to respond
Huh? Okay, let's reboot the converter.

Code: Select all

Johns-MacBook-Pro:10.6 intel John$ ./scboot
scboot v1.10
scboot: looking for Soarer's Converter: found
scboot: sending boot request: ok
device: failed to respond
Nope. Right, let's try getting some info:

Code: Select all

Johns-MacBook-Pro:10.6 intel John$ ./scinfo
scinfo v1.10
scinfo: looking for Soarer's Converter: found
scinfo: sending info request: ok
device: failed to respond
Ugh. How about hid_listen?

Code: Select all

Johns-MacBook-Pro:10.6 intel John$ ./hid_listen 
Waiting for device:...
Listening:
wEE 

remaining: FFFC


Keyboard ID: 0000
Code Set: 1
Mode: PC/XT


^C
Well, that's something at least. I need to hook up an actual keyboard to see if this is really working. One good thing is that startup is instant for Soarer on this thing. Phew!

But why is that orange LED on the whole time? Hmm…

User avatar
alinh

20 Jul 2014, 22:55

when you do "scwr" you need to do the RTS+GND thingie.

User avatar
alinh

20 Jul 2014, 22:57

Igthorn wrote: With Grendel's BootHID bootloader on a blue pro micro, I can get tmk to jump to bootloader with 'magic key'+pause. The same config (adjusted for 4k boot area size) with the bootloader and fuses it came with just reboots.

Using this calc for reference, I changed fuses from 'lfuse:FF - hfuse: D8 - efuse: CB' to 'lfuse:FF - hfuse: D9 - efuse: C3' and hitting 'magic key'+pause jumps to bootloader for 8secs then loads tmk. Since I'm new to all of this I'm not exactly sure what all the fuses do yet. I think bootrst = 1 and HWBE = 0 fuses need to be set.
"plx gif moar info!"

a tutorial of some sort would help I guess :)

User avatar
scottc

20 Jul 2014, 22:57

Are you sure? I didn't have to do RST+GND to use scwr and it seemed to work fine... curious.

User avatar
Igthorn

20 Jul 2014, 23:15

http://deskthority.net/workshop-f7/boot ... t7608.html

Grendel's BootHID is in that thread. You'll need an ISP to flash it or change fuses. You'll also need winavr or avr tool chain to compile them.

I used my teensy 2 using this and this as guides on how to hook it up and install arduino ide and teensyduino.
Teensy2-as-ISP_Pro-Micro.jpg
Teensy2-as-ISP_Pro-Micro.jpg (193.03 KiB) Viewed 3879 times
I think it should be possible to use a Pro Micro as an ISP, but you'll need to change the pins in 'ArduinoISP.ino' for it to work. This is because the Pro Micro has SS (PB0) connected to an LED.

ArduinoISP.ino from examples in Arduino IDE.

Code: Select all

#define RESET     SS

#define LED_HB    9
RESET needs to be changed to another pin and LED_HB can be changed to SS if want it to blink when arduinoisp is on.
Last edited by Igthorn on 20 Jul 2014, 23:18, edited 1 time in total.

User avatar
Muirium
µ

20 Jul 2014, 23:17

I don't need to RST+GND to use Soarer's tools. (Think of RST as essentially the same thing as the reset button on a Teensy.) But I'm having some "device: failed to respond" issues, as I posted. Do you get any hiccups like that, Scott?

User avatar
scottc

20 Jul 2014, 23:27

I'm almost finished my full tutorial for using Soarer's converter with the Pro Micro, if it helps. Sorry it took so long! I'll post a 0.1 draft and link to it in here soon.

User avatar
Muirium
µ

20 Jul 2014, 23:28

Thanks. I think I'm almost ready to read it now that I've tasted the process!

User avatar
alinh

21 Jul 2014, 00:05

scottc wrote: Are you sure? I didn't have to do RST+GND to use scwr and it seemed to work fine... curious.
checked again and yeah.. I remembered wrong :oops: , you only need to do rst+gnd when you load soarer, not for scwr

User avatar
scottc

21 Jul 2014, 00:15

Phew, I was worried for a sec. :D

The (mostly) finished guide is up for anyone who needs it:

http://deskthority.net/workshop-f7/how- ... ml#p174388

I'll update it tomorrow with diagrams and instructions on how to wire it up for an AT-style socket, but right now I have to run. Back later!

User avatar
alinh

24 Jul 2014, 22:04

Seems that the usb connector comes off very very easily. I gently tried to move the usb cable a bit to make it fit in the case and the usb connector broke. It's only soldered to the board in 2 places and the 5 pins just make contact with the board. There's no way I can solder that back on. I managed to identify on the board where 4 of the pins connect, but can't find the 5th one... unit lost just when I everything worked and I was putting the case back on :cry:

User avatar
scottc

24 Jul 2014, 22:09

Oh damn. :(

User avatar
alinh

24 Jul 2014, 22:20

So yeah... be very careful if you plan on using this!

What people are saying on the SparkFun Pro Micro page (of which this is a clone of):

"The features of this board are great! However, the usb port snapped off after only a couple days of light usage. I got a second board and covered the terminals in epoxy (and under the board where the little plastic alignment posts go through the board). Hopefully this will extend the life of the connector to survive my development phase. If this only used through-hole solder joints for the usb port it would be perfect!"

"My one complaint is that the USB receptacle is too flimsy (a common problem with surface-mount micro USBs). After plugging / unplugging a USB cable a dozen or so times, even quite gently, the receptacle breaks off, pulling the solder terminals off with it. Although I appreciate the design choice to make the size as small as possible and the back of the board flat, a device whose main feature is native USB should have a sturdier USB receptacle."

"I love this little board….. but word of caution, the micro usb pulls off kind of easy, be very gentle. It would be nice if SF could used vias as the usb footprint pads for added strength which is how we do it where i work for heavy use applications."

User avatar
ماء

27 Sep 2014, 05:53

solarnz wrote: Are you planning on using a board per hand, or one board for both?

If you're planning on using two boards, the Pro Micro should be enough.

I would not recommend the Nano, as it does not use an AtMega32u4 chipset. The Pro Micro does, which means that software that is designed to run on the Teensy 2.0 board can run on it. You will have to look up the Arduino Leonardo / Micro / Pro Micro pin out to map the pin names between what the teensy uses and the Arduino uses, but that is it.

The Pro Micro does indeed not have a reset button, however this is not required.
1) With the default bootloader, it will stay in programming mode for 10 seconds (I think) when it is plugged in before booting the firmware that has been loaded.
2) You can wire your own switch on to it, all you have to do is connect the RESET pin to ground.

An added benefit of the Teensy and it's HalfKay bootloader is that it doesn't spend 10 seconds once it is plugged in to allow for programming. You have to explicitly either press the reset button, or short the reset pin to ground to allow you to program it. This could potentially save you a lot of frustration when trying to use your keyboard in your bios - Imagine being unable to hit the setup key due to your keyboard still booting!
not enough :oops:
murium right, teensy 2.0 is very pretty but hard to find here, I might buy one promicro again
it's make sense/can if i have 2 pro micro for two board or 2 controller :lol: if not I may be forced to buy a teensy :P

nisilhum

29 Sep 2014, 15:07

Soarer wrote: Teensy 2.0 is still the default go-to board for many projects - it's the smallest of the breakout boards, and a good reliable choice. Needless to say, it's the one the rest are compared with.

But different projects have different requirements, and sometimes the Teensy just isn't quite right for them.

---

To build the smallest converter I could, I used a dongle made by TIAO:
atmega32u4_600.jpg
The soldering was difficult and fiddly, and one of the dongles I got didn't work, but I did get one working very nicely in the end :)

---

Lately the Arduino Leonardo and clones have become highly available, and while they're comparatively large, they are easy to plug bits into and experiment with.
Leonardo.JPG
---

Today I spotted a breakout titled "Leonardo Nano Pro Mini ATmega32U4 ..." on eBay
MiniLeonardo.JPG
This one looks quite nice - a little bigger than a Teensy, but it has a couple of nice features. The pinout is more regular, with the pins for each port mostly grouped together, so it would be nicer to use for a replacement keyboard controller. Also, it has mounting holes, so it should be easier to secure inside a project box, without having to first solder it to some stripboard.
pinout.JPG
---

Please post more!

(Please try to upload pictures here rather than link, and if the item is on ebay please try to give enough identification that it might be found again after the listing has expired. Thanks!)
how many pins are owned arduino leonardo r3?
it's enought around 24?

Post Reply

Return to “Workshop”