ATTINY45 UART +external clock?

Hi,

I need to transmit only with an Tiny45 but... with an external clock.

I saw some UART articles about Uart with ATTINY. But always the pin 3 is used for TX. And this pin is used for XTAL.

With software serial it seems possible.

I tried at 16Mhz but it doesn't work. Does it works only with 8MHz?? (Unfortunately no 8MHz Xtal in my stock...) :-(

Can anybody confirm that?

Thanks!

You could probably use an external I2C UART with SDA/SCL from pins 5 & 7. https://www.digikey.com/product-detail/en/nxp-usa-inc/SC16IS741AIPWJ/568-10959-1-ND/4486521 Will have to search around and see if there's an Attiny45/85 compatible library for it.

Thanks CrossRoads,

I would like to avoid some external components.

Does it mean that:

  • Pin 3 canot be changed?

or

  • it doesn't work with 16MHz?

or both ?

  • Can we use pin 0 at with 8MHz external?

Thanks

I would expect SoftwareSerial to "just work" on the 45, and for TX you should be able to use any pin.

What happens when you try? Are you getting no output? Gibberish? What?

Read the datasheet: "6.2.1 External Clock To drive the device from an external clock source, CLKI should be driven as shown in Figure 6-4. To run the device on an external clock, the CKSEL Fuses must be programmed to “00”."

CLKI is pin 2, so with the right fuse settings you can use an external clock (i.e. a powered oscillator such as https://www.digikey.com/products/en/crystals-oscillators-resonators/oscillators/172?k=oscillator&k=&pkeyword=oscillator&pv1989=0&pv139=17&pv69=80&FV=fff4000d%2Cfff8016e&mnonly=0&newproducts=0&ColumnSort=0&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25 and perhaps tweak the software serial library to not use any pins for Rx.