Close
0%
0%

Tiny Bit Dingus

Every Day Carry bit flipper

Similar projects worth following
TBD is a modern USB alternative to the quick-and-dirty PC printer port hacks of the past. It's not meant to replace a Bus Pirate, Arduino, or other existing PC-to-wire interface, but to add a middle ground that's easily programmable yet physically small and simple to connect with as few cables as possible. TBD relies on the mbed libraries to handle wire protocols and USB so that most interface scenarios can be set up with just a few lines of code.

Sending code to TBD is done through a Chrome browser plugin. No drivers, no special permissions needed.

This project started out as an excuse for me to learn KiCAD and solder stenciling.

Goals

  • Low cost - TBD should be affordable enough to use as a component in a project
  • Easy to program - TBD's functionality should be controllable through a minimum of coding. TBD's dev tools should require a minimum of effort to install and configure
  • I/O support - TBD's I/O pins should encompass as many hardware inferfaces as possible. At a minimum TBD should support 1 channel each of SPI, I2C, and UART though not necessarily at once.
  • Upgradable - TBD should be programmable by a USB host using simple tools
  • Unbrickable - TBD's micro should contain a bootloader in ROM that can be forced to run by hardware strap
  • Small - TBD should be as small as possible so that it can be always available in a portable toolkit

Hardware

The TBD board connects a USB host to 6 I/O pins by way of a Freescale KL27Z ARM microcontroller. TBD's PCB is sized so that it plugs directly into a USB port, and has pads so that no additional USB connector is needed. A plastic shim on the opposite side of the USB-A pads insulates the PCB from the port frame and improves the fit and contact with the port. I/O is exposed on an 8 pin 0.100" pitch dual row pin header. The header is an SMT right angle style that minimizes the overall length of TBD. Overall height of the PCB and header leaves sufficient clearance for other USB plugs above and below the board when plugged into a stacked USB-A port.

A Freescale Kinetis MKL27Z256VFM4 microcontroller is at the heart of TBD. Few other components are required: bypass caps, USB and LED current limiter resistors, connectors, and the LED are the only other parts on the PCB. The KL27Z micro contains a 48MHz ARM Cortex-M0+, 256K flash, 32K RAM, various peripherals, 5V to 3.3V linear regulator, and a 16K Kinetis Bootloader ("Kibble") ROM. An internal trimmed oscillator provides the core and most of the peripheral clocks, while the USB device interface is "clockless" by way of clock recovery from the USB host, so no external crystal is needed. The on-chip 3.3V LDO steps down the USB bus power to the 3.3V chip supply, and is available on the I/O header to power low current devices.

The I/O header exposes ground and 3.3V as well as 6 pins that are multiplexed for GPIO, I2C, SPI, FlexIO (Freescale generic serial interface), UART, timer, and ADC. One pin (I2C1_SDA) is sampled by the micro on power-on and will force the ROM bootloader to run if pulled low. This pin is situated next to GND so that a 2 pin jumper can be fitted over both. All I/Os on the header are directly connected to the micro without any current limiting, filtering, or other protection. This is common and almost expected for other similar micro dev boards.

(todo: insert pin map / mux table)

An LED connected to one of the GPIOs can be used by software for status.

The PCB is made with all SMD components located on one side except for the header. Stencil / paste / reflow is used to solder the component side, while the header is hand soldered. The LED and passives are all 0603 size, while the micro uses the 5x5x1mm QFN-32 package.

Software

Toolchain : mbed

Coding for TBD is done using the mbed library. The plan is that eventually (somehow?) TBD will be supported in the mbed web-based online IDE, making development possible with nothing more than a browser.

For now the mbed library can build TBD-compatible projects offline using the KL43 target, a package variant of the silicon used in TBD. This takes much more effort to use than the online IDE, and detracts from the convenience factor TBD promises.

The Freescale KDS / KSDK IDE can be used as an alternative, but is also not as simple as the mbed online IDE.

Flashing : kut

