SPI MOSI -> MOSI?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

Pardon for this rather basic question.  But I just wanted to be sure.  When I use AVRDude to program an ATMEGA via SPI using the USBAsp program, MOSI pin of the programmer goes to the MOSI pin of the target ATMEGA, MISO pin goes to the MISO pin, etc.

 

Now, I am doing an SD Card reading project.  And I found the schematic http://elasticsheep.com/wp-conte... (many of them on the net) from the site http://elasticsheep.com/2010/01/....  Based on the schematic, the ATMEGA168's MOSI pin goes to the SD card's "DI" pin, which is another name "MOSI" pin on the SD card? Likewise, the ATMEGA168's pin "MISO" goes to the SD card's "DO" pin, which is the "MISO" pin?

 

Thanks! 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When you are programming your AVR,   the USBASP is the Master and the AVR is the Slave.   i.e. USBASP MOSI pin connected to AVR's MOSI pin.

 

When the AVR is talking to the SD card,  the AVR (master) MOSI pin is connected to the SD DI pin.

 

Of course the AVR Mega's SPI peripheral is able to change roles between Master and Slave on the fly.     Which is fine if you know what you are doing.     (if you don't then haywire-ability can be confusing)

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MOSI = Master Out, Slave In - that is it is the output from the Master, and the input to the Slave

 

SPI Connections

http://en.wikipedia.org/wiki/Ser...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

unebonnevie wrote:
Based on the schematic, the ATMEGA168's MOSI pin goes to the SD card's "DI" pin, which is another name "MOSI" pin on the SD card? Likewise, the ATMEGA168's pin "MISO" goes to the SD card's "DO" pin, which is the "MISO" pin?

 

DI and DO are "Data In" and "Data Out", so yes - it's just as you said.