Author Topic: USI-I2C / USI-SPI on AVRs  (Read 2685 times)

0 Members and 1 Guest are viewing this topic.

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
USI-I2C / USI-SPI on AVRs
« on: December 01, 2015, 03:26:46 pm »
As part of the HX711 milliohm meter project, I worked out a few modules that allow serial communications (I2C/SPI/USART) on the ATtiny85 utilizing its USI peripheral. Have to say that they are not that intuitive to use, and are far slower and less flexible than PIC's MSSP modules.
================================
https://dannyelectronics.wordpress.com/
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: USI-I2C / USI-SPI on AVRs
« Reply #1 on: December 02, 2015, 09:42:19 am »
Yeah; I looked at Atmel's App Note on doing a UART with USI, and I wasn't very impressed :-(
The SERCOM peripheral in their ARM chips looks ok, though.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9930
  • Country: nz
Re: USI-I2C / USI-SPI on AVRs
« Reply #2 on: December 02, 2015, 10:42:22 am »
not much point using a ATtiny unless you have no choice. Use an ATMega with proper UART SPI TWI port. (or save some money and use a stm32  :-DD )
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Bruce Abbott

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: nz
    • Bruce Abbott's R/C Models and Electronics
Re: USI-I2C / USI-SPI on AVRs
« Reply #3 on: December 02, 2015, 05:51:29 pm »
I agree that PIC peripherals are generally easier to use. However until recently no 8 pin PIC had hardware SPI, I2C or UART (only the 12F1822 and 12F1840 have all three). At the same clock speed PIC code is 2-4 times slower than AVR, so it needs more peripheral hardware to keep up.   

Try doing this:-

on an 8 pin PIC!

 
 

Offline ralphd

  • Frequent Contributor
  • **
  • Posts: 445
  • Country: ca
    • Nerd Ralph
Re: USI-I2C / USI-SPI on AVRs
« Reply #4 on: December 02, 2015, 06:02:11 pm »
Doing SPI on USI is pretty easy, but UART is a hack since the bitorder needs to be reversed, and the 8bit limit means spitting up 8N1 transmissions.  If you only need tx, bitbanged UART can be done in under 30 bytes of asm.
Unthinking respect for authority is the greatest enemy of truth. Einstein
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9930
  • Country: nz
Re: USI-I2C / USI-SPI on AVRs
« Reply #5 on: December 03, 2015, 11:29:14 am »
I agree that PIC peripherals are generally easier to use. However until recently no 8 pin PIC had hardware SPI, I2C or UART (only the 12F1822 and 12F1840 have all three). At the same clock speed PIC code is 2-4 times slower than AVR, so it needs more peripheral hardware to keep up.   

Try doing this:-

on an 8 pin PIC!

haha, that made my day
So awesome

bitbanging ethernet  :-DD
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: USI-I2C / USI-SPI on AVRs
« Reply #6 on: December 05, 2015, 12:58:25 pm »
Quote
Try doing this:-

Really nice. Can be done with USI as well.
================================
https://dannyelectronics.wordpress.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf