AVR Code Debuger
History
The fact is, 10 years ago this project could have been completed. It will be a useful tool to help you debug code. The challenge was to make a debugger that does not require any MCU resources to be used from the MCU, allowing the debugger to run integrated with the code being debugged.
The Debugger only use 1 I/O pin, and is connected to a serial port from the host PC. Using a VT100 terminal to capture the output from the Debug tool, all of the debug information can be captured. By adding a simple command along with the debug firmware, you can send out debug statements like debugXY(x,y, "test"). The Debugger will adapt to any speed from 1Mhz to 20Mhz without configuration from the user.
Features Ver : 1.0
- No resource need in the MCU you are debugging
- No configuration to do
- Run with MCU from 1Mhz to 20Mhz
- Use VT100 terminal emulator as debugging window
- Self powered by the serial port of your PC
- Simple to build
- Convert any I/O in a verbose debugger
- Reset button
System Requirements
- Terminal software
- Debugging circuit with the HEX file of the debugger
- PC free serial port
Pictures
Download
One AVR user had convert this project for USB connection and the code is written in CAVR. Here is the files
20 Comments to “AVR Code Debuger”
Post comment
Please note
Categories
- All projects
- Audio
- Clock
- Electric Train
- Gadjet
- General Posting
- Laser
- Lastes News
- LED
- Library
- Sensor
- Software
- Work Bench Tools

admin

