Issue – Driver freezing

Home/Projects/Lightive Project/Issue – Driver freezing

Issue – Driver freezing

The Issue

When initially turned on the driver would happily receive commands and act on them. If the device transmitting the commands was interrupted then restarted it would cause the driver to freeze. The issue was reliably replicated.

The Cause

Using an array of serial messages to debug the code it was apparent the issue was the driver getting stuck in a loop governed by a “millis” function. The millis functions are part of the radio library for the Alpha modules being used. It is a usefully utility function which provides easy timing ability based around the atmel’s own millis timer.  The timer function can be used in two states, a one-shot state where the timer is set and polled till it fires, then it does NOT re-fire. The second state just keeps resetting itself after each firing.

The technical reason behind this was not clear and with time being a limiting factor, when a valid work around was found the issue was marked solved. It is my belief that it was due to the rapid jumping between the use of two instances of this timer, one for fading and a second for the radio.

The Solution

Once the timer was identified as the culprit it was not long before i switched it from the automatically re-setting state it was being used in to a one shot setup. This instantaneously solved the problem and it had yet to re-occur.

The current code:

void ClightiveDrvr::outUpdate() //Call update to push next array out and updates current array
bool fadeincomplete = 1;
uint16_t stepN = 1;
if(fadeInterval.poll()){ // POLL THE TIMER (This was the sticking point)
fadeincomplete = 0;
for( uint8_t chan = 0 ; chan < 16 ; chan++ ){
if( stepcount[chan] > 0 )
if( --stepcount[chan] == 0){
currentval[chan] = finalval[chan];
stepFade( chan, finalval[chan]);
stepFade( chan, int( currentval[chan] + (stepN * stepsize[chan]) ) );

fadeincomplete += stepcount[chan];
By | 2015-01-13T23:46:13+00:00 February 19th, 2011|Lightive Project|0 Comments

About the Author:

A PhD in Electronic Engineering. A love for photography ( An interest in tinkering, electronics and design. (

Leave a Reply