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

santeri

18 Apr 2015, 16:59

I have Ubuntu 14.04 and Windows 7 on my laptop. I am currently using Ubuntu to flash my pro micro. I will try that dmesg trick. Thanks for the quick responses!

User avatar
scottc

18 Apr 2015, 17:04

No problem. Good luck! I find that shorting the RST pin several times often works better. Just keep lifting the wire to short it up and down for 4 or 5 seconds as you plug the board in. It's a bit finnicky, but it's reliable once you get the hang of it. Good luck!

Someone also posted a thread about using an IDE called Arduino Builder or something on Windows (thread was called 'How to make a Soarer's converter with no soldering or bs' I think) but I never got it to work.

santeri

18 Apr 2015, 17:13

I used the 'watch "dmesg | tail"' and got a response like this:
[ 7353.955579] brcmsmac bcma0:0: START: tid 1 is not agg'able
[ 8270.225369] usb 3-2: new full-speed USB device number 26 using xhci_hcd
[ 8270.356352] usb 3-2: New USB device found, idVendor=2341, idProduct=8036
[ 8270.356363] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 8270.356368] usb 3-2: Product: Arduino Leonardo
[ 8270.356372] usb 3-2: Manufacturer: Arduino LLC
[ 8270.357000] cdc_acm 3-2:1.0: This device cannot do calls on its own. It is no
t a modem.
[ 8270.357044] cdc_acm 3-2:1.0: ttyACM0: USB ACM device
[ 8270.359369] input: Arduino LLC Arduino Leonardo as /devices/pci0000:00/0000:0
0:14.0/usb3/3-2/3-2:1.2/0003:2341:8036.000A/input/input22
[ 8270.359763] hid-generic 0003:2341:8036.000A: input,hidraw0: USB HID v1.01 Mou
se [Arduino LLC Arduino Leonardo] on usb-0000:00:14.0-2/input2

I am sorry but i dont really understand much of this. Is this any help?

User avatar
scottc

18 Apr 2015, 17:33

You can ignore most of it. The output implies that you're successfully shorting it (but I'm not 100% on this). You should examine the USB-related output when you insert the pro micro normally, then reinsert it while shorting pins and see if the output is different. I'm sorry I can't really help much now, but I'll be home in a week and I'll see what I can do then.

Out of interest, are you trying to flash /dev/ttyACM0? That should be correct from the output above. Maybe post your entire command in case it's a typo.

santeri

18 Apr 2015, 17:52

Yes the device I am trying to flash is /dev/ttyACM0 .
I have some code to write and deadlines are getting closer, but I will continue later today and also send the commandline I have used so far.

Have a nice trip!

santeri

18 Apr 2015, 18:15

Oh yes! I got it to work! Thank you so much! Apparently I was too hasty with the RST + GND shorting.

User avatar
scottc

18 Apr 2015, 18:19

Nice! Well done. You're welcome. Post pictures of your project once it's done!

User avatar
XMIT
[ XMIT ]

19 Apr 2015, 02:53

Hmm. Sometimes the default bootloader on the Pro Micro is tricky. Try shorting RST and GND just once and flashing. If that doesn't work short them twice in succession within one second and then kick off your flashing command within eight seconds. If that fails unplug replug and try again.

I got my avrdude installation from one of the Mac SDKs that hasu recommends to install. I cannot recall the name at the moment.

Also, of course, it helps if the Pro Micro is plugged directly in to the Mac. If it fails - seriously - try another USB cable. Some are known to be flaky.

Hope this helps - please post results here...

User avatar
GuilleAcoustic

13 May 2015, 22:53

Nice explanations. I recently bought a Pro micro to replace a Teensy++, as the later doesn't fit inside my trackball (and I'd like to avoid inline controller as much as possible). I'll keep as eye on this, just in case I encounter some issues.

santeri

13 May 2015, 23:35

Okay, now I am clueless.

I successfully flashed my pro micro and have tried two different ways to solder my model m to it but with no luck.

Here is what I get with ' watch "dmesg | tail" '':

[186349.519329] usb 3-2: USB disconnect, device number 5
[187502.624006] usb 3-2: new full-speed USB device number 6 using xhci_hcd
[187502.754013] usb 3-2: New USB device found, idVendor=feed, idProduct=6535
[187502.754024] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=
0
[187502.754031] usb 3-2: Product: PS/2(Set3)-USB Keyboard converter(IBM 122keys)
[187502.754036] usb 3-2: Manufacturer: t.m.k.
[187502.754426] usb 3-2: ep 0x81 - rounding interval to 64 microframes, ep desc
says 80 microframes
[187502.756602] input: t.m.k. PS/2(Set3)-USB Keyboard converter(IBM 122keys) as
/devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:FEED:6535.000D/input/inpu
t19
[187502.756984] hid-generic 0003:FEED:6535.000D: input,hidraw0: USB HID v1.11 Ke
yboard [t.m.k. PS/2(Set3)-USB Keyboard converter(IBM 122keys)] on usb-0000:00:14
.0-2/input0
[187502.759444] hid-generic 0003:FEED:6535.000E: hiddev0,hidraw1: USB HID v1.11
Device [t.m.k. PS/2(Set3)-USB Keyboard converter(IBM 122keys)] on usb-0000:00:14
.0-2/input1

