Altera_Forum
Honored Contributor
14 years agoNiosII SPI Core problem
Hi, all
i use a SPI core in my nios system. when i used the function "alt_avalon_spi_command()" to sent a "who am i" command to the peripheral, it received no data. so i use signalTap to debug. here's the data i got http://ww1.sinaimg.cn/large/4abedc10gw1dk7o6m3q7ej.jpg my questions: 1)MISO has received the data sent back by peripheral, why rx_holding_reg and shift_reg received nothing? 2)is there anything wrong in my code?int main()
{
alt_u8 temp;
alt_u8 wdata = 0x80 | WHO_AM_I;
if(alt_avalon_spi_command(
SPI_L3G4200_BASE,0,
1,&wdata,
1,&temp,
0)==0)
printf("fail\n");
else
{
printf("%d\n",(int)temp);
}
} thanks