Attiny 84 serial com 2way with Uno

hi
I am trying to connect a Attiny84 via softwareserial to a Arduino Uno.
when I use 2 Arduinos everything works just fine. as soon as I use the attiny84 i get many strange problems. i figured out the wrong pin numbers, I get the serial to receive or transmit (sometimes). I hear the Attiny board library is very buggy and also softwareserial is not so great with the tiny. I use Arduino IDE 1.8.13. and the attiny 1.0.2 from Mellis.
its the first time i try to connect 2 MCU.
i use 4800 baud.
the main problem I have right now is that the data I receive on the Attiny is just some odd numbers I cant really figure out. i would guess its the ascii code but they dont correspond.. I only want to transmit some numbers back and forth. (0-9)
also is there some command needed to synchronize the serial connection on both sides?
so here is the idea: the UNO (base station) receives the input from the remote Attiny, calculates and sends a new value back to the Attiny so it can indicate it.
the UNO can also send new values without the attiny input.
i've tried Serial.write, .print .println, on the Uno, and .read .intparse on tiny all just fail.
any tutorial would be nice.

Show your tx.ino and rx.ino files.

I will take a SWAG: The Attny84 probably has a different clock rate. You will have to adjust the software serial software.

Another SWAG, but I used a TINY85 as a reset/halt generator/monitor for a 68008 and also used it to generate the clock to feed into the baud rate generator for a UART. The UART comms were pretty poor as the TINY85 internal clock needed "tuning".

The documentation for ATTinyCore says:

Note that when using the internal oscillator or pll clock, you may need to tune the chip (using one of many tiny tuning sketches) and set OSCCAL to the value the tuner gives you on startup in order to make serial (software or hardware) work at all

so when I send 1 i receive the ascii code for p and 0 will become q..

Is that before or after you ran one of the tuning sketches mentioned in the TinyCore docs?

I doubt that. 0 precedes 1 and p precedes q.

Is one little endian and the other big endian?

As long as you set the clock speed correctly in the IDE, the IDE will do just that for you.

TTL Serial can have up to about 10% clock deviation before things start going awry due to timing issues. The internal oscillator (if that's what OP uses) is not particularly accurate but within a few % normally, not likely to cause problems.

Do have a look at the signals using a scope. Does the waveform look clean and square? Is the duration of the various bits as you expect them to be?

Also curious: how do you see the data that is received on the ATtiny?

I have used the Serial monitor a lot when debugging ATtiny projects, using a seriously stripped down Tx-only SoftwareSerial (so I really only needed to assign one pin for this). Never seen any unexpected characters on the Serial monitor screen.

well after reading lots of articles I think I found some leads..
I am using 1Mhz, but it seams it must be 8Mhz. I'll try that.
also the oscillators seams to probably need tuning. gotta check or add an external one.
fyi I have a small Oled attached where I see the received data.

Out of the factory I think the ATtiny84 is clocked at 1 MHz. You can change this using the fuses - which you can set up in the IDE, and then "burn" on the chip using the "Burn Bootloader" option (use that even if you're not using a bootloader).

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