Pushing pieces around the board

Time for a brief update on various projects.

NTP Server is fairly close to final. I didn’t manage to knock off actually committing to the 1.4 design I have, but it did have a few tweaks. Primarily fixed up the positioning of the RTC crystal so it’s lying flat instead of vertical so it’s a bit more secure.

I’ve also finally decided that I won’t switch away from the MCP2200 USB Serial bridge on this revision. There was some consideration of switching to a mega 16u2 and using LUFA (an open-source USB stack for AVR MCUs) but I still have a stack of MCP2200′s and they basically are a known quantity.

2.0 also had a bit of a touch up, as I try to figure out what I want from it. The intention with 2.0 is fit into a larger case with a bit of a display. It’s also likely to have some end plates out of plastic cut by Ponoko. The short term plan is prototype the end plates quickly and figure out if the display design will work at all before actually getting the PCB made. (Cut plastic from Ponoko and one case is vastly cheaper as a loss than a stack of PCBs!)

Still undecided is the core platform choice. The easy path will be XMEGA A3 or D3, building off the progress on 1.4. The harder choices are either switching up to A1 (given the utter failure to get any A3′s shipped to me, I suspect not) and seeing how badly 0.5mm TQFP goes, or if I’m going to do that going back into the rabbit hole of ARM Cortex M3 choices (ie, LPC1768/STM32F107/SAM3S, or one of their newer friends). Now there’s going to be a SAM3S based Arduino, could be a good starting place.

LUFA AVR ISPmkII Clone project is still in the shuffling pieces around. Since I’ve gotten myself a real AVR ISPmkII the primary reason for building the project would be getting comfortable with LUFA for other projects. It’s also a simple enough board it would be an okay base for either a live demo of SMD soldering or a tutorial, which I’m attempting to get accepted for the Arduino miniconf at LCA2012.

The big issue at the moment with the board is whether it’s really useful to others (the same issue I had with the Breadboard PSU project) and the slightly harder to solder 0.65mm TSOP logic level shifter on the design. It’s required to ensure it can be used on a wide variety of AVR chips (since, they vary in target voltages), but I’ve had grief with parts that fine before.

Posted in Design, Projects | Leave a comment

First production run of power supplies

The first production run of Breadboard PSUs has now been completed. They’re all ready to ship in anti-static bags after being tested to ensure they’re working fully. It’s quite a strange experience to be the one putting things into anti-static bags, instead of ripping them open to get at the shiny shiny things inside.

I haven’t yet sorted out how these are going to be sold, or pricing. If you’re interested in grabbing one, drop me a note and I’ll work something out. The documentation page linked above also needs to be updated with the correct datasheets and a diagram of the board.

Posted in Projects | Tagged | Leave a comment

NTP Server Progress Update

Just a brief update on the NTP Server project. The most recent revision of the board is starting to look good, and parts have been ordered, but not yet the PCB. What is being done at the moment is checking the scaling of the new parts against the PCB footprints on paper.

This is useful to just check before we order the PCBs that the parts we think match our PCB actually do. At this point it’s cheap to change the PCB (since it hasn’t been made yet), or order different parts. Once the PCB is actually made, there’s a large cost sunk into it which is not recoverable – it either works or it doesn’t.

There’s a long list of changes for this revision, I’ll post those when the PCB is ordered.

One more alarming part of this revision is the MCU appears to have tripped over some limit on CPU cycles before regulations involving WMDs start kicking in. No, I’m not making WMDs, but there are international treaties governing the movement of “high technology” that could be used in their creation.

Today was the first time I’d encountered that for any parts being ordered, and now I’ve had to sign documentation saying I’m honestly not building nukes, or biological weapons, or anything involved in delivering them. How strange.

Posted in Projects | Tagged , | Leave a comment

Just another dev board

Lately it seems like a bunch of vendors have been pushing out more dev boards in the wake of the success of the Arduino platform. Actually, this isn’t quite true, there have always been dev boards out there. The boards were mostly produced by the chip makers themselves, and were fairly expensive compared to the current wave of offerings, but there’s always been a steady supply of dev boards if you wanted to tinker.

The largest change has been to ease of use and a PR talking about how your board is an “Arduino killer”, but does this make any sense?

Latest cab off the rack has been Microsoft’s Gadgeteer platform, based on an ARM MCU and .NET development environment. I’m not picking on this board because it’s from Microsoft, I honestly don’t particularly care who provides the boards and the environment. I am picking on it because it misses the point. It misses it in the same way that NXP’s mbed dev board and (online only!) environment misses it.

Early users only care about how quickly they can get a blinky LED, and how quickly they can interface with some prebuilt modules. All of these offerings do that about as well as each other. If that’s all you’ll ever do – use other people’s prebuilt modules and other people’s libraries – then you’ll probably never run into any difficulties. There’s a lot which can be achieved with that exposure.

But at some point I think it’d be useful to be able to, for some users, take those experiences and go deeper into the rabbit hole of electronics. Not just use other people’s libraries and boards but make your own, dig into the internals of what’s really running on these boards, how they’ve been designed and built, to extend those platforms into a base to explore the whole realm of embedded software and electronics.

So how deep can you go on these Arduino killer platforms? Not that deep. In the Gadgeteer case there’s no PCB layouts or schematics for the mainboard. There’s a spec on how they want you to use the connectors on it, and how to build co-operative modules, but there’s a very clear limit placed on doing anything custom with the mainboard itself. It’s hard to tell from the source code provided, but I don’t see any sign of the any of the code actually running on the MCU. The same goes for NXP’s mbed, the hardware driver libraries are all closed and inaccessible. (NXP’s mbed does provide schematics and PCB layouts for their dev board, but only as PDF images and not in an editable form.)

Neither of these products can be a base for anything other than using the exact products they already have, exactly as they have presented them to you.

I hugely appreciate the fact that much of my own MCU and PCB work is based on looking into these details, and having access to source code running on the MCU, and the schematics and layout of the boards in a form I can edit. That in the end they’re based on what the Arduino project and other true open source hardware projects provide. I really doubt I would have gotten very far with my own boards if it wasn’t for that level of access that the Arduino provides.

And that’s the point. It’s not just about slick dev environments and an open surface to plug things into, and talking about “open hardware” like that means your have a PDF of what the pins on your board do. It’s about how deep into the rabbit hole you can go if you want to. Gadgeteer and mbed will let you get up to your ankles, and no further. They’ll do well and I have no doubt people will do so quite amazing things with them, but they’re no Arduino killer.

Posted in Opinion | Leave a comment

Open Bench Logic Sniffer – First Impressions

Anyone who has poked around with either building their own hardware, or worse trying to work out what’s wrong with someone else’s, will probably end up getting a logic analyser at some point. It can be very difficult to really understand what is going on inside the circuit without one.

The Open Bench Logic Sniifer is a fairly cheap tool to poke around the state of your circuits. It’s notable for being completely open source – the main capture core is actually an FPGA you can get the source to. The client to use it follows a open protocol, and the clients are all open source as well. But is it any good?

Out of the box the first thing you will end up doing is upgrading the firmware on it. Well, when I say firmware, that also includes the FPGA configuration. Thankfully this process is no harder to complete than applying upgrades to anything else. The board has a PIC MCU implementing a USB bridge between your PC and the capture core, as well as handling updates to the FPGA configuration of the core.

You don’t get any probes with the base board, the yellow wires above are just jumper cables I happen to have (and are just fine for anything on a breadboard). Probes are easy enough to get, although vary considerably in quality. The big problem with most probes is the limit of what they can tap. If you’re using fine-pitch QFP packages good luck finding probes which aren’t insanely expensive, even for 0.8mm pitch which isn’t even as fine as QFP packages go.

Even with more expensive logic analysers you’re probably going to be limited by the probes for what you can tap. Keep this in mind both when you’re designing your own boards and when looking at more pricey options.

As-is the board can capture 16 channels at once, although you can solder on a “wing” to give you another 16 (32 in total). That many channels gives you real flexibility to monitor more than just a couple of serial channels, but busses and a significant number of interactions between components. It’s capable of sample rates up to 200MHz, but keep in mind that this is hugely limited by buffer space.

Some analysers stream data continuously to the host PC. This allows them to sample more or less indefinitely, which can be very useful for boot processes or situations where long interaction is required. But streaming comes at a cost – they are limited in the sample rate they can capture. Conversely, while this board can capture much faster sample rates (24MHz for a “streamed” analyser vs 200MHz for this board) it can’t do so for anywhere near as long. 24k samples at 200MHz is microseconds of coverage. Given that, it’s good it supports on-board triggers for when to start captures.

Do you need 200MHz? Probably not, most microcontroller stuff is going to be clocking around 10-20MHz. However, recent updates to the capture core now provide better duration coverage even with fairly high sample rates, and illustrate the advantage of an updatable FPGA core.

Software-side, the PC clients are mostly cross-platform and do an acceptable enough job. The preferred client has a number of useful interpreters for basic serial types (SPI, I2C, UARTs), although lacks a more capable bus interpreter which would be quite accessible given the number of channels available. The client does need a fair amount of polish, and there does seem to be a lot of active development on it towards that end.

In the end, it’s half the price of any of it’s 8-channel competitors while offering 16 channels out of the box and 32 for minimal extra cost, and being FPGA based can be considerably extended and upgraded with features. On the downsides, the sample rate may be higher than it’s competitors but the sample depth is still lacking, and it lacks the pretty (but ultimately not as useful seems) probes of other kits.

Posted in Tools | Tagged | Leave a comment

NTP Update; XMEGA thoughts

Just a minor update about the NTP server project, the board has been reworked a fair bit and this has resulted in a much cleaner design. There’s some parts coming so I can better prove the changes, before I get the PCB made. In the meantime, I’ve been playing more with the XMEGA chip I intend to use on the next revision.

