OWOWOD – One Wire / One Way Output for Debugging the Tinusaur (Part 1)

I always wanted to be able to write something like this in my code

 debugging_print("working, x=%i", x); 

… have that running on the micro-controller and see the debugging output on my computer.

The Problem

Unfortunately that is not easy – in fact not possible with the standard tools used to work with the ATtiny85. The problem is this: (1) those micro-controllers have too few I/O ports; and (2) most of the programmers (the one I’m using is USBasp) do not offer that kind of communication between the micro-controller and the computer, i.e. there is no 2-way communication.

There are many solutions to that problem and while looking on Internet I found this article http://www.ernstc.dk/arduino/tinycom.html that points to some of them:

Since the purpose of The Tinusaur Project is learning I decided to write my own.

USB to Serial TTL
USB to Serial TTL Converter

To do that I needed:

The USB-to-Serial TTL is a device that when connected to the USB port of the computer will look to the operating system like a Serial COM Port. Writing data to that COM port will result in transferring that data through the converter and out to the output pin called TxD – in serial form. It work similarly when receiving data from an external source of signal connected to the RxD pin.

I connected the PB0 of the ATtiny85 to the RxD of the USB-to-Serial TTL and did some experiments. Soon I realized that the timing of the signals was critical for this to work and I needed better way to compose the serial data.

Reference Character Generator

First thing – a serial data character generator that I can use as reference – and what could be better than an original USB-to-Serial converter.

I also needed a software that will generate sequence of test characters that I would use as a test signal. First I though of writing a simple Java program that will send the data to the COM port but then I found an application on Internet that does that already – COMStressTest from AGG Software at http://www.aggsoft.com/com-port-stress-test.htm.

COM Stress Test

I specified my testing data in the “Data source” tab as an external file.

The best testing sequence in this case would be string of “U” characters. This is because the generated signal will consist of equal LOW and HI intervals known also as square wave signal.

 ASCII "U" = 0x55 = 01010101 

To look more precisely at the signal form and parameters I used an oscilloscope – mine is DSO Quad from Seeedstudio at http://www.seeedstudio.com/depot/DSO-Quad-4-Channel-Digital-Storage-Oscilloscope-p-736.html.

The signal should look like this …

Oscilloscope Serial Signal

That’s all for now.

The next step will be to write some code for the ATtiny that will generate the same sequence – all “U” character and try to make it exactly the same as the reference one.

IMPORTANT: All the tests were done with the default settings for the serial COM port which are 9600 bps, 8 bits of data, no parity check and 1 stop bit. This is sometimes denoted as 9600 / 8-N-1 configuration.

NEXT PART: OWOWOD – One Wire / One Way Output for Debugging the Tinusaur (Part 2)

 

All the OWOWOD source code is available at https://bitbucket.org/tinusaur/owowod/src.

 

Oscilloscope-like Circuit – Preview

This is a oscilloscope-like circuit for the Tinusaur, it is not a real oscilloscope but could be used as a base for one.

It is built on top of the Tinusaur board (Atmel AVR ATiny85) and Nokia 3310/5110 LCD (PCD8544 controller).

There is also simple preamplifier for the electret microphone connected to the ADC of the MCU.

The audio signal source is combination of my DSO Quad (it has built-in signal generator) and a speaker.