Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RX not working when using ATtiny at 1MHz #20

Open
ecomesana opened this issue Sep 24, 2014 · 1 comment
Open

RX not working when using ATtiny at 1MHz #20

ecomesana opened this issue Sep 24, 2014 · 1 comment

Comments

@ecomesana
Copy link

The ATTiny85 code fails to read input from a 433Mhz RF receiver when working at 1MHz. The following example compiles perfectly and runs OK wihen the ATTiny85 is working at 8MHz. However, it compiles but does not receive anything (the LED connected in pin 3 does not toggle) when working at 1MHz. Any advice to solve this problem?

#include <Manchester.h>

#define LED_PIN 3
uint8_t moo = 1;

#define TX_433_PIN 0
#define RX_433_PIN 1

#define BUFFER_SIZE 10
uint8_t buffer[BUFFER_SIZE];

void setup() {
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, moo);
  man.workAround1MhzTinyCore(); //add this in order for transmitter to work with 1Mhz Attiny85/84
  man.setup(TX_433_PIN, RX_433_PIN, MAN_1200);
  man.beginReceiveArray(BUFFER_SIZE, buffer);
}

void loop() {

  if (man.receiveComplete()) {
    man.stopReceive();
    moo = ++moo % 2; digitalWrite(LED_PIN, moo);
    man.beginReceiveArray(BUFFER_SIZE, buffer);
  }

}
@elademir
Copy link

The tiny can't recive with MAN_1200 at 1MHz. Try MAN_300 or 600.

As a matter of fact, this library is very inneficient since uses arduino instrucctions inside of the recive interrupt. It is common knowledge that the digitalWrite or delay functions takes hundred of instructions to the CPU. So, at high baudrate and 1Mz, the tiny can't finish the interruput routine before the next bit arrives.

I recommend you use the tiny at 8Mhz internal if you want to use this library.

regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants