Forum Discussion

nsuggula's avatar
nsuggula
Icon for New Contributor rankNew Contributor
2 years ago

C program to control SPI

Hello,

I am using Cyclone V , DE-10 standard SOCFpga

I created a project to implement spi communication so i implemented in two ways
using "spi (4 wire) intel fpga IP." and SPI slave to avalon master.

Please check the image below

Compiled the project and created rbf file and header file. Please help me how to use the spi module available now on FPGA. I wrote the C program to control the SPI (4 wire ) which is also available in attached zip file. I used the header files available in E:\intelFPGA_lite\22.1std\ip\altera\sopc_builder_ip\altera_avalon_spi. but when i compile the the spi_test.c with altera_avalon_spi.c i get the below error message

Please let me know the solution or please point out anything if I am doing wrong.

How can i use SPI slave to avalon master.

I also attacjed full project zip file below.

Thank you

3 Replies

  • tehjingy_Altera's avatar
    tehjingy_Altera
    Icon for Regular Contributor rankRegular Contributor

    Hi nsuggula


    For using of the SPI device in the linux environment you do not need to compile the driver into your c code.

    You could just add the device into the device tree and select the correct linux driver and it will appear in the linux /dev directory.


    If you are happening to be developing in baremetal you could follow the guide here to setup the cross compiler.

    https://www.rocketboards.org/foswiki/Documentation/HWLib


    Regards

    Jingyang, Teh


  • tehjingy_Altera's avatar
    tehjingy_Altera
    Icon for Regular Contributor rankRegular Contributor

    Hi


    Since there are no feedback for this thread, I shall set this thread to close pending. Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.


    If you happened to close this thread you might receive a survey. If you think you would rank your support experience less than 4 out of 10, please allow me to correct it before closing or if the problem can’t be corrected, please let me know the cause so that I may improve your future service experience.


    Regards

    Jingyang, Teh