Simulating SPI with AVR Studio

Mar 12, 2005 5 Replies

Hi all,



I am trying to program a simple SPI application using Atmel's ATTiny2313. I lifted the code straight out of their guide:



SPITransfer_Fast: out USIDR,r16 ldi r16,(1


I'm using a atmega8 but I think it works the same. This is my code,

SPI_Send:

out SPDR,r16 Wait: sbis SPSR,SPIF ; Wait for transmission to complete rjmp Wait

ret

I'm using avr studio for simulation.

SFC

"Bugmaster" schreef in bericht news: snipped-for-privacy@l41g2000cwc.googlegroups.com...

No, the USI and the SPI are two different peripherals. The USI can be used to emulate an SPI.

Best Regards, Ulf Samuelsson ulf@a-t-m-e-l.com This message is intended to be my own personal view and it may or may not be shared by my employer Atmel Nordic AB

So you have to bit bang it then?

SFC

"Ulf Samuelss>> I'm using a atmega8 but I think it works the same. This is my code,

The USI is an 8 bit shift register where the clock can be be software controlled You write an 8 bit value to the shift register and then you write 8 times to an I/O location to clock it out. You can also use timers to clock the USI.

Bit banging involves several I/O writes per bit.

Best Regards, Ulf Samuelsson ulf@a-t-m-e-l.com This message is intended to be my own personal view and it may or may not be shared by my employer Atmel Nordic AB

The AVR studio 4.11 build 401 help file clearly tells in the known issues USI is not yet supported.

Jeroen

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required