I have been using your Manchester library for TX on an ATtiny85 and RX on an Arduino Uno. However, I am keen to get VirtualWire working as this uses an interrupt driven approach that avoids the sender/receiver having to block while sending/receiving.
I have made an attempt to get VirtualWire working for TX/RX on ATtiny85/Arduino Uno. The code is compiling and I am fairly sure I have used the correct timer settings but I don't seem to be receiving any valid messages on my Arduino.
I am programming my ATtiny85 using the instructions on this site (
http://hlt.media.mit.edu/?p=1695) but with the ATtiny85 core from
http://code.google.com/p/arduino-tiny/.
All of my code is up on github:
https://github.com/mchr3k/arduino/tree/master/libraries/VirtualWireNewTinyhttps://github.com/mchr3k/arduino/blob/master/wsn_arduino_vw/wsn_arduino_vw.inohttps://github.com/mchr3k/arduino/blob/master/wsn_attiny_vw/wsn_attiny_vw.inoAs you can see, the TX is trying to send 10x"D" ("D" = 0x44). My receiver consistently receives strings like "0 10 0 C 1D C 1D A 28 0 C1 3 E 0 1 0 2 5D 0 C1 2 33 0 2 0 0 0 A 0". The first part of each received "message" is consistently "0 10 0 C 1D C 1D A 28 0 C1 3 E 0 1 0 2 5D 0 C1" for the first few minutes.
Can you suggest how I should debug this or what could be going wrong?
EDIT: A friend has pointed out that the ATtiny has 8 bit counters vs the ATmega 16 bit counters.
I’m trying to do 1000 bit/second which gives the following maths.
uint16_t ocr1a = (F_CPU / 8UL) / speed;
( 8000000 / 8 ) / 1000 = 1000
This value of 1000 won't fit in the ocr1a register so the timing will be totally wrong. I will need to adjust the clock frequency scaling to ensure the ocr1a value is lower on the ATtiny. I will hopefully try this out tonight.