kut is a Chrome browser app that uploads new firmware to the KL27 micro in TBD over USB. Uploading new firmware to TBD with kbl is as simple as choosing a file from the local disk, putting a jumper over two pins on TBD (clearly marked in the silkscreen), and plugging TBD into the PC. As a local Chrome app, kut can access certain USB devices and local files without needing device...

Read more »

  • 1 × MKL27Z256VFM4 Freescale Kinetis M0+, 256K flash, QFN32 package
  • 2 × ERJ-3EKF33R0V 33 ohm 0603 Electronic Components / Misc. Electronic Components
  • 1 × ERJ-3GEYJ101V 100 ohm 0603 Electronic Components / Misc. Electronic Components
  • 2 × VJ0603Y104JXJPW1BC 100nF 0603 ceramic X7R Capacitors / Ceramic - 100nF 0603
  • 1 × M20-8910405 8 pin dual row SMT RA header Connectors and Accessories / Board-to-Board and Card Edge Connectors

View all 6 components

  • Update

    ajlitt09/01/2015 at 20:27 0 comments

    I've had to put this project on hold the last few months due to work. In the meantime, I've had some time to consider where I want this project to go.

    The Freescale KL27Z no longer seems like a good option. According to this conversation it sounds like FRDM-KL43Z support in mbed is stuck in limbo. I have no definite plans for producing TBD, so it wouldn't be eligible to be an online toolchain platform. I need mbed to have an existing platform compatible with the KL27Z in the online IDE, and I was hoping that the FRDM-KL43Z would be it. To make matters worse, I found that Linux has the same access control restrictions on USB HID devices as other classes, so the convenience advantage of HID on Windows doesn't extend to Linux.

    And so the current TBD hardware is dead.

    But TBD is not. Stay tuned.

  • Cold goop and sadness

    ajlitt07/08/2015 at 14:43 0 comments

    Don't stencil solder paste unless it's up to room temperature. Also use a decent hub with VBUS fuses. I learned these lessons at the cost of a USB port on my main desktop and a fried TBD.

    Good news is that the microUSB variant build worked briefly. I'll try to build another up tonight.

  • v0.2 first build

    ajlitt06/30/2015 at 05:57 0 comments

    I nearly burnt the first v0.2 as I didn't have the thermocouple placed correctly. The LED did cook, but I have a long strip of them so no big deal.

    So far it works, the ROM bootloader enumerating under Linux with no problems. LED and pins will need to be exercised.

    There are already a couple of problems I plan to fix in the next iteration. Most obvious is the silk text for the pin labels is too small to print properly, and would be illegibly small even if it did. It would be helpful if there was a silk placement marker for the plastic shim like v0.1. On the stencil, I should have made the test pad cream-less, and possibly use a smaller footprint. I should also make separate stencils for the two USB variants otherwise I have to clean paste from the micro USB footprint.

    I realized that I mistook I2C1_SCL as being the alt function for the boot pin and placed it next to GND so I can put a 2 pin jumper on to force ROM boot. I2C1_SDA is the correct pin, and I will swap the two in v0.3. Finally, the header on the next version will use the header footprint with locating pegs as centering it by hand is a pain.

    Pics in the gallery.

    Edit:

    The LED blinkens and the KSDK USB-CDC demo works great. The changes I want to make for v0.3 are minor, but before I commit to more PCBs and stencils I want to test out I2C, SPI, and UART, and try building up another board with the microUSB header.

  • PCB's in the mail

    ajlitt06/29/2015 at 19:12 1 comment

    The PCBs for v0.2 should be waiting for me on my doorstep when I get home tonight. The components and stencil arrived last week, so tonight I'll be baking boards.

    I'm so excited that I spent my lunch break pricing larger volume builds for fun. For a build of 100 I can get the price to ~$4/board in components and PCB. Assembly time/cost, QA, shipping, solder paste, and NRE aren't included, so finished boards would be significantly more.

    Progress on the browser based programmer is slow. I scrapped my Firefox + FireBreath proof-of-concept after finding out that the NPAPI standard the FireBreath based plugin relies on is deprecated due to security risk. Now I'm trying to find my way around developing a Chrome app, which has the advantage of being driverless and plugin-less on all platforms. Nothing to show for it now, and certainly not while I've got boards to build.

  • Actions were taken

    ajlitt06/21/2015 at 21:23 17 comments

    I spent some quality time in KiCAD finishing TBD v0.2 over the last couple of weeks. I ordered boards, stencils, and parts which should take a couple of weeks to trickle in. Files in the Github link to the left. Here are the deltas from v0.1:

    • Surface mount 2x4 header mounted on the backside to reduce overall length
    • Rethought pinout brings out 6 pins that can be muxed between I2C, SPI, FlexIO (general purpose serial engine), and ADC
    • Option to use a micro USB jack instead of the USB-A board edge. Fits to the back side of the USB-A pads.
    • BOOT pin placed next to GND so a 2 pin jumper can be used to force ROM boot mode
    • 0603 discretes for easier manual placement and less risk of tombstoning
    • Resistor in line with the LED
    • SWD_CLK moved to test pad to save 1 pin on the header. SWD_IO is shared with one of the I2C pins
    • Silk legends for pin GPIO names and main alternate function

    I also had some time to play with using a web browser to talk to the bootloader via HID. I started with the Sparkfun Firefox HID example as a base and ended up with a simple page that's able to reset the part and read memory as a proof-of-concept. Now that the board is in production, I can spend some more time on this part of the project.

  • I should be sleeping

    ajlitt06/16/2015 at 08:26 0 comments

    but I was working on the next board rev. The surface mount header shortens the whole board but fits within a typical USB thumb drive volume. Pins are remapped to bring SPI, I2C, UART, FlexIO, and the bootloader pin.

    It still needs some cleanup but I think it looks a lot better than v0.1.

  • Flipping and flopping

    ajlitt06/08/2015 at 16:05 0 comments

    The EFM32 is impressive, but I think I'm going back to the Freescale part for now. The bootloader is a big thing for me, and while the EFM32 USB-CDC and xmodem protocol is easier to use from a software standpoint, the KL27's HID protocol is driverless under all OSes. Plus it opens another possibility: firmware loading through a driverless and OS agnostic Chrome plugin using the Chrome HID API.

    It's another arbitrary challenge in this project, and that's great.

  • ...but at what cost

    ajlitt05/26/2015 at 19:50 4 comments

    Over lunch I got the mbed build of the USB_4 test project (USB-CDC) for KL43Z with GCC working. My first attempt at this a while back broke because of a duplicate _exit() definition, but looking closer showed a cpp file from the ARM tools target dir in the GCC target that doesn't belong. Delete, clean, and it built ok.

    After verifying the built binary has the config bits correct (or risk soft-bricking without an SWD adapter handy) I flashed it with blhost under Windows, and the USB-CDC device showed up on my Linux laptop as soon as I plugged it in!

    Exciting, right?

    Well... it would be if I hadn't recently taken a look at some of the Gecko parts from SiLabs (inherited from the Energy Micro acquisition).

    I used to ignore anything from SiLabs as they were stingy with documentation and tools for hackers. But within the last few months they added support in mbed for some of their EFM32 Cortex-M devkits. The EFM32HG "Happy Gecko" line caught my eye: Cortex-M0+ at 24MHz, 64K flash / 8K SRAM, crystal-less USB, on-chip regulator, ROM bootloader, and comes in QFN24. That's not as good as the Freescale KL27 I'm using here in speed and memory. What makes it better is it's fully supported in the mbed IDE, has a simpler bootloader to work with (USB-CDC + xmodem instead of custom HID), and is less than half the price of the KL27 ($1.94 qty1 for the '309 variant vs $4.39). Given that I can live with the limitations.

    So I'm looking into that for the next rev. I'll get a better feel for it once the devkit gets here.

  • Yes, progress.

    ajlitt04/06/2015 at 19:36 0 comments

    I built my LED project in KDS as "Release" and it works when flashed over USB from blhost without a debugger attached. I also built the USB CDC demo which worked once I switched the USB clock to use the internal oscillator.

    Next step: pull the mbed libraries and try building some stuff with the KL43 target.

  • Progress?

    ajlitt04/04/2015 at 05:13 0 comments

    I've been too busy to spend much time on this, but I did play with the Kinetis SDK. I can get the LED to light using a project build for KL43Z, but only when the SWD debugger is physically connected. I think this has to do with the fact that I've built my "Hello World" in debug mode, and the micro is hanging on an unanswered semihosting breakpoint call. I'll dig into this in the next couple of weeks.

    Also committed the KiCAD project complete with gerbers I used to make boards and stencils on Github: https://github.com/pokey9000/tbd

