Go Down

Topic: problems with softserial and ATtiny85 (Read 1 time) previous topic - next topic

Tom Carpenter

Can I suggest you try the tiny core I wrote?
https://github.com/TCWORLD/ATTinyCore

It has software serial routines which are designed to mimic the way the hardware serial library does, which means you dont need the softwareserial library, simply use the normal Serial.print(), Serial.available(), Serial.read() commands etc. as you would for a regular arduino. There are no set baud rates, and I have had success with rates as high as 115200.

There are two small caveats/differences between it and Hardware serial.
The first is that TX must be digital 0 and RX must be digital 1 (which is just swapping RX and TX in your case). This i because my library uses the built in analog comparator to supply an interrupt vector. It features the same ring buffer as Hardware Serial does meaning that polling is not required.
The second is that is cannot transmit and recieve Serial data at the same time (its Half Duplex), but you don't appear to need to.
~Tom~

NeX

thanks very much for that Tom,

I tried the new core but unfortunately the results were still the same, it seems like what ever difference there is between hardware and software serial, is the difference between this working and not working.

the only thing i can think is happening is that the ATtiny is picking up a serial byte right in the middle, this would then be rejected by the switch case as not a valid input and for a fraction of a second the ATtiny would stop transmitting IR, and the receiver might interpret that as a button debounce on the remote control.

it works fine if i have separate commands that drive the hold functions, and basically loop round and retransmit the IR signal about 16 times, but thats not really what i was hoping for. my original idea was going to use an ATmega382 but it seemed like such a waste for such a simple job, but the lack of hardware serial on the ATtiny85 makes it very difficult to do what i want to do.

Coding Badly

i am using an ATtiny to receive serial commands...


Sent from what?

Riva

To prove it's a software serial problem and not an ATtiny one could you try it on your 328 using software serial instead of hardware serial. Maybe jumper the hardware RX/TX pins to a couple of normal pins that software serial reads/writes. Maybe it's something simple like you need to pull down the RX pin on your hardware.

Coding Badly

but then i ported the code to an ATtiny85 using an external 16 MHz resonator...


Are you certain the processor is running from the resonator and not the internal oscillator?

Go Up