Hello everyone,
I'm trying to get a SPI interface working using the USI on the Attiny26 and I can not figure out why my LSB is always 0 when using SPI mode 0. In Mode 1 I get bad alignment of the clock & output data. I've asked this question to AVRfreaks but haven't gotten anywhere.
The SPI driver is an adoption from the Atmel AVR319 app note. I've modified the timers to work with the ATtiny26 (using output compares 1A & 1C, 1C for the automatic clear and 1A for the interrupt). I've also added a chip select to automatically go active low when a transmission is initialized and be brought high at the end of the transmission with the USI OVF interrupt.
I'm attaching the code and some Saleae logic captures for the two different SPI transmission modes. Please help!
I'm trying to get a SPI interface working using the USI on the Attiny26 and I can not figure out why my LSB is always 0 when using SPI mode 0. In Mode 1 I get bad alignment of the clock & output data. I've asked this question to AVRfreaks but haven't gotten anywhere.
The SPI driver is an adoption from the Atmel AVR319 app note. I've modified the timers to work with the ATtiny26 (using output compares 1A & 1C, 1C for the automatic clear and 1A for the interrupt). I've also added a chip select to automatically go active low when a transmission is initialized and be brought high at the end of the transmission with the USI OVF interrupt.
I'm attaching the code and some Saleae logic captures for the two different SPI transmission modes. Please help!
Attachments
-
3.5 KB Views: 2
-
43.4 KB Views: 1