Simulating SPI with AVR Studio

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

Reply to
Bugmaster
Loading thread data ...

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...

Reply to
SFC

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
Reply to
Ulf Samuelsson

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,

Reply to
SFC

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
Reply to
Ulf Samuelsson

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

Jeroen

Reply to
Jeroen

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.