Skip to main content
1 of 3

I have a similar issue with a Leonardo: Dumping too much data at once to Serial.print(), it seems I broke my programmer. As a result, my sketch still starts but I can't update/upload it anymore.

Problem

  • Given my sketch is started
  • When I upload any sketch
  • Then the build fails as the Serial connection is broken
Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.
Forcing reset using 1200bps open/close on port /dev/ttyACM0
PORTS {/dev/ttyACM0, /dev/ttyS4, } / {/dev/ttyS4, } => {}
PORTS {/dev/ttyS4, } / {/dev/ttyS4, } => {}
...
PORTS {/dev/ttyS4, } / {/dev/ttyS4, } => {}
Couldn't find a Board on the selected port. Check that you have the correct port selected.  If it is correct, try pressing the board's reset button after initiating the upload.
  • Given the arduino is starting (double press reset)
  • When I upload any sketch
  • Then the build fails with the following error
Connecting to programmer: .
Found programmer: Id = "Frames:"; type = e
    Software Version = F.r; Hardware Version = a.m
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?

As yo can see the id is "Frames:" and if you concatenate the software version, hardware version and type, you get "F.r_a.m_e", which is what I printed to Serial.

Breaking sketch

Here is the piece of code I think broke:

template <typename T, typename... Types>
void printLine(T first, Types... other) {
  Serial.print(first);
  printLine(other...) ;
}

String byteToString(int value) {
  String out;
  for (int i = 7; i >= 0; i--) {
      bool b = bitRead(value, i);
      out += b ? '1' : '0';
  }

  return out;
}


...


    printLine("Frames: ");
    for (int i = 0; i < 16; i++) {
      printLine(
        // printf("%04d", i),
        i,
        " => "
            ,byteToString(leftFrame[0][i])
        ,",",byteToString(leftFrame[1][i])
        ,",",byteToString(leftFrame[2][i])
        ,",",byteToString(leftFrame[3][i])
        ,",",byteToString(leftFrame[4][i])
        ,",",byteToString(leftFrame[5][i])
        ,",",byteToString(leftFrame[6][i])
        ,",",byteToString(leftFrame[7][i])
        ,":"
            ,byteToString(rightFrame[0][i])
        ,",",byteToString(rightFrame[1][i])
        ,",",byteToString(rightFrame[2][i])
        ,",",byteToString(rightFrame[3][i])
        ,",",byteToString(rightFrame[4][i])
        ,",",byteToString(rightFrame[5][i])
        ,",",byteToString(rightFrame[6][i])
        ,",",byteToString(rightFrame[7][i])
      );
    }

The funny part here is the fact that the Leonardo seems to have written in itself when I asked him to write "outside" (Serial).

WIP solution

I'll edit this message once it's done (I had to buy a new arduino which I'm waiting now).

Meanwhile, my use case may help somebody else!

Some other resources