Altera_Forum
Honored Contributor
13 years agoHow to test a SPI module.
hello, i trying to test an spi module that i add in a system that im using, i used this code but i dont know why there is an error:
/* * principal.c * * Created on: 11/04/2012 * Author: RONALD */ # include <stdio.h># include "system.h" # define ALT_MODULE_CLASS_SPI_1 altera_avalon_spi# define SPI_1_NAME "/dev/SPI_1" int main() { FILE *fp; printf("Hello from Nios II!\n"); // fp = fopen("/dev/SPI_1","r+"); //opens module spi if(fp==0)//if doesnt exist the module do this printf("\nError Opening %s\n\n",SPI_1_BASE); else//do this if the module exists { printf( ""spi comunication success \n"); } return 0; } when i run this code for to test the spi module the program shows me ""Error Opening", could you help me with these please