How to use a Pro Micro as a cheap controller/converter

User avatar
beltet

25 Oct 2014, 00:46

Wow! Nice write up! Thanks for sharing your experiments.

quantalume

25 Oct 2014, 01:10

Yes, very nice writeup. I have some bash and Python scripts that I use to program the Pro Micros. Here's the bash script, which I name something like burn.sh:

Code: Select all

#!/bin/bash
python reset.py /dev/ttyACM0
sleep 2
avrdude -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:./Soarer_at2usb_v1.12_atmega32u4.hex:i
Here's the Python script which it invokes (reset.py):

Code: Select all

import serial, sys

serialPort = sys.argv[1]
print serialPort

ser = serial.Serial(
    port=serialPort,
    baudrate=1200,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    bytesize=serial.EIGHTBITS
)


ser.isOpen()
ser.close()             # close port
All you have to do is edit the bash script to reflect the hex file you wish to burn. It works every time without fail, and I so far haven't had occasion to go back and update the firmware.

User avatar
macmakkara

09 Nov 2014, 11:37

Oh btw there is package called winAVR http://sourceforge.net/projects/winavr/ for windows and it incudes avrdude.

But when using pro micro you also need to install arduino IDE for leonardo drivers.


Then to othen point. Im gettin error when trying to flash avrdude: error: buffered memory access not supported. Matbe it isn't a butterfly/AVR109 but a AVR910 device?

User avatar
Laser
emacs -nw

09 Nov 2014, 12:19


User avatar
macmakkara

09 Nov 2014, 12:28

Oh didin't see that. Need to get new cable somewhere.

User avatar
Nuum

09 Nov 2014, 12:41

Maybe that's the problem I had with my FaceU which runs ps2avr and is not working properly with a cheap USB cable. Now it is working with a slightly more expensive cable. I don't know whether ps2avr and winAVR are related but it sounds like they are.

User avatar
scottc

09 Nov 2014, 12:55

Laser wrote: Use a different USB cable?

http://stackoverflow.com/questions/2358 ... -supported
Nuum wrote: Maybe that's the problem I had with my FaceU which runs ps2avr and is not working properly with a cheap USB cable. Now it is working with a slightly more expensive cable. I don't know whether ps2avr and winAVR are related but it sounds like they are.
That's insane... I need to get some more mini USB cables! Maybe my face-u isn't dead after all! That'd be a bit of a pain after I went and bought a whole new PCB from matt3o. :lol:

User avatar
macmakkara

09 Nov 2014, 13:09

Yep and also there is some known problems with USB 3.0 and atmega32 without any solutions. If your using usb 3.0 test at usb 2.0 or with 2.0 usb hub. Didin't work for me.

User avatar
chzel

09 Nov 2014, 17:42

I made a soarer's converter with a Pro micro last night and using a thin noodly micro usb cable caused the uC to brown out (voltage momentarily dropping low enough to reset the uC) when I connected the keyboard, and for some reason my Tipro still refuses to work with it, while the M works just fine!

User avatar
macmakkara

12 Nov 2014, 17:01

Got new cable today. Still no go... I think i need to install linux...

User avatar
Muirium
µ

12 Nov 2014, 17:03

Sounds like someone who hasn't tried Linux! Good luck…

User avatar
macmakkara

12 Nov 2014, 17:07

I have used linux daily when i did not game much. Actually i still have my arch install with xfce on my laptop but its really old and last update forked it. So it doesn't boot to xfce (can access console though). And i run Dedicated debian server. But im propably going to download debian and install it on my laptop.

User avatar
Muirium
µ

12 Nov 2014, 17:12

Fair enough. I used to be much more into it before I tried it. Just haven't got the patience to manage a computer as closely as that. I'm not the right kind of mind for the terminal, apparently. Let alone programming… which always works so much better before I hit build! Anyway, enough grumbling. It's that trafficky time of day.

User avatar
Muirium
µ

12 Feb 2015, 01:59

@Scott: What dd you do for earthing? I've got an AT I want to install one of these in as well. (My one and only Pro Micro has been sitting around waiting for a purpose while Teensies get all the fun.) But Model Fs are capsense and so pretty damn sensitive when it comes to earthing.

I'd like to know where to tap the earth connection to the Pro Micro. Or does it not matter so much once the case is done up?

User avatar
scottc

12 Feb 2015, 02:52

