Sorry if this question has already been asked (I haven't found the answer on the forum).
I did some small tests with the arduino and some teensy boards and now, I want to go a bit bigger.
On this new project that i'm working on, I need to make a arduino UNO and a attiny44 talk to each other using a RS485 converter (2 wires serial transceiver). The arduino side is OK because I can use the RX and TX pins to connect the RS485 chip. My trouble is on the attiny side. there are no such pins. I've seen on the forum "TinyISP" but my understanding is that its only to connect a serial motor (so only TX from the attiny). I need both RX and TX from the chip.
Anyone has some pointers on how I can achieve TX and RX communication ?
December 12, 2010 ... been a while since you were last on the forum. Welcome back.
Tiny Tuner if you're using the internal oscillator. SoftwareSerial (the newer version) for serial communications. Communications will be half-duplex. Run the ATtiny44 (t44) at 8 MHz (or higher if you're using a crystal or resonator). Pay close attention to the buffer size of SoftwareSerial; you may need to reduce it for the t44.
SoftwareSerial will also work on the Uno allowing you to use the USART for other things (like debugging).
I highly recommend including a CRC with your data.
TinyISP is a drop-in replacement for the ArduinoISP sketch that includes some goodies for development. It may help with troubleshooting the RS485 communications but will not help with the actual communications.
If you've got two lines then a simple data/clock interface will be far more likely to work (plus both the Uno and the Tiny84 have hardware support for it).
I can't use a crystal in this setup beacause i've used up all of the pins already so I have to use the internal one.
My communication (in theory for now) is : the UNO always initiate the communication. there will be no init from the attiny44.
Do I need to use "tiny tuner" AND SoftSerial or I can just use the later ?
Could I use the internal up to 8Mhz ?
For now, I could use the hardware USART for the RS485 chip be SoftwareSerial will be handy to setup a debug console
Could you explain a bit more on this part, i'm not sure how this could be done
If you've got two lines then a simple data/clock interface will be far more likely to work (plus both the Uno and the Tiny84 have hardware support for it).
The reason is that the final project will go into my woodshop and there will be some big motors in there. 1HP - 2HP+ So those motors could introduce some noise on the lines.
The other reason is that, the attiny portion will be (the maximum length for now) about 20 feets (~7 meters) from the controller (UNO). At first, I though of using simple I2C communication but the distance and reason #1 made me change my mind.
That is why RS485 (in my opinion, feel free to give another one, i'm open to suggestions) in this case is better, the way that the transport layer is made is not affected as much from EMF XD
That is why RS485 (in my opinion, feel free to give another one, i'm open to suggestions) in this case is better, the way that the transport layer is made is not affected as much from EMF XD
I get why it's RS485 ... I was asking why you need RS232
on both ends with a simple ATMEGA368 with optiboot bootloader couple with a crystal and some capacitors (I dont have a Arduino board) and I use a teeny programmed with UsbSerial so I can program the atmega (that part works great).
Maybe I could pass a I2C signal with those transceivers ?
Rigor_M:
My communication (in theory for now) is : the UNO always initiate the communication. there will be no init from the attiny44.
Excellent. One problem solved.
Do I need to use “tiny tuner” AND SoftSerial or I can just use the later ?
Tiny Tuner is just used during development to more accurately tune the internal oscillator. It really is a necessary step for RS-XXX communications.
Could I use the internal up to 8Mhz ?
Yes. Up to and including 8 MHz.
[quote author=Coding Badly link=topic=155916.msg1168677#msg1168677 date=1364022230]I highly recommend including a CRC with your data.
Could you explain a bit more on this part, i’m not sure how this could be done [/quote]
CRC is a mathematical operation and a value that identifies all one-bit errors (plus a long list of other types of errors). You feed the transmitted data into an algorithm. You get out a value; typically 32, 16, or 8 bit. I suggest using a 16 bit CRC. That value is also sent. The receiver essentially does the same thing. If the CRC values match, the odds are very high the data was successfully transmitted. If the values do not match, the data was corrupted during transmission.
You haven't really described what you're communicating. If you're just sending small messages every few seconds or so then the path you're on (RS-485 serial communication) is fine.
Might want to poke over and look at the EasyTransfer library. It is ATTiny compatible (or generally doesn't care what the hardware is) but the 4K of space on your ATTiny44 will make things extremely tight; a basic sketch is 3.7K. You might need to jump to an ATTiny84.