-
Notifications
You must be signed in to change notification settings - Fork 84
Appendix E: Firmware Programming (Non QMK Devices)
This guide is strictly for Ploopy devices that do not come preloaded with QMK. These instructions are for putting the old, non-QMK firmware onto the trackball. If that's what you really want, then go ahead. But if you're going to reprogram the firmware anyways, try mounting QMK at Appendix C: QMK Firmware Programming.
The Arduino Nano is how you're going to program your Ploopy Trackball, whether you're building your own Ploopy Trackball boards, or you're unsatisfied with the firmware that we shipped on your boards when you bought them from us.
The Arduino Nano offers a very simple and easy way of programming the microcontroller, which is why we're going to use it. Let's dive in.
- The Arduino IDE
- A base PCB with all components soldered
- An Arduino Nano (I get them on Amazon)
- A USB mini-B to USB A cable (something like this)
- Hookup wire (something like this; any breadboard jumper wire or 24AWG hookup wire will do fine)
- A 10uF capacitor (something like this)
- A breadboard (something like this)
The base PCB has a 6-pin ICSP header. The pins are numbered like this:
1 -> ■ o <- 2
3 -> o o <- 4
5 -> o o <- 6
Note that pin 1 is a square pad on the board. Also, this is the way the header looks when viewed from the top of the board (i.e. when the microcontroller is visible). Here's a picture of what it looks like.
Make the following connections using hookup wire:
ICSP Pin 1 -> Arduino Pin D12 (MISO)
ICSP Pin 2 -> Arduino 5V (V_USB)
ICSP Pin 3 -> Arduino Pin D13 (SCLK)
ICSP Pin 4 -> Arduino Pin D11 (MOSI)
ICSP Pin 5 -> Arduino Pin D10 (RST/CS)
ICSP Pin 6 -> Arduion GND (GND)
If your board doesn't have a header soldered to it (i.e. there are holes that go straight through the board instead of pins that jut out of the board), you'll need to ensure good physical contact between the wire and the pin holes in order for the programming step to work. See the Q&A at the bottom for more details.
In this step, you'll add the Ploopy Trackball board definition to your install of the Arduino IDE.
- Visit the Ploopy Trackball Github firmware page and download the entire
hardware/ploopy/avr
directory onto your computer. - Copy the
hardware/ploopy/avr
directory tree into your Arduino folder.- On Windows machines, this could be somewhere like
C:\Program Files\Arduino
orC:\Program Files (x86)\Arduino
. - If you're part of the Linux master race, look somewhere like
~/Arduino
. - Macs should also have Arduino installation locations somewhere around
~/Arduino
. - Individual installations will differ. If you're having trouble, try Googling
where is my arduino hardware folder [your operating system here]
.
- On Windows machines, this could be somewhere like
- Restart your Arduino IDE, if it's running.
- Verify that the board definition was successfully added. You'll know if you were successful if you open your Arduino IDE and go to
Tools > Board
and see an option forPloopy Trackball
(you'll have to scroll way down).
In this step, we'll program the Arduino Nano with the ArduinoISP sketch so that it can program the Ploopy Trackball.
You'll only need to do this step once. If your Arduino Nano is already programmed to be an ArduinoISP, skip this step.
- Plug your Arduino Nano into your computer (via its USB mini-B port).
- The Arduino Nano should have a few status LEDs that illuminate when it's powered on.
- You don't need the Ploopy PCBs for this step. You can put them aside for now.
- Fire up the Arduino IDE.
- Remove any capacitor between RST and GND on the Nano, and then open up the ArduinoISP sketch in Arduino IDE (in
File -> Examples -> 11.ArduinoISP -> ArduinoISP
). - Upload the ArduinoISP sketch onto the Arduino Nano.
- Make sure that, in the Arduino IDE,
Tools > Board
is set toArduino Nano
andTools > Programmer
is set toAVRISP mk II
.
- Make sure that, in the Arduino IDE,
If the Arduino IDE reports that you successfully flashed the firmware onto the Arduino Nano, then you're done.
In this step, you'll use the Arduino Nano to program the Ploopy Trackball.
- Visit the Ploopy Trackball Github firmware page and download the entire
production
directory onto your computer.- NOTE THAT not all of the firmware versions will work on all of the boards!
- First, check to see what kind of main board you have. Look at the board for a revision number (the board containing the sensor, the one that lies flat, not the vertical one). The code should look something like "R1.00X", where X is some number.
- If that number is R1.004, R1.003 or, very rarely, R1.002, use the firmware in the "r1.004" branch of the code.
- If R1.005 or higher, use the main branch.
- If it's not running, start the Arduino IDE.
- Open the Ploopy firmware by selecting
File -> Open
and selectingproduction.ino
. - Ensure that a 10uF capacitor is placed between RST and GND on the Arduino Nano. (The polarity of the capacitor doesn't matter. So, if you're using an electrolytic capacitor, it doesn't matter which way you plug it in.)
- Connect the Arduino Nano and the Ploopy PCBs via its ICSP header.
- The Ploopy Trackball will either be completely dim, or there will be a white LED that is either very dim or very bright. Any of those are normal states.
- In the Arduino IDE, set
Tools > Board
toPloopy Trackball
andTools > Programmer
toArduino as ISP
. - If necessary, burn the Arduino bootloader onto the Ploopy Trackball by selecting
Tools > Burn Bootloader
.- You only have to do this once. Don't do this every time you reflash the microcontroller.
- Go to
Sketch > Upload Using Programmer
to upload a sketch to the Ploopy Trackball.
If the Arduino IDE reports that you successfully flashed the firmware onto the Ploopy Trackball, then you're done.
Plug the electronics assembly into your computer. The buttons should be clicking, and if you hover your finger over the sensor, it should move the cursor.
Congrats, you finished flashing the firmware! Give yourself a pat on the back.
You're ready to get on with this thing. Head over to 2. Electronics assembly to continue assembling your Ploopy Trackball.
In general, Google is going to be very helpful when trying to discover the causes of problems. That's because we're using Arduino, and Arduino is very popular. If you're having problems, take a quick look here first, then dive into the Net.
Q: When I try to program the ArduinoISP sketch onto the Arduino Nano, it fails. What's going on?
In general, the Arduino boards play very nicely with the Arduino IDE. If you can't program the Nano, there are probably some big problems. Here are a few tips:
- Ensure that the status LEDs illuminate when you plug in the Nano. If they don't, you've got some kind of power issue.
- If you've got an old Arduino Nano, try going to
Tools > Board > Boards Manager
. Look for theArduino AVR Boards
package, and downgrade it to version 1.6.20 or lower, then restart your IDE and trying programming again. Yes, it's a weird fix, but it fixed something for us. - Try using a different USB cable. Alternatively, use a multimeter to verify that the connections in the cable are correct and functional.
- Try using a different Nano.
- Make sure that the Arduino Nano has it's own bootloader loaded on to it. There are instructions online for how to do this.
- Double check the IDE settings, making sure that things like
Tools > Board
are set correctly (should beArduino Nano
). - Use a magnifying glass to inspect the Nano. Ensure that there aren't any stray solder connections between pins. A multimeter may help.
Q: When I try to program the Ploopy Trackball, or flash the bootloader to the Ploopy Trackball, I get an error that looks something like this:
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
What's going on?
Hate to say it, but you probably hooked something up wrong. Generally, Device signature = 0x000000
means that the microcontroller (on the Ploopy Trackball) isn't being powered. So, either you swapped a few of the ICSP pins, or you missed a solder connection somewhere. One thing you could try to do is use a multimeter to verify whether power is being supplied to the Ploopy Trackball board.
Q: Okay, but now I'm getting an error that looks slightly different:
avrdude: Device signature = 0xffffff
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
Huh?
If this is happening, it's likely that your hookup wire isn't making perfect contact with the header on the Ploopy board. Make sure that all of the wires are touching the holes well, and then try again.
Copyright (C) 2020, Ploopy Corporation.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".