代写辅导接单-EEL4744C

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top

University of Florida EEL4744C – Spring 2024 Dr. Eric M. Schwartz

Electrical & Computer Engineering Dept. Lab 6: Synchronous Serial Communication Christopher Crary, Instructor

Page 1/10 Revision 1 Wesley Piard, Instructor

OBJECTIVES

• Understand general concepts regarding synchronous serial communication.

• Become familiar with the Serial Peripheral Interface (SPI) communication protocol and how to apply it with the ATxmega128A1U.

• Interface with an external inertial measurement unit (IMU) sensor package, by way of the SPI communication protocol.

• Stream and plot real-time 3D (XYZ) acceleration data using the SPI and USART systems of the ATxmega128A1U.

INTRODUCTION

In general, systems that use synchronous serial communication utilize a common clock signal to determine when to send, receive, or

sample data. In fact, all synchronous communication is dependent on such a signal. In contrast, for devices communicating with an

asynchronous serial communication protocol, there exists no synchronization signal. Instead, a common transfer rate must be upheld by

the systems, or else, data received could be interpreted incorrectly, or even entirely missed.

Synchronous serial communication is normally preferred over asynchronous serial communication because higher data transfer rates can

generally be achieved. The main reason for this is that asynchronous serial systems must normally include within all data transmissions

some bits for synchronization and “error-checking”, which effectively reduces any possible rate of data transfer.

One popular synchronous serial communication protocol is Serial Peripheral Interface (SPI). With SPI, full-duplex communication is

possible between two or more devices, although only one device may act as a controlling master – every other connected device must act

as a responding student. Although there may be only one master, it is possible that the role of master be assigned dynamically. However,

for this to be done properly, some form of “handshaking” is required.

When communication is to occur between some master and student(s), the master device is always responsible for initiating the

communication. Normally, before some communication may occur, a student must be enabled by way of a chip select (CS), or student

select (SS), signal. In general, such a signal is either controlled by the master or is always driven true. To start communication once some

set of students is enabled, the master generates a clock signal, often referred to as the serial clock (SCK, SPC). Upon some edge of each

generated clock pulse, either the rising edge or falling edge, each of the master and student(s) will shift out a single bit of data from an

internal shift register, where each has their own. Furthermore, each device is to “sample” some bit of data on the opposite edge of the

same clock pulse. Any data shifted into a student from some master is transmitted via a signal most commonly referred to as Master-

Output-Student-Input (MOSI), and any data shifted into a master from some student is transmitted via a signal most commonly referred

to as Master-Input-Student-Output (MISO). In general, either or both of some MOSI/MISO signals can be used; in other words, it is

possible for [1] a master to transmit to, but not receive from, some student(s), [2] a master to receive from, but not transmit to, some

student(s), and [3] a master to both transmit to and receive from some student(s). For both [2] and [3], it must be ensured that no two

student devices share a chip select signal, for else there would be bus contention.

Although SPI is a very common synchronous serial communication protocol, there exist many others; some others include Inter-

Integrated Circuit (IIC, or more commonly, I2C), Universal Serial Bus (USB), and Controller Area Network (CAN). Moreover, the

synchronous mode within the USART system of the ATxmega128A1U, the ‘S’ of “USART”, provides access to another synchronous

serial communication protocol, which is very similar to SPI.

LAB STRUCTURE

In this lab, you will utilize synchronous serial communication by way of the SPI protocol. More specifically, you will learn how to

configure and use the SPI system of the ATxmega128A1U, for the purpose of communicating with an LSMDS3TR or LSM6DSL inertial

measurement unit (IMU) chip, located on the OOTB Robotics Backpack. The LSM6 devices contains a Micro-Electro-Mechanical System

(MEMS) 3D digital accelerometer and a MEMS 3D digital gyroscope1

. Once SPI communication with the IMU is properly established,

you will generate real-time plots of linear acceleration on your computer, by streaming IMU sensor data to a data visualization program,

SerialPlot, via the relevant USART module.

REQUIRED MATERIALS

• Atmel ATxmega128A1U AU Manual (doc8331)

• LSM6DSL Datasheet (most of you will have this)

• LSM6DS3TR DataSheet

• Relevant skeleton code files (.c and .h): lab6_files.zip

• OOTB µPAD, with USB A/B cable

• OOTB Robotics Backpack, with accompanying schematic

1 An accelerometer is a device used to measure acceleration, e.g., static accelerations like gravity, or dynamic accelerations such as vibrations or movements in the X, Y,

or Z coordinate axes. A gyroscope is a device that measures angular velocity and uses gravity to help determine orientation.

51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468