View all 13 project logs

Enjoy this project?

Share

Discussions

James Newton wrote 02/04/2016 at 17:18 point

This is a really impressive project... I LOVE the idea, and would certainly buy a couple assuming the price was reasonable. A couple of random / stupid ideas:
1. The thickness of a USB connector just happens to be exactly the distance between the pins of a standard 2 row header: 0.075" So.... Use a thicker PCB stock, 0.062" is close enough with a layer of solder, and use a standard header, but put the PCB between the two rows of pins. So the SMT pads for row 1 are the top of the PCB and the SMT pads for row 2 are the bottom. This takes less board space and you can then avoid the need for the plastic shim because the PCB stock is thick enough to just plug into the USB port on it's own.

2. Careful arrangement of the IO pads on either side of the PCB might allow for transistors to be placed at the edge of the board instead of the header. The amplified signals could then be used to drive small motors, relays, etc… (see 4. below) Ground on one side, signal on the other and the transistor is installed with base to ground, emitter to signal, and the collector run into a terminal block placed flat on the PCB and held on with double back tape. The other side of the terminal block goes to the load, and the other side of the load to unregulated power. Not sure I explained that well enough... I can add a picture. 

3. Check out the TI Tiva C Series which also comes with a USB bootloader.  As does ST STM32F042/072. The PIC18F46J50... might... not sure.

