SlashDevin / NeoSWSerial

Efficient alternative to SoftwareSerial with attachInterrupt for RX chars, simultaneous RX & TX
169 stars 42 forks source link

Why does this simple echo RX to TX not work on ATtiny45? #35

Closed josephernest closed 4 years ago

josephernest commented 4 years ago

This simple code doesn't work (nothing is written):

#include "NeoSWSerial.h"
NeoSWSerial ss(3, 4); // RX 3, TX 4

void setup() {
  ss.begin(31250);  // baud rate for MIDI
  ss.delay(10);
  ss.write(255);  // even here nothing is output
}

void loop()
{
  while (ss.available())          
    ss.write(ss.read());
}

whereas, if I just replace the two first lines by:

#include "SoftwareSerial.h"
SoftwareSerial ss(3, 4);

then it works.

I'm using an ATTiny45 at internal 8Mhz and this core: https://github.com/SpenceKonde/ATTinyCore

Would you have any idea @SlashDevin?

josephernest commented 4 years ago

I found the reason: when using 31250 and 8Mhz, it doesn't work (current state of the code). If you have time @SlashDevin , maybe you can modify the README to add a note: "31250 (unsupported for 8 Mhz)".