Serial debugging of ATtiny using Arduino UNO as ISP

Hi!

I used some time to get this to work, so I thought I should share it with the community. There is a old ISP that is called TinyISP that replaces Arduino ISP and enables serial debugging of the ATtiny.

You can download it here:
TinyISP replacement

To get debugging to work, you also need the this library:
TinyDebugKnockBang-library

The problem is that this was made for an older Arduino version. I am currently running 2.3.5, so to get it to work you need to apply these fixes:

Insert “TinyDebugKnockBangClass_AssemblyMacros();” in two places in TinyDebugKnockBang.cpp (use notepad or alike):

bool TinyDebugKnockBangClass::knockHello(void) {
TinyDebugKnockBangClass_AssemblyMacros();
...
}

attribute((noinline))
void TinyDebugKnockBangClass::sendByte(uint8_t v) {
TinyDebugKnockBangClass_AssemblyMacros();  
...
}

And it should compile without errors. This can also be done for TinyISP by inserting the same line in “KnockBangReceiver.cpp“:
ISR(KBR_PCINT_VECT)
{
TinyDebugKnockBangClass_AssemblyMacros();
...
asm volatile (
/* uses DELAY_FINE, etc. */

Recompile and upload and it should work. PS: You may want to set:
RELAY_KNOCK_BANG_USE_ALTERNATE_PIN = 0

in the “_TinyISP_BuildOptions.h” file in TinyISP to make it use the same pin for debugging as programming (if not you need a 1kOhm resistor to D7). There are also serial commands to start/stop debugging (Entering “#” in serial monitor starts debugging):
Other useful monitor keys (send while monitor is running):

  • ! — stop monitoring (return to programmer)

  • @ — toggle “hold in reset after programming”

  • # — reset target and run

  • $ — hold target in reset

  • \ — print receiver debug/stats (see §4)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.