mchr3k / arduino-libs-manchester

172 stars 113 forks source link

Unable to receive message on Attiny85 when sent from Arduino uno #55

Closed sjini closed 1 year ago

sjini commented 4 years ago

Greetings,

I am working on a small project where I have to transmit a char array from Arduino Uno and receive it on Attiny85.

I am using 433Mhz transmit/receive modules and your library (thanks for developing it).

To keep it short, it works if I transmit and receive on Arduino Unos, also works to transmit and receive between 2 Attiny85s, but I cant get Attiny85 to listen to messages sent from Arduino Uno.

I have tried 1Mhz and 8Mhz speeds and bootloader flash (using Sparkfun tiny avr programmer). Tried all available baudrates including lower ones 300, 600. Tried powering Attiny from 2 different power sources of 5V. Also tried several Attiny and receiver to exclude any hardware mulfunction. Blinky code works fine on attiny and delay() is not that much off from real perception. Let's say delay(1000) is not perfectly 1 sec, but within reasonable deviation. man.receiveComplete() is never triggered on Attiny85 if I am transmitting from Arduino Uno. I suppose I am using the right attiny core because it works between two Attiny85s.

I find couple of articles saying that it is probably due to controller speed, but then I also see "With this library you can sucessfully transmit data between various microcontrollers runnning at various speeds even if their clock speed varies up to 100%. "

Code for Transmitter (Arduino Uno)

#include <Manchester.h>
#define TX_PIN 7 //pin where your transmitter is connected
#define LED_PIN 1
#define BUFFER_SIZE 7
uint8_t TX_PAYLOAD[] = {BUFFER_SIZE,'1','2','3','a','b','c'};

void setup() {
  man.workAround1MhzTinyCore(); //add this in order for transmitter to work with 1Mhz Attiny85/84
  man.setupTransmit(TX_PIN, MAN_600);
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  man.transmitArray(BUFFER_SIZE, TX_PAYLOAD);
  digitalWrite(LED_PIN_1, HIGH);
  delay(200);
  digitalWrite(LED_PIN_1, LOW);  
  delay(500);
}

Code for Attiny85

#include "Manchester.h"
#define RX_PIN 0
#define LED_PIN_1 1

void setup() {
  pinMode(LED_PIN_1, OUTPUT);
  man.setupReceive(RX_PIN, MAN_600);
  man.beginReceive();  
}

void loop() {
  if (man.receiveComplete()) {
      digitalWrite(LED_PIN_1, HIGH);
      delay(200);
      digitalWrite(LED_PIN_1, LOW);      
      man.beginReceive(); 
  }
}

Meanwhile I would like to know if this is a common issue? anybody has come across with same?

Thanks in advance Sergi