Wednesday, 23 September 2015

FT2232H stick & 0gb microSD cards

Not particularly interesting, but if you're at all curious about what's accepted for PCB manufacture in terms of multiple boards separated by anything other than silkscreen (it's not possible to get a straight answer from anyone - I tried!) then this had no problems whatsoever:

Although the other bits don't really count as "boards", and of course YMMV.

It's a tiny FT2232H JTAG/UART adapter using the QFN package variant. The schematic is just the reference design from the datasheet like the rest. The GPIO reset pins are "Floss JTAG" compatible IIRC, although probably not required. The board size was chosen to fit those Chinese metal flash drive casings

I also screwed up (finally)! I completely missed a connection to VREG_IN, so it's got a microscopic bodge wire:

The fake micro sd cards worked well - 0.8mm being the upper limit from the specs so might be tight in some sockets without sanding it down. One unavoidable problem is there is 1 corner that a 0.8mm milling bit cannot quite cut far enough (because it's round...) but it doesn't seem to make any actual difference in use, and nothing that couldn't be fixed with a small file.

Allwinner Axx SoCs have JTAG and UART mux'ed on the SDIO pins, so these adapters are meant for debugging "China-pads". The dummy card and eMCP test were really just to fill space :) I would not recommend trying to get a 0.5mm pitch BGA using NSMD pads on a cheap PCB - it was that badly aligned it wasn't usable. Having said that you also wouldn't have space to route more than a few traces anyway... 0.8mm isn't possible if you intend it to pass a DRC :(

Monday, 14 September 2015

More PCBs (6500 Rev. B)

I finally got around to fixing any problems that I found with my first set of boards (which actually wasn't anywhere near as many as I expected!), so here is revision B:

(again, ignore the silkscreen date/rev C - I forgot to take a screenshot before changing the text)

Which might look ok at a first glance... except they thought they knew better than me about what I wanted fabricating and decided to mess with my design files! They handled it well though and even though I sent just a polite query, they accepted responsbility for it and gave me around a 25% credit which was nice. Some details of the changes at the end of this post.

Spot the difference(s) (or scroll down for the list):

Something that I haven't seen / isn't written about in anything that I've read so far is how handy UV reactive flux is. These were after cleaning with IPA and a brush!
It's not easy to photograph though, and looks much better/clearer IRL.

After cleaning it a couple more times, smoke test time... and nothing. After I had re-done most of the power bits I shouldn't have been surprised! After much probing and confusion it turned out to be a faulty/damaged USB mux and not my design. Maybe caused by the fact that they arrived loose in a plastic bag, with styrofoam padding, and then clingfilm around it :/ Anyway, replaced that and it worked OK:

2015-09-13T02:31:18 INFO src/stlink-common.c: Loading device parameters....
2015-09-13T02:31:18 INFO src/stlink-common.c: Device connected is: F2 device, id 0x20076411
2015-09-13T02:31:18 INFO src/stlink-common.c: SRAM size: 0x20000 bytes (128 KiB), Flash: 0x80000 bytes (512 KiB) in pages of 131072 bytes
2015-09-13T02:31:18 INFO gdbserver/gdb-server.c: Chip ID is 00000411, Core ID is  2ba01477.
2015-09-13T02:31:18 INFO gdbserver/gdb-server.c: Target voltage is 3227 mV.
2015-09-13T02:31:18 INFO gdbserver/gdb-server.c: Listening at *:4242...

Back to the changes they made:

- No soldermask between pins


- Randomly decided to add some soldermask where there was not supposed to be any

...and just on one as well, the rest went unmodified!

I tried to remember to note any changes that I made, although there will be some I missed. Here's the list:

- Annotated more stuff
- Added missing TPs for I2S SPK out
- Fattened cap traces for mag sensor (datasheet advice)
- Removed via and copper from under mag sensor (datasheet advice)
- Rearranged traces under FPC connector for better ground plane
- Neatened up a few uneven tracks
- Rotated text on bottom silkscreen
- Swapped PIC pins 1&6 (6 can only be an input)
- Fixed volume switch pinout
- Moved USB capacitor a tiny bit
- Increased BOOT1 pull-down to 10k
- Added footprint for SOT23-5 EEPROM (in addition to SOIC)
- Added SJs for non-essential IC power (NC)
- Added xtal (DNF) for I2S, and routed MCLK to XIN
- Added resistor divider as a battery charge measuring test
- 1k5 USB DP resistor (oops...), and pre-biased PNP switch
- 2mm pads for ext V_IN
- GND RFU to ease transition to F4xx
- 100k pull-ups on SD unused DAT pins
- Diode footprints changed to SOD-323
- Swapped a few tantalums for ceramics
- No mask around top back mount holes
- Re-routed 3V3
- Changed JTAG connector to 1mm pitch JST 8-pin
- Added power switch
- Added a missing decoupling cap
- Routed HP audio to USB MUX
- Replaced PIC with a PNP transistor inverter - CBA
- Had to go to 6/6 for top keypad, I2S, and some others
- MCU decoupling caps down to 0402

Sunday, 16 August 2015

Learning-by-doing: PCB design

As a mini project to learn about hardware design/electronics I thought it would be fun to build some new insides for something. I found a collection of three 'untested' Nokia 6500 slide phones on ebay for a few quid which looked perfect. I intentionally did not do much planning, because it's boring, and there's more to learn by making mistakes if you're willing to accept some failure. Having said that, my basic plan was to make something simple with a microcontroller and common parts, and get it working to learn the process and make some newbie mistakes; then afterwards, make something a bit more complicated (higher density board, BGA, etc) and maybe even useful.

I've only recently discovered that nobody etches their own PCBs at home anymore, because there are overseas companies like Elecrow that can offer this service with professional quality results for a very low price by combining lots of different customers' boards on one panel. They offer a very cheap special offer for 10 identical small PCBs with 6/6 space/trace and 12mil vias. The premium service goes down to 3/3 and 8 but is based on individual quotations.

Common sense says this should have been a 4 layer board, but:4 layer boards are much more expensive than 2 layer. This also had to be 0.8mm to match the original and fit in the phone (even 1.0mm would be too thick, I checked), which added $18 to the price. When you're already paying that much you might as well get it with an ENIG finish as well because it looks nicer... and adds another $18 :/ Also the freeware version of Eagle only supports 2 layers. So for a future version, OK maybe... but for this first prototype that might not have even fit in the case or something, I stuck with 2 layers (scroll down to see the results!). I also didn't push their limits and most of it is 8/8. Some places might be 7 when it was necessary, I can't remember!

I best start off by saying I have no idea what I'm doing - I'm making it up as I go along to see what happens! I found a few mistakes before the boards even arrived (oops!) so a 'revision B' is already in the works. Some of my options were limited, and heavily affected the layout. I did not try and calculate the USB differential pair impedance as it breaks just about every other layout rule out of necessity, but it's only FS anyway so should be OK. Here's what other restrictions I can remember:
  • 10x5cm limit, 2 layer PCB (Actually was about 8.5x4.5 and had to be the exact same shape as the original)
  • Component heights <= 2mm
  • Some places with no components (battery area, and FPC area for the slide)
  • Positions of:
    • 50-pin LCD connector
    • 20-pin Keypad connector
    • USB connector
    • AV connector
    • DC connector**
    • Camera connector*
    • Battery 
    • Volume & camera switches
 * I ignored the camera for now - I don't have a datasheet but I know it's using one of the "top secret" MIPI serial standards and at a guess the MCU won't be fast enough to bit-bang this in any usable manner. Here's a photo I took of what I think is a logo & part code of some description from the image sensor die. I couldn't find anything else that stood out. It's a ~3MP sensor. Maybe I should hook up the I2C bus and see if it responds without any of the other connections...

** I have no use for the DC connector, so needed something to fill the 2.8mm hole. Apparently it's impossible to get a 2.8mm RGB LED, so instead I found these light pipes that work really well. Here's a torch shining through it backwards (not pushed in all the way because it would never come back out). The resulting problem was (assuming my maths worked out) the LED had to be 0.9mm in height from the PCB. PLCC RGB LEDs are nearly double that at 1.6mm. My solution was reverse-mounting the LED in a cut-out so I also had the 0.8mm board thickness to work with (i.e. 0.9+0.8-1.6 = 0.1mm wiggle room). Elecrow charge extra for castellations (it would have doubled the price!) so I made the hole a tiny bit too small and widened it myself.
The connectors were quite easy to identify. The 50-pin is a Molex 51338-0574, the keypad is a JST 20R-JANK-GSAN-TF. The usb and battery any cheap ebay version will do. If anyone knows what the 4 little V shaped springy contact things at the edges are called please let me know because I couldn't find anything even similar!

I remembered to take some screenshots along the way:

At this point I decided it was looking a bit unroutable so ripped it up and started again with the MCU at 45 degrees and moved down a bit:

Woo-hoo, finished! Ignore the "Rev. B" - I only remembered to take a screenshot after I sent the gerbers off and started fixing some of the mistakes (so there are a couple of minor changes):

Finished layout (no ground pour for clarity)
Finished layout (with ground pour)

So in 4 days Elecrow had made the boards and shipped them. They took only 8 days to arrive (China post):

They look great, I don't care even if they don't work :)

I didn't spot any flaws in the manufacturing (they're e-tested anyway) and I'm really happy with the results and service for the price. Where the low cost does show slightly is in the alignment of the silkscreen and soldermask. They're both out by about 4 or 5mil (the broken circle around TP18 was my fault - I forgot to change it and it didn't meet their minimum thickness) :

So how did I do with matching the original shape? Spot on actually, I was surprised!

And the first couple of idiot mistakes:

I didn't bother to check the datasheet/measurements for the JST header I picked for the debug interface. It overlapped the battery by a tiny amount so I had to shave a bit off:

I didn't notice this metal thing which bumps into the capacitor at the top of the board. It was that small of a change that it fit by soldering the cap not-quite-centered on the pads:

Aside from those, I didn't have any diodes that fit the footprint properly, but that wasn't really a mistake in the design I just didn't have the patience to buy some and wait.

EDIT: And I've just noticed I messed up the pad names for the volume switches so they're always pressed. D'oh!

Here's the finished rev. A board after soldering:

It passed a smoke test, and was detected OK:

...and it actually seems to work!

Now I need to develop the software/firmware and see if anything else is broken, then get to work on rev. B!

Thursday, 19 March 2015

Sunday, 15 March 2015

Mini 3G 150M A5-V11 Router (internals/UART)

This is a generic/unbranded router from dealextreme (product 217078)

There's very little information in the product description, but for my 7 quid I ended up with a board known as "A5-V11", which has a RT5350, 4M SPI flash, 32M RAM. It is supported by openwrt (here) but the current bleeding edge with the defaults set is too big. It fits if you drop the IPv6 related packages.

It's already well documented so there isn't any need for much more here. Worth noting is that a standard SOIC clip (i.e. Pomona-style) won't quite make contact due to the position of the big capacitor in the middle. The micro USB port is only used for power... so for future experiments I wired the UART to it following the same pinout as Mediatek stuff. A resistor is required on RX or it won't boot (value not critical, also works fine with 330 ohm).

Maybe needs a couple of blobs of hot glue

The jffs2 thing is a known bug

Tuesday, 10 March 2015

HP Printer JTAG

Harvesting parts from a HP Officejet 6310 the other day I saw this:

Of course I couldn't leave something like that without at least attempting to find out what they were for! Luckily I hadn't yet destroyed any important bits so it went back together...

And typically, they didn't seem to do anything at all. Maybe because it had no cartridges? Well I certainly wasn't going to buy any, so I thought I'd take a ROM image and if I got bored enough some day I could have a poke around it. But then - I found a connector header covered over with soldermask. As a 2x19 with central ground pins I took a lucky guess at "Mictor 38" layout and got a JTAG connection.

VTarget = 2.691V
Info: TotalIRLen = 4, IRPrint = 0x01
Info: CP15.0.0: 0x41059461: ARM, Architecure 5TE
Info: CP15.0.1: 0x0F0D20D2: ICache: 4kB (4*32*32), DCache: 4kB (4*32*32)
Info: Cache type: Separate, Write-back, Format B
Found 1 JTAG device, Total IRLen = 4:
 #0 Id: 0x1594602B, IRLen: 04, IRPrint: 0x1, ARM946E-S Core
Found ARM with core Id 0x1594602B (ARM9)
  ETM V1.3: 4 pairs addr.comp, 2 data comp, 8 MM decs, 2 counters, sequencer
Target interface speed: 100 kHz

...and that's where my knowledge of JTAG debugging ends at the moment. The CPU is some kind of custom HP "top secret" NXP part that doesn't exist, which makes things a bit trickier. This probably isn't the best way to learn about JTAG either. Nevertheless, I'll just keep prodding it until something pops!

<-- "Door open"?! that's the least of your problems haha