My Model M had a RJ45 connector on it so im using a terminal to USB converter provided by this repository:
https://github.com/tmk/tmk_keyboard/tre ... rminal_usb

My current soldering setup is:

yellow -> 5 ( I believe the yellow is the CLOCK)

red -> 2 (and this one to be DATA)

Black -> VCC

White -> GND

I have also tried this:

Yellow -> 2

Red -> 3

Black -> VCC

White -> GND

Here is a link to a couple of pictures (with old soldering setup):
http://imgur.com/a/8wJkp

My current keyboard is so BAD it hurts! Please help! :(

Findecanor

14 May 2015, 01:46

Have you made sure that your Pro Micro runs on 5V and that it provides 5V to the Model M? There is a jumper that needs to be bridged by soldering the pads together. It should be on the left or the right side of the USB socket on the top side of the board.
Otherwise, the internal voltage regulator will provide 3.3V to the AVR and the Vcc pin.

User avatar
Redmaus
Gotta start somewhere

14 May 2015, 02:08

This could easily not be or be the problem you are having but did you double check and make sure you didn't read the pinout upside down? I did this with my wyse and after I corrected it the kb worked.

keiwop

14 May 2015, 10:46

Hi santeri,
I think you are making a mistake with the pin numbering on the pro micro.
I've never used the tmk converter (only the controller), but in the README, in shows that the pins to use are:
Data: PD2
Clock: PD5

If you look at the first page of this thread, you can see that the PD2 and PD5 do not correspond to the pin numbering on the board. In fact, PD2 is "Rx" and PD5 control a led.
So you'll have to change the pins used in the source code.

If right now you have Data on Pin 2, the corresponding register will be PD1. For Clock on Pin 5, it's PC6.

I've had a look in the converter, and with just changing these lines, you should be ok.

Code: Select all

#define PS2_CLOCK_PORT  PORTD
#define PS2_CLOCK_PIN   PIND
#define PS2_CLOCK_DDR   DDRD
#define PS2_CLOCK_BIT   5
/* RXD for data line */
#define PS2_DATA_PORT   PORTD
#define PS2_DATA_PIN    PIND
#define PS2_DATA_DDR    DDRD
#define PS2_DATA_BIT    2
to

Code: Select all

#define PS2_CLOCK_PORT  PORTC
#define PS2_CLOCK_PIN   PINC
#define PS2_CLOCK_DDR   DDRC
#define PS2_CLOCK_BIT   6
/* RXD for data line */
#define PS2_DATA_PORT   PORTD
#define PS2_DATA_PIN    PIND
#define PS2_DATA_DDR    DDRD
#define PS2_DATA_BIT    1
But I see there are other things declared to use PD1, so if it doesn't work change the DATA to another pin on the pro micro.

santeri

14 May 2015, 13:26

Findecanor: No I have not bridged the jumper. Thanks for the information!

Redmaus: I will look into this, thanks!

keiwop:

So my current CLOCK is in the right pin? Something went right after all :P

I much rather would change the soldering setup. I had so much trouble with the flashing and don not want to do it again (at least not yet) if possible.

Would it work if I solder the DATA to RX and solder the jumper togehter mentioned by Findecanor?

Thanks for the huge help keiwop!

I am also wondering, where did you guys come up with all this information? I usually try to learn while I do projects like this but this time I think I have learned nothing. This is some dark magic shit to me right now. Any recommendations on good articles to read in this subject?

User avatar
HzFaq

14 May 2015, 13:29

I found this was quite handy/informative.

http://www.ladyada.net/learn/avr/avrdude.html

I'm in the process of getting one of these set up to use as an ADB converter, I'll post a bit more when I've got the damn thing flashed :D.

User avatar
Muirium
µ

14 May 2015, 16:50

TMK, right? I'd love a drag and drop ADB converter .hex file for Teensies. The default one in TMK mismaps a few things, enough to drive me mad, and then the very moment I edit the source the whole thing collapses.

I've no idea why. Which is the dangerous part. Every edit I make makes sense to me, but not the compiler. Uh oh!

User avatar
HzFaq

14 May 2015, 16:55

Yeah, I've got a few boards already running TMK so getting it configured and compiled isn't the issue for me; getting the firmware onto the bloody pro-micro is the problem at the moment. I think I know what the problem is, I just haven't had time to sort it yet...

Upload your keymap file somewhere, I don't mind proofing it for you.

User avatar
Muirium
µ

14 May 2015, 16:56

I'll take you up on that when I'm at my computer! It's for my AEK I & IIs, for Mac use. Basically everything exactly as it was in the first place.

santeri

14 May 2015, 17:08

Okay. There is so much tin on the pro micro that I have decided to order a new one from Hong Kong.

For next time though, what exactly should I do?

I am thinking of wiring the DATA to RX and CLOCK to PC6 with tmk setup like this:

#define PS2_CLOCK_PORT PORTC
#define PS2_CLOCK_PIN PINC
#define PS2_CLOCK_DDR DDRC
#define PS2_CLOCK_BIT 6
/* RXD for data line */
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 2

Is this correct?

And should I bridge the J1 piece together?

I am beginning to wonder if my Model M is really dead. :(

User avatar
jou

15 May 2015, 02:06

Keep in mind that even with shorting reset twice correctly, the Pro Micro only stays in bootloader mode for 8 seconds. After those 8 seconds, it starts the flashed program.

technomancy's fork of TMK for Atreus has a nice little addition to the Makefile, a `make upload` target that waits until the bootloader device shows up and then start `avrdude` immediately to flash it. See https://github.com/technomancy/tmk_keyb ... kefile#L42 and https://github.com/technomancy/tmk_keyb ... #L142-L144 for the implementation of it which you can paste into your own Makefile. The device name on Linux should usually be `/dev/ttyACM0` (I mostly use Linux via SSH on machines several hundred kilometres away, so I can't confirm it). On Mac OS X, you can derive the device name from the location ID which you can find in the "System Information" app:
Screen Shot 2015-05-15 at 01.36.43.png
Screen Shot 2015-05-15 at 01.36.43.png (290.06 KiB) Viewed 11279 times
Start with "/dev/ttyusbmodem", drop "0x" and take all digits before the first zero and add an "1" at the end. So in my example with location ID `0x14100000`, the bootloader will respond at `/dev/tty.usbmodem1411`.

User avatar
GuilleAcoustic

15 May 2015, 10:49

I bought only 1 Pro Micro ... but I guess I'll just like the Teensy and solder header pins on it to use as a prototyping one. Best having a sample of each and use them with breadboards.

I do not feel like soldering / desoldering wires until I get it right or cover it completly with melted tin :lol:.

User avatar
HzFaq

28 May 2015, 23:13

Et viola! One functional AAK using hasu's ADB converter running on a pro-micro :D. Very happy with this, going to get it all pretty over the weekend and try it out as a work board. I've also included my super pro wiring diagram incase someone else is planning on doing this ;). Also, sorry about the attachment size...
Attachments
20150528_220115.jpg
20150528_220115.jpg (458.83 KiB) Viewed 11202 times
super_wiring_diagram.jpg
super_wiring_diagram.jpg (212.12 KiB) Viewed 11202 times