One of the features I like about the AVR XMEGA series of MCUs is having a ton of peripherals is the design freedom you get – most digital blocks of pins have a couple of USARTs, SPI, and four to six channels of PWM output.

Compared to the older MEGA series chips, where you were lucky to get two USARTs and had no choice about where they were, it’s much easier to allocate pins to where you need them close to other components.

There’s other details they’ve really thought through from the code side as well. For many uses you’ll want to just turn particular pins on and off, the way I tended to do this on the MEGA series was something like:

PORTA |= (1 << PORTA3);

which works, and it’s okay for readability. (Aside: I could replace (1 << PORTA3) with _BV(PORTA3) or a bunch of other methods, I’m not saying that’s the only way to do it.). The compiler can optimize this where it’s in IO space down to a single instruction. What happens when you want to raise a couple of lines at once tho?

PORTA |= (1 << PORTA3) | (1 << PORTA4);

The compiler can’t reduce that to a single instruction (CBI and SBI only accept a single bit to clear/set), instead it has to do a read-modify-write cycle. On the XMEGAs however you have bitmask ranges on ports. Setting two bits on PORTA can be done by:

PORTA.OUTSET = PIN3_bm | PIN4_bm;

This is just a write to IO space, not a read-modify-write, and the chip takes care of applying the appropriate changes. (PINn_bm macros are new and replace the old PORTxn macros. They more correctly refer to the pin within any port, which technically was just as true of the PORTxn macros, just not so obvious.) The XMEGA line also includes some other nifty features, which the line above hints at: ports and peripherals are structs from a base, instead of random named addresses.

This means considerably less rewrite for different chips (you can either macro away the PORTA chunk, or pass it into functions as a pointer) and better code reuse. For example, on the old MEGAs if we were setting up a pin as an output and then toggling it once a second (ie, blinky LEDs!), we’d do something like:

#include <avr/io.h>
#include <util/delay.h>

#define LED_DDR DDRA
#define LED_PORT PORTA
#define LED_PIN (1 << PORTA2)

LED_DDR |= LED_PIN; /* pin is output */
LED_PORT &= ~(LED_PIN); /* off by default */
while (1) {
  LED_PORT |= LED_PIN; /* LED on, assuming pin to anode */
  _delay_ms(1000);
  LED_PORT &= ~(LED_PIN); /* LED off */
  _delay_ms(1000);
}

It does the job. It blinks the LEDs. On the XMEGA you can do this a bit differently:

#include <avr/io.h>
#include <util/delay.h>

#define LED_PORT PORTA
#define LED_PIN PIN2_bm

LED_PORT.DIRSET = LED_PIN; /* pin is output */
LED_PORT.OUTCLR = LED_PIN; /* make it off by default */

while (1) {
 LED_PORT.OUTTGL = LED_PIN; /* toggle it! */
 _delay_ms(1000);
}

This has exactly the same result, 1 second on then 1 second off looped. But since the XMEGA has an explicit pin toggling IO register, we can shorten it to using that. Note that we’re also more clearly setting and using features on the port (setting current levels, direction, toggling), rather than ungrouped assignments. Our LED_PORT define is how we access all the features of the port, not just setting state.

Posted in Projects | Tagged , | Leave a comment

First build of Breadboard PSU complete

Completed the first build of the Breadboard PSU project today, since Ponoko had finished making the paste stencil and element14 had shipped at least some of the diode I am trying out on this board.

Thanks to the great stencils cut by Ponoko it was fairly quick to assemble and thankfully worked first time. While it’s a very simple board, it’s still been interesting putting it together.

I am not sure exactly how I’m going to sell these, assuming I work out anyone wishes to buy them That’ll be the next step of the plan!

Below is the competed board plugged into the tiniest breadboard I have around. I think it makes it much easier to use those little boards for trivial projects too. (The rails top/bottom are not connected to it, you’d need to run a couple of wires from the sides of the board to the rails..)

Posted in Projects | Tagged | Leave a comment

New boards!

A shiny new collection of boards arrived today, so they’ve been unpacked and stuffed into storage awaiting being built up!

This is the first run of boards for the Breadboard PSU project, which now awaits some missing components and then a stencil to be cut by Ponoko. Hopefully in a week or two we might actually have completed some boards and have them available to buy!

Posted in Projects | Tagged | Leave a comment

State of SVN

For anyone actually following the SVN tree for the NTP Server, should be aware I’ve embarked on source changes to see how well the XMEGA chip works. This means there’s a tag for the last version which “worked” on PCB 1.3 (tagged as board-1.3) and a new branch called xmega-test which is where I will be .. well breaking everything!

The xmega-test tree may eventually be merged into trunk, probably about the time version 1.4 actually gets made. For now, don’t pay too much attention to it.

Posted in Projects | Tagged | Leave a comment