2

I messed up when designing my PCB and just assumed that I could use software slave I2C with ATTiny84.

The reason I did so is - I needed to use all of the analog inputs.

enter image description here

The pins I have on my connector are:

PB0 (pin 2), PB1 (pin 3), PB2 (pin 5) and PA0 (pin 13)

Is there an alternative to I2C or a different communication protocol I could use to connect multiple of these slave boards to a master (ATMEGA328 etc.)?

Thanks a lot, I can provide any further information.

2
  • SPI without MOSI (one-way comms) only needs two pins CLK & MISO. That saves you one pin.
    – Dougie
    Jul 18, 2021 at 11:30
  • You can write a bit-banging implementation of I2C. -- As well as any other serial protocol. -- You could even invent your own protocol, but this is not wise. -- There are many serial protocols, starting with 1 wire. Jul 18, 2021 at 12:46

1 Answer 1

1

That is a lot of pins, so this really boils down to your application and what you want to optimize for.

You could do a bit-banged software I2C slave on these pins. "Bit-bang" means you just write a program to flip the bits on the pins rather than handing the bytes off to the hardware which would do the same thing (although sometimes faster or without using up CPU cycles). This would require either finding some existing code to implement the protocol, or sitting down with the documentation for the protocol and writing it yourself. Depending on your goals, the second option might be a great learning experience and take away some of the magic from this stuff. It is all just 1s and 0s and once you really internalize that, you realize that you can do almost anything with these little chips regardless of hardware or library support.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.