User avatar
scottc

28 May 2015, 23:15

Great work! My crappy inline converter doesn't work now so I'm going to have to keep this as a reference for my own AAK.

User avatar
HzFaq

29 May 2015, 13:38

Oh and something that worked out nicely that I didn't even consider to check (stupidly); I followed the wiring guide in the OP and it turns out TMK uses the same pinout as soarers :D.

And a tip for windows users, have device manager open when you're trying to get to the bootloader to flash the firmware. If you expand the keyboard menu and the ports menu (I think thats what it's called, I'll do a screenshot later) you can see if the board made it into bootloader (or not, as is the case 95% of the time with me).

User avatar
scottc

29 May 2015, 14:00

Hah, amazing! That worked out well. :D

User avatar
hasu

07 Jun 2015, 11:12

I got 3.3V Pro Micro the other day and had a problem that bootloader starts sketch or application just in one seconds, not 8 secs after double tap reset button. I couldn't flash firmware at all.

The culprit was infamous 'ModemManager', I'm on Ubuntu. Seems like ModemManager pokes every serial devices when it appears newly, and this cause the bootloader to finish too early and start a sketch.

I lost my half a day until I found the daemon in process list :(

User avatar
scottc

07 Jun 2015, 12:00

Oh no... that's such a pain. :( Well thank you for mentioning it, hopefully it will save someone else the mistake in the future.

Charger

10 Jun 2015, 16:03

I had a hard time programming my pro micro the other day for about an hour I couldn't get it to program then I noticed when I had it go into the bootloader it was changing the port from com4 to com5 for that 8 second program window. Once i figured that out I changed my batch script to the correct port and now it programs without a problem lol

User avatar
HzFaq

10 Jun 2015, 16:08

Yeah, I had the same thing; the pro-micro was on COM1 or something but the bootloader was on COM7. It's the other reason I would recomend having device manager open when fiddling.

Oh and another thing I found helpful was to hard wire a reset button, even if it's just temporary.

Charger

10 Jun 2015, 16:26

HzFaq wrote: Yeah, I had the same thing; the pro-micro was on COM1 or something but the bootloader was on COM7. It's the other reason I would recomend having device manager open when fiddling.

Oh and another thing I found helpful was to hard wire a reset button, even if it's just temporary.
ya I plan to add a switch but since I was just testing it to see if I could get it to work as a numpad I don't have anything connected to it. What I did was just drop a 2 pin header into the reset and ground next to it and just tapped it with a wire to connect the 2 pins and I didn't really have a problem with it. The program window is small but I never missed it the few times I reprogrammed it changing my horribly messed up matrix file one mistake at a time.

So now I have a batch script to compile the firmware and a batch script to program the pro micro it takes all the work out of doing that lol

Post Reply

Return to “Workshop”