Attiny85 software serial debugging

Hello. I need some help debugging my Attiny85 software serial code.
Since i do not have an ISP programmer, and i use an Arduino uno as my ISP, I have limited debugging options.

For my hardware setup so far, i have an Attiny85 reading a MIDI port through a high speed optocoupler (6N137) using software serial on pin 3. I use the Attiny microcontroller cores for Arduino IDE and an internal clockspeed of 8MHz. I also have a WS2812 LED-strip connected to pin 0 with a total of 60 diodes, which are powered externally.
My code so far uses the libraries:
SoftwareSerial.h
MIDI.h
FastLED.h
I've set my SysExMaxSize in midi_settings.h to 0 in order to save memory.
My code:

#include <SoftwareSerial.h>
#include <MIDI.h>
#include <FastLED.h>

#define LED_PIN 0
#define NUM_LEDS 60
#define LEDMAP 0xAB5AB5AB5AB5AB5
#define OFFSET 36
#define RANGECHECK if (pitch > 35 && pitch < 96)

SoftwareSerial softSerial(3,4);
CRGB leds[NUM_LEDS];

MIDI_CREATE_INSTANCE(SoftwareSerial, softSerial, midiB);

void setup() {
  FastLED.addLeds<WS2811, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.clear(true);
  midiB.begin(MIDI_CHANNEL_OMNI);
  midiB.turnThruOff();
  midiB.setHandleNoteOn(HandleOn);
  midiB.setHandleNoteOff(HandleOff);
}

void loop() {
  midiB.read();
}

void HandleOn(byte channel, byte pitch, byte velocity)
{
  RANGECHECK
  {
    leds[pitch - OFFSET] = bitRead(LEDMAP, (pitch - OFFSET)) ? CRGB::NavajoWhite : CRGB::Red;
    FastLED.show();
  }
}

void HandleOff(byte channel, byte pitch, byte velocity)
{
  RANGECHECK
  {
    leds[pitch - OFFSET] = CRGB::Black;
    FastLED.show();
  }
}

The code compiles fine for Attiny85 and uploads too, But when receiving any serial data from MIDI, my LEDS don't always turn on/off like they're supposed to. I've been unable to determine wether this issue happens on the side of SoftwareSerial.h, MIDI.h or FastLED.h, since my debugging options are limited with well over 80% of my global variable memory used and the limitations with the Arduino as ISP programming method.

The code compiles and works flawlessly on a stock 16MHz Arduino uno when using a change interrupt enabled pin for software serial. Bumping up my Attiny85 to 16MHz internal clock completely stops SoftwareSerial from working, so i can't test my code at the same base clockspeed as the 328P in Uno.

If anyone here has come across the same problem, or has any better programming/debugging hardware as i do, any help would be appreciated. Thanks!

SoftwareSerial is already putting lots of pressure on the interrupts, add the requirements of your WS2811 and you might loose input....

some leds do not require complex refresh signals (like the APA102), may be if that's the issue you should consider changing the led strip or going for a more capable chip with hardware serial

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