cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Observer
Observer
1,145 Views
Registered: ‎04-23-2018

ZedBoard SPI interrupt code

Jump to solution

Hi,

 

Can anyone please share interrupt base SPI code for zedboard.

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Moderator
Moderator
1,372 Views
Registered: ‎10-30-2017

Re: ZedBoard SPI interrupt code

Jump to solution

HI @mohanv,

 

Interrupt is not a MIO pin, it is a signal from SPI controller to Zynq.  So there is no way to connect this signal to MIO pins.

There is already a XScuGic interrupter controller is present in Zynq and you need to connect your SPI to this controller to enable the SPI interrupts (this can be done in SDK if you are using SDK). 

 

Best Regards,
Srikanth
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.

 

View solution in original post

0 Kudos
6 Replies
Highlighted
Moderator
Moderator
1,093 Views
Registered: ‎07-31-2012

Re: ZedBoard SPI interrupt code

Jump to solution

Hi @mohanv,

 

If you have the hardware design built in Vivado and exported HDF to SDK workspace then will be able to get example templates for SPI interrupt.

 

Regards

Praveen


-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Highlighted
Observer
Observer
1,075 Views
Registered: ‎04-23-2018

Re: ZedBoard SPI interrupt code

Jump to solution

Hi Praveen

 

In my viviado project by enabling the SPI i got 4 MIO's(MOSI,MISO,SCLK,SS) but for my project interrupt pin also required.

 

How to enable the interrupt pin(MIO) in vivado in addition to 4MIO's.

 

Regards 

Praveen.

0 Kudos
Highlighted
Moderator
Moderator
1,061 Views
Registered: ‎07-31-2012

Re: ZedBoard SPI interrupt code

Jump to solution

Hi @mohanv,

 

Could you check in PS configuration -> PS-PL interface -> General -> Interrupts -> PS-PL -> SPI?

 

Regards

Praveen


-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Highlighted
Moderator
Moderator
1,373 Views
Registered: ‎10-30-2017

Re: ZedBoard SPI interrupt code

Jump to solution

HI @mohanv,

 

Interrupt is not a MIO pin, it is a signal from SPI controller to Zynq.  So there is no way to connect this signal to MIO pins.

There is already a XScuGic interrupter controller is present in Zynq and you need to connect your SPI to this controller to enable the SPI interrupts (this can be done in SDK if you are using SDK). 

 

Best Regards,
Srikanth
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.

 

View solution in original post

0 Kudos
Highlighted
Observer
Observer
1,043 Views
Registered: ‎04-23-2018

Re: ZedBoard SPI interrupt code

Jump to solution

Thank you Srikanth

0 Kudos
Highlighted
Observer
Observer
971 Views
Registered: ‎04-23-2018

Re: ZedBoard SPI interrupt code

Jump to solution

Hi,

 

I am able to transmit the data over SPI in Zedboard(Master), but in my project a have to read acknowledgement from slave.

 

In this code i'm unable to receive  acknowledgement.

 

 

 

 

static uint32_t waitTransmit(XSpiPs *InstancePtr)
{
uint32_t StatusReg;
uint32_t CheckTransfer = 0U;
while (CheckTransfer == 0U)
{
StatusReg = XSpiPs_ReadReg(InstancePtr->Config.BaseAddress, XSPIPS_SR_OFFSET);
if ( (StatusReg & XSPIPS_IXR_MODF_MASK) != 0U) {
/*
* Clear the mode fail bit
*/
XSpiPs_WriteReg(InstancePtr->Config.BaseAddress,
XSPIPS_SR_OFFSET,
XSPIPS_IXR_MODF_MASK);
return XST_SEND_ERROR;
}
CheckTransfer = (StatusReg & XSPIPS_IXR_TXOW_MASK);
}
return XST_SUCCESS;
}

 

static void manualStart(XSpiPs *InstancePtr)
{
uint32_t regValue;
regValue = XSpiPs_ReadReg( InstancePtr->Config.BaseAddress, XSPIPS_CR_OFFSET);
regValue |= XSPIPS_CR_MANSTRT_MASK;
XSpiPs_WriteReg(InstancePtr->Config.BaseAddress, XSPIPS_CR_OFFSET, regValue);

return;
}

 

 

void spi_tx(char *data,int length)
{

 


for(int i=0;i<length;i++)
{
XSpiPs_SetSlaveSelect(&xspi,0);

XSpiPs_Enable(&xspi);


XSpiPs_Out32(xspi.Config.BaseAddress + (u32)XSPIPS_TXD_OFFSET, (u32)(data[i+1]));
XSpiPs_Out32(xspi.Config.BaseAddress + (u32)XSPIPS_TXD_OFFSET, (u32)(data[i]));


manualStart(&xspi);

 

waitTransmit(&xspi);

 

readData[i] = XSpiPs_In32(xspi.Config.BaseAddress + (u32)XSPIPS_RXD_OFFSET);
readData[i+1] = XSpiPs_In32(xspi.Config.BaseAddress + (u32)XSPIPS_RXD_OFFSET);



XSpiPs_SetSlaveSelect(&xspi,0xF);

XSpiPs_Disable(&xspi);

}

}

 

 

In another way

 

void spi_tx(char *data,int length)
{

XSpiPs_PolledTransfer(&xspi, data,readData, length);

}

 

By using xilinx API

 

By using both the functions i'm receiving 0x0000000 in some cases 0xFFFFFFFF. 

 

 

Can any one suggest where i am facing the problem.

 

0 Kudos