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 in Master mode without FIFO:
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; }