AVR Microcontroller Questions and Answers – SPI Protocol

This set of AVR Micro-controller Multiple Choice Questions & Answers (MCQs) focuses on “SPI Protocol”.

1. Why do we make the connection of the SCLK for communicating serially between two devices?
a) to get a clock output from the device
b) to synchronize the two devices
c) to obtain an analog output
d) all of the mentioned
View Answer

Answer:b
Explanation: We need an SCLK in order for the two devices to communicate with each other properly. It acts as a pulse according to which one device sends a message and the other receives it.

2. What is the function of the CE pin in SPI?
a) it is used for synchronization
b) it is used as a transmitting pin
c) it is used as a receiving pin
d) it is used to initiate and terminate the data transfer
View Answer

Answer: d
Explanation: CE pin is used to initiate and terminate the data transfer in the controller via SPI interface.

3. Which of the following is correct?
a) MOSI has the same meaning as the SDO
b) SCLK is used to initiate and terminate the data transfer
c) In 3 wire SPI, there is only one pin for transmission and reception
d) In 3 wire SPI, there are three pins MOSI, MISO and SCLK
View Answer

Answer: c
Explanation: In 3 wire SPI, there is only one pin for transmission and reception and the other two pins SCLK and CE are used for synchronization of data and for initialization and termination of data.
advertisement
advertisement

4. If CPHA= 0 and CPOL=1, then which of the following is true?
a) read on rising edge, changed on a falling edge
b) read on falling edge, changed on a rising edge
c) write on rising edge, changed on a falling edge
d) write on rising edge, changed on a falling edge
View Answer

Answer: b
Explanation: If CPOL= 1 and CPHA= 0, then reading operation is performed on the rising edge and the change occurs at every falling edge.

5. In SPI write, LSB goes first?
a) true
b) false
c) can’t be said
d) depends on the cases
View Answer

Answer: b
Explanation: In SPI write, MSB goes first.

6. In AVR, which of the following registers are used for SPI?
a) SPSR
b) SPCR
c) SPDR
d) All of the mentioned
View Answer

Answer: d
Explanation: In AVR, SPSR(SPI Status Register), SPCR(SPI Control Register) and SPDR(SPI Data Register) are used for programming the SPI module.

7. How do we set the SPI, to operate in the master mode 1?
a) We set the MSTR bit, and make the CPOL= 1 and CPHA=0
b) We set the MSTR bit, and make the CPOL= 0 and CPHA=1
c) We reset the MSTR bit, and make the CPOL= 1 and CPHA=0
d) We reset the MSTR bit, and make the CPOL= 0 and CPHA=1
View Answer

Answer: b
Explanation: In SPI, to make it work in the master mode, we make the MSTR bit is equal to 1 and for operating it in the mode 1 we make the CPOL=0 and CPHA=1.
advertisement

8. SPI can act as a half duplex transmission?
a) true
b) false
c) depends on the conditions
d) can’t be said
View Answer

Answer: b
Explanation: No, SPI can’t work in the half duplex transmission mode.

9. Which frequency is not recommended for SPI clock?
a) fosc/4
b) fosc/64
c) fosc/16
d) fosc/2
View Answer

Answer: d
Explanation: fosc/2 is not recommended frequency for SPI transfer in AVR.
advertisement

10. To select the value of the clock to be fosc/16, what are the appropriate values?
a) SPI2X= 0, SPR1= 0, SPR0=1
b) SPI2X= 0, SPR1= 1, SPR0=0
c) SPI2X= 1, SPR1= 1, SPR0=0
d) SPI2X= 0, SPR1= 1, SPR0=1
View Answer

Answer: a
Explanation: For obtaining this very clock frequency of fosc/16, we set the values of SPI2X= 0, SPR1=0 and SPR0=1.

Sanfoundry Global Education & Learning Series – Microcontroller.

To practice all areas of Microcontroller, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.