All my source codes were taken from my personal projects.
oh, so many link is moved.
It seems you are doing large modify?
now it’s become a beautiful.
Hi DreamCat,
I complitly change my old web site for a blog, all the link had move. If you find some problem getting any file please le me know with the exact download link that is broken or a file with bad information.
Sylvain Bissonnette
how this debugger works?
dose it need one txd pin of my avr chip connect to the debugger’s rxd pin ?
Hi,
This debuger is only in one direction, from your devices to the debuger, to the PC, you target can use ANY IO you not need to use the serial port.
SylvainBissonnette
Thanks DreamCat, It's more than a modification it's a complitly rebuild, so I can't tell how many links is move…
I will try to explain more how the debuger work, first you must reset the debuger after you start your MCU to debug and init the communication code, you have to set wich IO you will use. at the init point the function will send 255 char, the debuger will try to find a baudrate that's match your MCU now you are ready to use the communication function in your mcu like printf and the result will apear in your terminal software under windows
Check here that's code to check if your debuger work
Sylvain
//*****************************************************************************
// AVR Debuger
// Version 1.0 Fev 2007
//
// Sylvain Bissonnette
//*****************************************************************************
// Editor : UltraEdit32
//*****************************************************************************
//
// R E T U R N S T A C K 1 6
//
//*****************************************************************************
// I N C L U D E
//*****************************************************************************
#include <io2313v.h>
#include <macros.h>
#include <shortnametype.h>
//*****************************************************************************
// D E F I N E
//*****************************************************************************
#define DEBUG_XTAL 16000000
#define DEBUG_DDR DDRD
#define DEBUG_PORT PORTD
#define DEBUG_BIT 0×01
//*****************************************************************************
// P R O T O T Y P E
//*****************************************************************************
void main(void);
void DebugXYHex(ushort x, ushort y, char *Ptr, ushort Len);
void DebugXY(ushort x, ushort y, char *Ptr);
void Debug(char *Ptr);
void DebugInit();
//*****************************************************************************
// G L O B A L V A R I A B L E
//*****************************************************************************
char Text[30];
//*****************************************************************************
// M A I N
//*****************************************************************************
void main()
{
uint i;
Text[0] = 'x';
Text[1] = 'X';
Text[2] = 'x';
Text[3] = 'X';
Text[4] = 'x';
Text[5] = 'x';
Text[6] = 'X';
Text[7] = 'x';
Text[8] = 'X';
Text[9] = 'x';
Text[10] = 0×00;
DebugInit();
while(1)
{
DebugXY(19,19,&Text[0]);
for (i=0;i<60000;i++) WDR();
DebugXY(0,0,&Text[0]);
}
}
/******************************************************************************
Name: void DebugXYHex(ushort x, ushort y, char *Ptr, ushort Len)
Description:
Input: ushort x -> X position to print on the termnal
ushort y -> Y position to print on the termnal
char *Ptr -> Pointer of ushort to be print on the terminal
ushort Len-> Len of array to print
Output: none
******************************************************************************/
void DebugXYHex(ushort x, ushort y, char *Ptr, ushort Len)
{
char Buffer[10];
ushort i;
if ((x == 0) && (y == 0))
{
Buffer[0] = 0×1b;
Buffer[1] = '[';
Buffer[2] = '2';
Buffer[3] = 'J';
Buffer[4] = 0×00;
Debug(&Buffer[0]);
Buffer[0] = 0×1b;
Buffer[1] = '[';
Buffer[2] = '1';
Buffer[3] = ';';
Buffer[4] = '1';
Buffer[5] = 'H';
Buffer[6] = 0×00;
Debug(&Buffer[0]);
}
else
{
Buffer[0] = 0×1b;
Buffer[1] = '[';
Buffer[2] = (y/10)+48;
Buffer[3] = (y%10)+48;
Buffer[4] = ';';
Buffer[5] = (x/10)+48;
Buffer[6] = (x%10)+48;
Buffer[7] = 'f';
Buffer[8] = 0×00;
Debug(&Buffer[0]);
for (i=0;i<Len;i++)
{
Buffer[1] = 0×00;
Buffer[0] = (*Ptr >> 4) + 0×30;
if (Buffer[0] > 0×39) Buffer[0] += 0×07;
Debug(&Buffer[0]);
Buffer[0] = (*Ptr++ & 0×0f) + 0×30;
if (Buffer[0] > 0×39) Buffer[0] += 0×07;
Debug(&Buffer[0]);
Buffer[0] = ' ';
Debug(&Buffer[0]);
}
}
}
/******************************************************************************
Name: void DebugXY(ushort x, ushort y, char *Ptr)
Description:
Input: ushort x -> X position to print on the termnal
ushort y -> Y position to print on the termnal
char *Ptr-> Pointer of string to be print on the terminal
Output: none
Misc: 168 Byte
******************************************************************************/
void DebugXY(ushort x, ushort y, char *Ptr)
{
char Buffer[10];
if ((x == 0) && (y == 0))
{
Buffer[0] = 0×1b;
Buffer[1] = '[';
Buffer[2] = '2';
Buffer[3] = 'J';
Buffer[4] = 0×00;
Debug(&Buffer[0]);
Buffer[0] = 0×1b;
Buffer[1] = '[';
Buffer[2] = '1';
Buffer[3] = ';';
Buffer[4] = '1';
Buffer[5] = 'H';
Buffer[6] = 0×00;
Debug(&Buffer[0]);
}
else
{
Buffer[0] = 0×1b;
Buffer[1] = '[';
Buffer[2] = (y/10)+48;
Buffer[3] = (y%10)+48;
Buffer[4] = ';';
Buffer[5] = (x/10)+48;
Buffer[6] = (x%10)+48;
Buffer[7] = 'f';
Buffer[8] = 0×00;
Debug(&Buffer[0]);
Debug(Ptr);
}
}
/******************************************************************************
Name: void Debug(char *Ptr)
Description: *char Char to be print
Input: char *Ptr
Output: none
Misc: 150 Byte
******************************************************************************/
void Debug(char *Ptr)
{
#define MINDELAY 75
int i,j,Parity;
while(*Ptr != 0)
{
CLI();
DEBUG_PORT &= ~DEBUG_BIT;
for (j=0;j<MINDELAY;j++); // Start Bit
Parity = 0;
for (i=0;i<8;i++) // All 8 Bits
{
if (*Ptr & (0×01<<i))
{
Parity++;
DEBUG_PORT |= DEBUG_BIT;
for (j=0;j<MINDELAY;j++);
}
else
{
DEBUG_PORT &= ~DEBUG_BIT;
for (j=0;j<MINDELAY;j++);
}
}
if (Parity%2)
{
DEBUG_PORT |= DEBUG_BIT;
for (j=0;j<MINDELAY;j++);
}
else
{
DEBUG_PORT &= ~DEBUG_BIT;
for (j=0;j<MINDELAY;j++);
}
DEBUG_PORT |= DEBUG_BIT;
for (j=0;j<MINDELAY*200;j++); // Stop Bit
SEI();
Ptr++;
}
}
/******************************************************************************
Name: void DebugInit()
Description:
Input:
Output: none
Misc:
******************************************************************************/
void DebugInit()
{
uint i;
char Buffer[2];
DEBUG_DDR |= DEBUG_BIT;
DEBUG_PORT |= DEBUG_BIT;
Buffer[0] = 0×55;
Buffer[1] = 0×00;
for (i=0;i<255;i++) Debug(&Buffer[0]);
DebugXY(0,0,&Text[0]);
}
Very thanks for your example.
I saw all broken link is seems be corrected.
I like this new theme .
Hello
I made this debugger, works fine on 5V applications.
On 3V app sometimes hangs, I will try use optocoupler on input
If U can, I have USB version with ftdi convertor & faster baudrate on PC side
Hi,
This project had been done for 5v if you need to work at 3volt you must change the level translator for a 3v version and change the zener for a 3v. I never try it but I think it will work
Sylvain
Hi, congratulations for your new site. I like your work and visit your site regularly. I have recommended for my friends. I would like suggest to you put something about you, your work, hobbies, curriculum etc. Its relevant because you are not a robot but human and gives your site some of your personality. My english is very poor because my native language is portuguese. But if you understand its OK. Ahh, the debbuger schematic file is corrupted. And again congratulations for your work.
Thanks for your good comment, Yes it true that a small article on who I am could be good, I will check for that soon
PS: I had reload the debuger sch file it’s suppose to work!
Again thanks
Sylvain
Hi, congratulations for your new site. I like your work and visit your site regularly. I have recommended for my friends. I would like suggest to you put something about you, your work, hobbies, curriculum etc. Its relevant because you are not a robot but human and gives your site some of your personality. My english is very poor because my native language is portuguese. But if you understand its OK. Ahh, the debbuger schematic file is corrupted. And again congratulations for your work.
Hi,
Thanks for all those positive comment, I try the download of the debugger and it’s work, give is one more try and give me the result
Sylvain
Terrific work! This is the type of information that should be shared around the web. Shame on the search engines for not positioning this post higher!
Thanks for your good comment, Yes it true that a small article on who I am could be good, I will check for that soon
PS: I had reload the debuger sch file it’s suppose to work!
Again thanks
Sylvain
Terrific work! This is the type of information that should be shared around the web. Shame on the search engines for not positioning this post higher!
Thanks, I don’t understand why I don’t have a good ranking?
I want to quote your post in my blog. It can?
And you et an account on Twitter?
Yes you can, and I don’t have a Twitter acount
Hi, I love your works. It seems to me that you do it all with your heart.
Keep up the good work, and looking forward to put more spirit into my blog as you did into yours.
Rgds,
Chandra MDE
You are to good in your work but can you make one help of mine. can you guide how can i copy the program from ATMEGA32, ATMEGA64 & ATMEGA164