

Furthermore, we want to get as close as possible to the communication speed the MCU has that we want to debug, which might diverge from the standard ones because the clock speed is controlled by an internal RC oscillator. However, with debugWIRE, we only learn about the communication speed at runtime. Third, if the communication speed is known ahead at compile time, then picoUART is probably the best alternative.

So, we need error-free serial communication at 125 kbps! Since the communication speed is set to the system clock divided by 128, at 16 MHz system clock the communication speed will be 125 kbps. debugWIRE does unfortunately not have any form of error detection, so one has to rely on the fact that there is no communication error at all. When you are debugging a system and a wrong value is displayed because of a communication error, then one is, of course, upset. Second, if you want to transmit strings about the room temperature, then nobody gets annoyed when at some point of time the wrong temperature is displayed. Or one addresses this problem at the software level too. On the hardware level, one needs to come up with a solution that permits two parties to send and receive on one wire only. This can all be solved on the software level. For instance, if a master is the one who sends requests or queries to which the slave responds, it is clear who is in the role of a sender at each point of time. But then there should be a strict protocol about which party is allowed to transmit data. If one wants to restrict the communication to only one wire, this is possible.

It satisfies the following three requirements: So, recently I set out to program my own solution that led to the SingleWireSerial library. People had come up with different solutions, but none of them worked for me reliably. One problem seemed to be the serial communication using only one line (the RESET pin of the MCU). BackgroundĮarlier this year, I worked on a hardware debugger making use of the debugWIRE protocol. And contrary to its title, one can even use it in a two-wire setting. By using the input capture feature of the AVR MCUs, it is extremely accurate and supports bitrates up to 250 kbps robustly. It supports single-wire, half-duplex serial communication. A new Arduino library has seen the light of day: SingleWireSerial.
