Soldered another MCU onto another PCB.
Seems the best approach (with the current footprint--I really need to use a "handsoldering" footprint with longer pads) is to put a tiny bit of solder (0.7mm but could do with even smaller) on the smallest iron bit and then touch it to the end of the pin--after applying copious amounts of flux.
I am also testing with using the programmer with just the connector pins pushed into the whole rather than soldered. (Seems to work so far.)
Tested that the connections were good with:
avrdude -p atmega328p -c usbtiny -t
And it worked! Yay! (Soldering's still not going to win any awards though. :) )
The issue I ran into last time was that I programmed the incorrect fuses when I burned a bootloader (I think, maybe a sketch). I'm using the internal clock and the incorrect fuse configured an external clock for use instead...which obviously wasn't there. I fixed it by supplying a "clock" from an Arduino--fortunately I'd broken out the XTAL pins...
Apparently somewhere along the way I found a board definition:
atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)
And looking at the fuses on the existing board that's what I used...so, fingers crossed!
It worked. :)
What also worked is pressing the ISP connection into the pin holes for the connector but not soldering it. Which is good because it means I can make a case without the who in the back piece. (Oh, I already said that. :) )
What didn't work is that I thought I made a mistake with the soldering of the Back West LED, then I thought I made a programming error but in fact I did neither...
...I think I made my first schematic design error due to my misunderstanding of how the extra (analogue) pins on the SMD ATmega328 work...
But it seems I'm not the only one: Drat!!! (Funnily enough, also a circular board.)
The problem is that unlike the other (standard) ADC pins, the additional ADC6 & ADC7 pins on the SMD chips are only analogue inputs--they don't also functional as digital I/O.
Which means my current boards won't work with the Back West and Back South West LEDs. :/
More relevant links:
There is a "spare" pin brought out as J2 in the current design which is one of the crystal pins but it turns out it's not possible to refer to the XTAL pins directly from within the Arduino environment...which is problematic as Back North West LED is the other XTAL pin...
The workaround is to use direct port manipulation instead. So I'd have to have some sort of wrapper function to check for those pins and handle them differently.
I'm wondering if I could change the button input to use one of the special ADC pins instead...although that would prevent it from being used with an interrupt. Ditto for J3/Tilt sensor. I don't necessarily require interrupts with either of them currently but I'd rather the option be there...
If I understood the interaction between the LEDs and the MISO/MOSI/SCK lines better I could try doubling up and using them. But I know when I've tried to do that previously I ran into issues...I think I remember reading somewhere that some sort of resistor was needed to work around the issue.
Possibly ditto for the TXD/RXD pins but given I've only been using the ISP for programming it may be work repurposing those. The only loss would be for debugging.
For salvaging the boards I've got, I suspect that repurposing TXD/RXD is the easiest option. They are at least nicely broken out but on the opposite half/side of the board than where they're needed--I'm also not sure how nicely I'll be able to solder to the LED (and will need to cut the track) but I guess that's what green wires are for...
Oh, yeah, and if I'm using different colours of LEDs on the front and back I need to work out the correct resistor values for them to balance the brightness (or reduce the red ones in software but I'd prefer the green ones be brighter...). (Yeah, definitely need to make the greens brighter--they don't currently shine through the enclosure very well.)
Here's a partial set of defines for the current pins:
#define LED_FN 5
#define LED_FNE 4
#define LED_FE 6
#define LED_FSE 7
#define LED_FS 9
#define LED_FSW 8
#define LED_FW 10
#define LED_FNW A0
#define LED_BN A1
#define LED_BNE A2
#define LED_BE A3
#define LED_BSE A4
#define LED_BS A5
#define LED_BSW A6 // Invalid
#define LED_BW A7 // Invalid
#define LED_BNW -1 // Needs special handling