4. To avoid future USB port loss or maybe even PC loss, consider adding / using a USB isolation system like the Analog Devices ADUM4160

Here is the reference design:

http://www.analog.com/en/design-center/reference-designs/hardware-reference-design/circuits-from-the-lab/cn0160.html#rd-description
Actually, that could be a separate project entirely: A USB port isolator for development projects. It's been done, but not as a USB to USB device:

http://hackaday.com/2014/04/27/galvanic-isolated-ftdi-saves-your-computer/

5. Really whacko idea: Coin Cell Power! A pair of holes in the +Vcc rail over a ground plane for a paper clip coin battery holder would allow independent operation at 3 volts.
http://dangerousprototypes.com/forum/viewtopic.php?f=2&t=5635
So you program it with the USB plugged into the PC, then you unplug it, solder on the paper clip, slip in the coin cell, and it's up and running. I /think/ you could place those holes on the USB connector end, with the ground plane on the back of the USB, so it wouldn't take up any more space. The coin cell would hang out over the edge of the PCB that used to be the USB connector. 

Yeah... that was pretty crazy, so I'll stop there. ,o)

  Are you sure? yes | no

tommy wrote 06/10/2015 at 15:22 point

I would love to buy this, either as a kit or complete!

  Are you sure? yes | no

ajlitt wrote 06/10/2015 at 18:45 point

Thanks!  I hadn't thought about selling this yet but I'll keep it in mind.

You can already build the v0.1 proto version from the v0.1 design files in the github link.  Change to the "v0.1" branch, and send the contents of the "oshpark" and "oshstencils" directories to the respective shops.  The BOM isn't well defined yet, though for v0.1 it's just the 32 QFN version of the micro, 2x 33 ohm 0401 resistors, 2x 0.1u 0401 caps, and an 0603 LED with Vf= ~3V.

  Are you sure? yes | no

Liam Marshall wrote 03/18/2015 at 21:00 point

This is super awesome! I can't wait to see how this turns out :D

  Are you sure? yes | no

ajlitt wrote 03/18/2015 at 21:10 point

Thanks!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates