2
\$\begingroup\$

I want to use an attiny85 for a project that will be controlling some LEDs over a pseudo SPI that only needs to use SCLK and MOSI. Is there any way to reconfigure pin 6 (MISO) on the 85 to be used as a digital read/write after configuring SPI? I need 3 digital read pins as well as the 2 for SPI and the only way I can d it is either disable the reset pin, which would than mean I would need a high voltage programmer to program it :(, or use the MISO pin...

Any way to do this?

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Datasheet: ATTINY85 \$\endgroup\$
    – JYelton
    Jan 4, 2013 at 23:51
  • \$\begingroup\$ The HV programmer is only required when you want to re-program the controller, not the initial programming. In other words: if you made a mistake in the program and need to reprogram the chip then you need a HV-programmer. BTW: I succesfully used an Arduino as HV-programmer before. \$\endgroup\$
    – jippie
    Jan 4, 2013 at 23:58
  • \$\begingroup\$ rickety.us/2010/03/arduino-avr-high-voltage-serial-programmer \$\endgroup\$
    – jippie
    Jan 5, 2013 at 0:00
  • \$\begingroup\$ @jippie, disabling the reset pin is not, however, the answer to this question, since the unused SPI pin can in fact be re-purposed as proposed. \$\endgroup\$ Jan 5, 2013 at 2:14
  • \$\begingroup\$ @AdamHaile - I believe you will find that if you have the pin configured as an input (which you would need if you were to use its SPI function), you can read it's state just as you could with any other I/O pin. \$\endgroup\$ Jan 5, 2013 at 2:16

1 Answer 1

4
\$\begingroup\$

The SPI MISO function is nothing but a digital input pin.

The question does not specify whether the pseudo-SPI LED peripheral provides a handshake or other data on the MISO line at all. Assuming there is some initial data at set-up if at all, but no further use of the line by the peripheral during normal operation, the following should work:

Connect one of your 3 data source lines, OR'ed with the MOSI coming from the SPI peripheral, into pin 6 of the ATTiny.

During SPI set-up, ignore (or do what's needed with) the signal coming into pin 6. After that, simply read Pin 6 as you would any normal digital input pin.

If the LED peripheral works fine without connecting it to the MISO on the ATTiny at all, then you can skip the OR connection, and simply treat pin 6 as a standard digital input.

\$\endgroup\$
1
  • \$\begingroup\$ That sounds like it will do what I need nicely :) And I already know for a fact that it will work without hooking the LED device up to the MISO pin because it, in fact, does not even have that line. Like I said, psuedo SPI. It's all write and no read. Very happy to hear this should work. Thanks! \$\endgroup\$
    – Adam Haile
    Jan 7, 2013 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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