Design the System

One of the current projects on the go is a level shifter for the Teensy 3.6 using the TXS0108E chip. The aim is to allow the use of as many of the Teensy’s GPIO pins as possible to allow the development of another project that is working on 5V logic levels.

This project reminded me that when putting together a microcontroller project that the system is made up of both hardware and software. Sometimes a design decision made in one element can have an adverse effect on the other.

Design Decisions

From the start it was decided that the GPIO pins would have a one to one mapping from the microcontroller to the external bus. So pin 1 on the microcontroller would map to pin 1 on the external connectors.

This would make coding easy when using the Arduino API. So connecting to the external bus and outputting a digital high signal on pin 1 would become:

pinMode(1, OUTPUT);
digitalWrite(1, HIGH);


Putting the circuit together in KiCAD resulted in the following design:

PCB Layout

PCB Layout

TXS0108E Schematic

TXS0108E Schematic

As you can see, the Teensy GPIOS (TIO-1…) mapped directly to the external bus (GPIO-1…)

When translated into the rats nest there were three occurrences of the following:

PCB Layout

PCB Layout

Routing this was going to be a nightmare.

Changing the Design

At this point the penny dropped that a small change in the software would make the routing a whole lot easier.

Instead of using the pin numbers directly, a #define could be used for the external bus pin numbers. The above snippet would become:

#define BUS_IO1    30
pinMode(BUS_IO1, OUTPUT);
digitalWrite(BUS_IO1, HIGH);

This small change to the design created a one off task to create a header file for the board but it made the routing a lot easier.


Sometimes a small change may create a new task (creating the header file) but may possibly save more time elsewhere in the project.

Moral of the story, Design the system as a whole, not the individual components.

Tags: ,

Friday, April 14th, 2017 at 2:09 pm • Electronics, Software DevelopmentRSS 2.0 feed Both comments and pings are currently closed.

2 Responses to “Design the System”

  1. Kev Scott says:

    Hi Mark,

    I have moved over to KiCAD myself from DesignSpark, there are certainly pros and cons of both. The lack of a working (out of the box) autorouter on KiCAD is the one gotcha for me; although the DesignSpark one wasn’t great it could save a bit of time when layout wasn’t too critical.

    Have you found anyway around that or do you stick to manual routing only (a true engineers approach!)?

    • Mark says:

      I stick with manual routing. Even when I used DesignSpark I still went for manual routing. I did try the autorouter once but the output horrified me so I started manually routing my boards.

      It took me a while to warm to KiCAD. The selling point for me was cross platform as I’m now almost exclusively a Mac user at home but I have a PC as a backup so need tools that run on both OSX and Windows. I still use Visual Studio though, hence almost exclusively Mac.