I actually didn't do anything apart from wiring those four pins that I showed in the OP. I never actually mounted it in the case after all, I ended up taking it apart and using it for some other projects since I didn't need any Soarer converters at the time (which is no longer the case since I modded my AT's layout a week or two ago). It worked just fine for the time that I tested it like that on my AT, so I'd say you'd be alright!

User avatar
beltet

14 Feb 2015, 02:01

What I did on my M 122 was that I soldered it on top of the USB mini port on the teensy. I thought that it wouldn't be wise to combine GND and earth.

EDIT: I think it was like that... Not 100% sure... And I can't check either because the board ain't at home. I remembered it was quite a pain to get it onto it. But maybe I didn't have the right tools at the moment.

Yeitso

16 Mar 2015, 14:51

Can't seem to get this to work. Im using a Pro Micro and have Data hooked up to PD1 and clock to PD0 and nothing happens when i hook up the converter exept it shows up in my hardwarelist as a keyboard.
I've added a 4K pull-up resistor to the data line from VCC and that made the keyboard light up when i hooked it up but its still not working. Do I need a pul-up resistor on the clock line aswell?

Ive changed the PS2_DATA_BIT to 1 and PS_CLOCK_BIT to 0 in the config on USART as the Pro Micro does not have PD5 (it does but thats one of the internal leds).

User avatar
Muirium
µ

16 Mar 2015, 15:14

What keyboard are you using with it? And are you sure you've got the polarity for VCC and GND right?

I had an embarassing mishap with those and this here AT recently. (I misread the AT port diagram, and had things horizontally flipped.) My Pro Micro survived, but all that would happen with the keyboard connected was some light in the lock LEDs.

Yeitso

16 Mar 2015, 15:45

I just changed to soarers converter without any soldering redone and it started working. So i guess somthing went wrong when i built the tmk firmware.

User avatar
scottc

16 Mar 2015, 15:47

Muirium wrote: What keyboard are you using with it? And are you sure you've got the polarity for VCC and GND right?

I had an embarassing mishap with those and this here AT recently. (I misread the AT port diagram, and had things horizontally flipped.) My Pro Micro survived, but all that would happen with the keyboard connected was some light in the lock LEDs.
Was it a momentary light on the lock LEDs, or did they remain turned on?

Yeitso

16 Mar 2015, 15:53

It was the boot flash, but nothing more after that. might be somthing with my ISO layout?

I used the bundled spacefn layout when building the hex

User avatar
scottc

16 Mar 2015, 16:07

I've never used TMK on a Pro Micro so I can't be sure. Sorry about that.

I'm interested in what Mu encountered because I might've run into the same thing at one point without realising!

User avatar
jou

16 Mar 2015, 22:41

If you need more than the 18 pins available, you can get two more by repurposing the onboard LED pins.

I just did an Atreus build with a Pro Micro clone and was exactly two pins short. I needed 15 pins for the matrix, 2 for the Trackpoint and 3 for indicator LEDs, totalling 20. So I desoldered the RX/TX LEDs and soldered wires to the end of the current limiting resistor connected to the controller.

There's also a reset button, so every pin except RAW on that little thing is connected to something.
resized-IMG_0399.jpg
resized-IMG_0399.jpg (408.37 KiB) Viewed 2667 times

User avatar
Muirium
µ

16 Mar 2015, 22:53

scottc wrote: Was it a momentary light on the lock LEDs, or did they remain turned on?
Could have been a flash, or could have been constant dim lighting across all three LEDs. I had both of those with it, but I forget which way round. My next problem was the Pro Micro crapping out when I plugged too much other stuff into my USB hub. The keyboard was so picky! I cured that by swapping it out for a Teensy 2.

The Pro Micro's still loaded with Soarer's Converter though, so I'll just use it in something else. Has to be a smaller board than this one though. The big boys are always up on my standing desk with the hub.

User avatar
XMIT
[ XMIT ]

12 Apr 2015, 17:41

I'm using TMK on a Pro Micro just fine. There are only a couple of things to remember:

- In the Makefiles, remember to always set:

Code: Select all

MCU = atmega32u4
Some have this set by default, but e.g. M0110 does not.

- In the Makefile, assuming you are using avrdude for programming as I am, also do:

Code: Select all

# Program Sparkfun Pro Micro using avrdude
PROGRAM_CMD = avrdude -p $(MCU) -P /dev/cu.usbmodem1421 -c avr109 -U flash:w:$(TARGET).hex
- I found a 10k pullup was necessary for older boards. Try with and without it.

- With the default bootloader, short RST to GND twice in succession. Then you have 8 seconds to flash!

User avatar
scottc

12 Apr 2015, 18:04

That tip for the Makefile is really nice. I hadn't thought of putting it in there at all. Of course, the device path might be different, though.

I haven't tried using a 10k pullup. I'll give it a go if I ever run into problems!

santeri

18 Apr 2015, 16:41

I am having problems with avrdude:
avrdude: butterfly_recv(): programmer is not responding.

This error occurs when I try to run:
avrdude -p atmega32u4 -P YOUR_SERIAL_PORT -c avr109 -U flash:w:filename.hex
where I have replaced YOUR_SERIAL_PORT and filename.hex with proper ones.

Does someone know a solution for this?

User avatar
scottc

18 Apr 2015, 16:43

Did you put your board into bootloader mode as mentioned in the OP?

santeri

18 Apr 2015, 16:49

I think so yes. Does something flashy happen when I connect the GND and RST twice? In other words: How do I know if my pro micro is in boot mode?

User avatar
scottc

18 Apr 2015, 16:54

Are you using Linux or Windows? In Linux, check the output of dmesg. You can use `watch "dmesg | tail"` or just run `while true; do clear; dmesg; sleep 5; done`. In Windows, you should see something like "Arduino Leonardo Bootloader" pop up in the device manager.

If you're using OS X, god only knows but it's possibly the same as Linux. I'm in an airport right now so I can't check since I don't have a boards with me.

Post Reply

Return to “Workshop”