Netburner Tutorial 1:

Introduction to the Netburner Development Kit

Keywords: Embedded Netburner Kit, Freescale DSP

                                                                                              *Photo taken from theNetburner Website (

The photo is the Netburner Development kit, which allows you to experiment with the Freescale Digital Signal Processor (DSP) and embedded DSP's in robotics applications. The big picture problem is finding a digital signal processor capable of taking on processor intensive tasks for unmanned aerial vehicles and humanoid robotics. Solving this partially or completely is important because these tutorials will explore the different architectures of DSP's, along with their capabilities. This tutorial shows you how to get started with embedded Netburner Development Kit and takes less than one hour to complete.

Motivation and Audience

This tutorial's motivation is to explore the DSP architecture. Readers of this tutorial assumes the reader has the following background and interests:

The rest of the tutorial is presented as follows:

Parts List and Sources

US-based vendors to obtain material to complete this tutorial is the Embedded Netburner Development Kit (the MOD5213), found here.

To complete this tutorial, you'll need the following items:

TABLE 1: Parts needed to build (fill in the blank)
Netburner Development Kit Netburner Inc.MOD5213 $99.001
USB to Serial Adapter*--------$10 and up 1 

 *If your computer does not have a 9 pin RS-232 Serial port, you will need to purchase a USB Adapter. They can be found almost anywhere on the internet, or in a computer store near you.


This section gives step-by-step instructions along with photos to get started with the Netburner kit by setting up the factory Demo.

Step 1

Once you receive the Netburner development kit, follow the manual provided to install the software, the Netburner Eclipse IDE.  This will install the Integrated Development Environment, along with all the necessary files for the Embedded Processor, the MOD5213.

Step 2

 After the Netburner Eclipse IDE installation, take the development board out of the ESD-safe bag, uncoil the serial cable and plug it into your computer.  To apply power to the development board, use the provided wall plug-in transformer plugging it into the development board. 

Step 3

Navigate from the Start Menu to Programs > Netburner NNDK > Mttty Serial Terminal.  This will open the Netburner Serial terminal for debugging and programming the MOD5213 chip. 

Use the Program defaults for Comm Events, and Flow Control.  Use these settings for communicating with the Development Board. 

            Port: <Your Com Port>

            Baud: 115200

            Parity: none

            Data Bits: 8

            Stop Bits: 1


    Once this is set up, press the CONNECT button on the Mttty Serial terminal to open the Com Port.  Now apply power to the development board.  You should now see the basic boot loader displaying text in the debug window.  After the timeout, you will then see the program start, and the LED's flash.  Follow the on screen directions for turning the IO pins on and off, along with toggling the LED's.  Below is the source code for the factory Demo.


The source code to the factory demonstration is provided below:

To be compiled with the Netburner Eclipse IDE

    Note: This is only the main.cpp program, this does not include all of the necessary include files to compile for the Factory Demo.  To see the full project file, open the Netburner NNDK, click on OPEN, and navigate to the file C:\Nburn\examples\MOD5213\MOD5213FactoryDemo\ This will open the Factory demo as a Project file in the Netburner Eclipse IDE.

/* Rev:$Revision: 1.4 $ */
* Copyright 1998-2005 NetBurner, Inc. ALL RIGHTS RESERVED
* Permission is hereby granted to purchasers of NetBurner Hardware
* to use or modify this computer program for any use as long as the
* resultant program is only executed on NetBurner provided hardware.
* No other rights to use this program or it's derivatives in part or
* in whole are granted.
* It may be possible to license this or other NetBurner software for
* use on non NetBurner Hardware. Please contact 
* for more information.
* NetBurner makes no representation or warranties with respect to the 
* performance of this computer program, and specifically disclaims any 
* responsibility for any damages, special or consequential, connected 
* with the use of this program.
* NetBurner, Inc
* 5405 Morehouse Drive
* San Diego Ca, 92121

Mod5213 Factory Demo Program
This program will illustrate how to implement multiple RTOS tasks, use the
NetBurner Pin Class to control GPIO pins, initialize serial ports, and 
control the LEDs on the Mod5213 development kit carrier board.
#include "predef.h"
#include <basictypes.h> // Include for variable types
#include <bsp.h> // 5213 board support package interface
#include <..\MOD5213\system\sim5213.h> // 5213 structure
#include <ucos.h> // Include for RTOS functions
#include <smarttrap.h> // NetBurner Smart Trap utility
#include <serialirq.h> // Use serial interrupt driver 
#include <utils.h> // Include for LED writes on carrier board
#include <SerialUpdate.h> // Update flash via serial port
#include <constants.h> // Include for constands like MAIN_PRIO
#include <system.h> // Include for system functions
#include <stdio.h>
#include <pins.h> // NetBurner Pin Class 
#include <gdbstub.h>

BOOL bLedSequenceEnable = TRUE; // enable LED display sequence by default

This declaration will tell the C++ compiler not to "mangle" the function
name so it can be used in a C program. We recommend you make all your file
extensions .cpp to take advantage of better error and type checking, even
if you write only C code.
extern "C"
void UserMain( void *pd );

This will make the LEDs on the carrier board scan in a back and 
forth motion.
void LedScan()
static unsigned char position = 0;
const unsigned char pattern_array[] = 
{ 0x01, 0x02, 0x04, 0x08, 0x04, 0x02 };

if ( position > 5 )
position = 0;
putleds( pattern_array[position++] );

This will make the LEDs on the carrier board count in binary
void LedCount()
static int n = 0; // Init count value to 0
putleds( n++ ); // Write new value to LEDs

This is a RTOS task that writes to the LEDs on the carrier board. 
It will switch between two different light sequences.
void LedTask( void *p )
static int SequenceCount = 0; // Counts iterations for each LED seq
static BOOL CountSequence = TRUE; // Selects Count or Scan sequence

while ( 1 ) // Loop forever
Use the RTOS OSTimeDly() to delay between LED writes. This function
is a "blocking function", which means it lets lower priority
tasks run while it is delaying. This is extremely important in a 
preemtive OS. Since this task is higher priority than UserMain(),
it MUST block, otherwise UserMain would NEVER run.
OSTimeDly( TICKS_PER_SECOND / 8 ); // There are 20 ticks per second
if ( bLedSequenceEnable ) // Check enable flag
if ( SequenceCount > 128 ) // After 128 iterations, switch to other seq
SequenceCount = 0;
CountSequence = !CountSequence;

if ( CountSequence )

Display the command menu for user commands
void DisplayCommandMenu()
iprintf("\r\n----- Main Menu -----\r\n");
iprintf(" C to toggle enable/disable LED counting sequence\r\n");
iprintf("Pin Class Commands:\r\n");
iprintf(" +/- to select the Mod5213 pin number\r\n");
iprintf(" H/L to set the selected pin High/Low\r\n");
iprintf(" Z to set the selected pin to high impediance\r\n");
iprintf(" D to enable the drive of the selected pin (opposite of Hiz)\r\n");
iprintf(" R to read the selected pin state\r\n");
iprintf(" Note: The LED pins are: 25, 26, 27, 28\r\n\r\n");

Process user serial command input
The command processor has the following functions:
C = Toggle LED counting task enable/disable. You may want to disable
LED counting so you can toggle pins 25, 26, 27 and 28 with the
GPIO output commands and see the LEDs change state.

+/- = Increment/decrement the selected pin number. The selected pin
number will respond to the other Pin Class commands such as 
High, Low, Hiz and Drive.

D = Enable selected pin's output drive. The pin will output the
state previously selected by High, Low or Read. 

H = Set the selected pin's output to High. 

L = Set the selected pin's output to Low.

R = Configure the selected pin to be an input and return the value
(high or low).

Z = Put the selected pin in high impedance mode by disabling it's
output drive. 

void ProcessCommand( char c )
static int pinn = 4; // set initial selected pin value at 4

iprintf("Pin[%d]>", pinn); // Display selected pin
case '+': // Increment the selected pin number
if(pinn >38) pinn=4;
iprintf("pin# = %d\r\n",pinn);

case '-': // Decrement the selected pin number
if(pinn <4) pinn=38;
iprintf("pin# = %d\r\n",pinn);

case 'C':
case 'c':
bLedSequenceEnable = !bLedSequenceEnable;
if ( bLedSequenceEnable )
iprintf("\r\nLED sequence display enabled\r\n");
iprintf("\r\nLED sequence display disabled\r\n");

case 'D':
case 'd':
iprintf("Pin[%d] = Drive Enabled\r\n",pinn);

case 'H':
case 'h':
iprintf("Pin[%d] = Hi\r\n",pinn);

case 'L':
case 'l':
iprintf("Pin[%d] = Low\r\n",pinn);

case 'R':
case 'r':
BOOL b = Pins[pinn];
iprintf("Pin[%d] = reads Hi\r\n",pinn);
iprintf("Pin[%d] = reads Low\r\n",pinn);

case 'Z':
case 'z':
iprintf("Pin[%d] = Hiz\r\n",pinn);



This is the RTOS main task, called UserMain. If you do not want to 
use the RTOS, you could just write all your code in UserMain(), and
treat it just like a standard C main(). 
void UserMain( void *pd )
The following function calls will initialize two of the three
UARTs to a default baud rate of 115,200 baud, 8 data bits, 1
stop bit, no parity. There are other serial functions to call
to specify additional prameters. Serial ports are numbered
0, 1, 2.
SimpleUart( 0, SystemBaud ); 

/* Enable NetBurner Smart Traps Utility */

/* This section of code will check for a DEBUG build, and initialize
* the GDB stub for serial debugging. The default serial port number on
* the module is 1, and the baud rate is 115,200. You will need to set
* the baudrate in the debugger to match this value.
#ifdef _DEBUG
InitGDBStubNoBreak( 1, 115200 );

When UserMain() starts it is a very high priority. Once running,
it is standard practice to reduce it to something lower. MAIN_PRIO
is equal to a priority of 50. This will enable you to add tasks at
higher and lower priorities if you wish. 
OSChangePrio( MAIN_PRIO ); 

Create and start the LED counting task. A task is basically just a
function with a priority. In this case, the function/task name is
LedTask, and it's priority is set to one level higher than UserMain().
Note that a lower number is a higher priority. By making the LEDs a
higher priority than UserMain(), the LEDs will blink at a constant
rate even during user input and character echo in UserMain().
OSSimpleTaskCreate( LedTask, MAIN_PRIO - 1 );

Calling this function enables the flash memory updates via the serial
port. Serial updates will work at any time when you are using the serial
interrupt driver, but in polled mode updates can only occur is the
application is reading from the serial port (eg getchar(), read(). 

/* Assign UART 0 to stdio, so printf(), getchar() are routed there */

// Write boot message to stdio, which is serial port 0
iprintf("Starting MOD5213 Factory Demo Program\r\n");

// Write boot message to serial port 1 using writestring() function,
// since this port is not assigned to stdio.
writestring(1, "Greetings from serial port 1!\r\n");

// Loop forever. This is like a C main loop. You do not ever want to 
// return from UserMain().
while ( 1 )
char c = sgetchar(0);
ProcessCommand( c );

Final Words

This tutorial's objective was to get acquainted with the Embedded Netburner Development kit, and the Freescale DSP.

Speculating future work, derived from this tutorial, includes more tutorials on programming with the chip using the IO Pins, PWM, ADC, and serial communcation to sensors.

Click here to email me