element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Using Xilinx Tools Forum How to program Axi SPI using Arty7 - 35T
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 1 reply
  • Subscribers 336 subscribers
  • Views 1218 views
  • Users 0 members are here
Related

How to program Axi SPI using Arty7 - 35T

ivkome
ivkome over 3 years ago

Hello,

i'm learning how to program FPGA and therefore please need your support concerning the FPGA Arty A7 - 35T.

So, i'm trying two ways to programm the an AXI SPI with the MicroBlaze as Softcontroller:

1) using the SPI Board and his corresponding Pins on the connector J6.

2) using the AXI SPI, but assigning the Port pins (io0_o: MOSI, io1_i: MISO, sck_o: clock, ss_o[0:0]: chipSelect ) ---> to IO Pins (3.3 v).

For the the C-Code on Vitis, i'm unable to figure out the this four signals on the scope. Can somebody please help me to figure out why i'm unable to use the SPI for the two cases? Thank you very much in advance :-)

#include <stdio.h>
#include "Header_SPI.h"
#include "platform.h"
#include "xil_printf.h"
#include "xparameters.h"
#include "xspi.h"

int Run_SPI(XSpi *SpiInstancePtr, u16 SpiDeviceId) {
	init_platform();
	int Status, i;
	XSpi_Config *ConfigPtr; /* Pointer to Configuration data */

	/* Start Message */
	print("\n---> Start SPI Configuration <-----\n\r");

	/* Check if the SPI device instanced exist */
	ConfigPtr = XSpi_LookupConfig(SpiDeviceId);
	if (ConfigPtr == NULL) 
		{	return XST_DEVICE_NOT_FOUND;	}

	/* Initialize the SPI driver so that it is  ready to use.*/
	Status = XSpi_CfgInitialize(SpiInstancePtr, ConfigPtr,
			ConfigPtr->BaseAddress);
	if (Status != XST_SUCCESS) 
		{	return XST_FAILURE;		}

	/* Run loopback test only in case of standard SPI mode.	 */
	if (SpiInstancePtr->SpiMode != XSP_STANDARD_MODE)
		{	return XST_SUCCESS;		}

	/* SPI Setting Mode: Master + CPLO-CPHA=11, clk_High & Seconde edge */
	Status = XSpi_SetOptions(SpiInstancePtr, XSP_MASTER_OPTION | XSP_CLK_PHASE_1_OPTION);
	if (Status != XST_SUCCESS)
		{	return XST_FAILURE; 	}

	/* Start the SPI driver so that the device is enabled.	 */
	XSpi_Start(SpiInstancePtr);

	/* Disable Global interrupt to use polled mode operation */
	XSpi_IntrGlobalDisable(SpiInstancePtr);

	/* Initialize the write buffer with pattern to write     */
	//------------------------------------------------------------------------------------------------
		/* Initialize the write buffer with pattern to write     */
		u8 WriteBuffer[buffer_size] = { 0x09, NULL, 0x30, 0xAA};
		u8 ReadBuffer [buffer_size];
		
		while(1){
			XSpi_SetSlaveSelect(SpiInstancePtr, NULL);
				XSpi_Transfer(SpiInstancePtr, WriteBuffer, NULL, buffer_size);
			XSpi_SetSlaveSelect(SpiInstancePtr, 0x01);
			for( i=0; i<1000000; i++);
		}
		
		/* Compare the data received with the data that was transmitted	 */
	    /*	XSpi_Transfer(SpiInstancePtr, WriteBuffer, ReadBuffer, buffer_size);
		 for (i = 0; i < buffer_size; i++) {
			if (WriteBuffer[i] != ReadBuffer[i]) {
				print("\n NO DATA read");
				return XST_FAILURE;
			}
		} */
	//--------------------------------------------------------------------------------------------------

	cleanup_platform();

	return XST_SUCCESS;
}
imageimage

  • Sign in to reply
  • Cancel
  • jafoste4
    0 jafoste4 over 3 years ago

    Hello,

    The product you are referencing is a Digilent product. You would be better off asking the question in their support fourm.

    Thanks,

    Josh

    https://forum.digilent.com/ 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube