3.Adam Taylor Topsy microzed series part 82nd: Simple Communication Interface Part 2nd

Source: Internet
Author: User

by Adam Taylor

Starting last week's blog, we have entered the programming of the OLED display module on the Zedboard (instead of the microzed) board. Before formally entering the specific OLED program, however, I think it is necessary to verify that we have configured the SPI port correctly for the application. This action can be a lot less time for our next steps, and it's easy to do. In fact, it's really simple, and I'll show you two different ways in this blog post. The first method uses the Zynq Soc's Mio to interface with the SPI pin, while the second method passes the Emio. What is the difference between the two? Please keep looking down.

I'm going to play a little trick. I will connect the SPI0 to the Emio on the Zynq Soc, and SPI1 interface to Mio. This can be done easily with Vivado. First, enable the SPI1 and then connect it to the 10 to 15 pins of Mio. These pins are connected to the PS MOD (JE) on the Zedboard. SPI0 will be connected to the Pmod JC, which requires you to select Emio from the drop-down menu. Then we can use the IO cabling constraints to drive the Emio interface to the JC PMOD. However if you look at Zynq trm--you really should look more-you will find that if you use Emio, you need to pull the spix_ssi up. I have used a constraint as follows:

We now have two SPI controllers to drive the data to the Pmod port. We use the same software as before to drive, and the code in the next step is very similar. (We are now the 82nd issue of the blog, preferably.) )

The code must:
• Include related header files for API support, in this case xspips.h
• Define the SPI device ID number
• Declare a global instance of the correct SPI type--xspips

In a function that configures and uses an SPI device, the code must:
• Configure instances with Typ_xspips_config declarations
• Use Spiconfig = Xspips_lookupconfig ((U16) spi_device_id) to query the configuration
• Use Xspips_cfginitialize (&spiinstance,spiconfig,spiconfig->baseaddress) to initialize the configuration.

After the basic SPI device is initialized and configured, we can begin to configure the operation of the SPI Controller for the application we need. The first thing to do is to configure the settings and use the
Xspips_setoptions ()

With this function we can set the master-slave mode, set the active clock and stage options, choose how we perform the slave option, and configure how the host starts.

We also need to set the divider to configure the proper clock frequency for the slave. We can use the following function to implement:
Xspips_setclkprescaler ()

If you haven't forgotten, last week we mentioned that the OLED timing requires a minimum of 64 dividers. In this case, the test output only drives an oscilloscope, so for the purpose of blogging, I choose to set it to 256, which is the maximum number of crossovers.

Now we can send the data to the slave device in the simplest way, whether it's using an interrupt driver or a polling transmission. In this case, I used the polling method, because it is easiest to use and easy to understand.

The specific code has been uploaded in the GitHub repository I created, and the following is the result of the probe connected to the Mio and Emio output pins:

PMOD JC SPI Data clock and data (above) Emio

PMOD JE SPI Clock and data (above) MIO

As you can see, all the capture results are the same. As the clock falls along the data state changes, the rising edge remains stable, which is exactly what the OLED interface needs.

I believe we have now correctly configured the SPI, and then we can step into the specific development. At any time, it is always necessary to validate every development process to reduce risk. The routine also shows how to use the Emio pin. We need Emio in the OLED project, and it will be used in future development as well.

Here you can get the routine files.

Now you can easily get the first year of the Adam Thelles microzed Dev Board chronicle kindle ebook version, very affordable for just $7.5. Click here.

Original link:
Http://forums.xilinx.com/t5/Xcell-Daily-Blog/Adam-Taylor-s-MicroZed-ish-...

3.Adam Taylor Topsy microzed series part 82nd: Simple Communication Interface Part 2nd

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.