ADUCM3029 SPI SLAVE

Hi,

I'm trying to use SPI as slave on aducm3029 but something seems to be wrong. I already have used it as master but as slave it doesn't work. I just want to send some data (2 bytes) when the external master enables but I can't use interruptions of any kind. I copied what I think that is relevant functions and snippets. To test I run the code, then I use a master to start a connection but it don't receive anything ( I'm looking at MISO, MOSI, CS and CLK at oscilloscope). Could someone help me please?

#define regwrite(addr,data)        (addr=data)
#define regread(addr)              (addr)

#define KERNEL_IO1_CFG 0x00055550
#define KERNEL_IO1_OEN 0x812C
#define KERNEL_IO1_IEN 0x32D1

void wifiinit (void)
{
	/*Sets SPI_1 clock to 4.33 MHz*/
	regwrite(*pREG_SPI1_DIV, 0x0001);

	/*Sets CS_0 as the chip select of wifi*/
	regwrite(*pREG_SPI1_CS_CTL, 0x0001);

	/*Configures SPI_1 periferal - see AFE_SPI_CONF_VALUE definition*/
	regwrite(*pREG_SPI1_CTL, 0x5B84);
}

static void wifienable (void)
{
	regwrite(*pREG_SPI1_CTL,(*pREG_SPI1_CTL | 0x0001));

}

static void wifidisable (void)
{
	regwrite(*pREG_SPI1_CTL, (*pREG_SPI1_CTL & 0xFFFE));

}

void wifiwrite(uint8_t addr_value, uint8_t data_value)
{
	uint16_t spi_status = 0x0000;

	/*RX FIFO flush is enabled*/
	regwrite(*pREG_SPI1_CTL, (*pREG_SPI1_CTL | 0x1000));
	/*Clear register - only used in read operation*/
	regwrite(*pREG_SPI1_RD_CTL, 0x0000);
	/*Sending 2 bytes*/
	regwrite(*pREG_SPI1_CNT, 0x0002);

	wifienable();

	/*Byte of address. The MSB should be 1 in a write operation*/
	regwrite(*pREG_SPI1_TX,addr_value);

	/*Byte of data*/
	regwrite(*pREG_SPI1_TX,data_value);

	/*Starts write operation*/
	regread(*pREG_SPI1_RX);

	spi_status = regread(*pREG_SPI1_STAT);
	while ((spi_status & 0x0800) == 0x0000)
	{
	    spi_status = regread(*pREG_SPI1_STAT);
	}

	wifidisable();
}

int main(int argc, char *argv[])
{
	int i = 0;
	uint8_t temp = 36;
	adi_initComponents();

	regwrite(*pREG_GPIO1_CFG, KERNEL_IO1_CFG);
	regwrite(*pREG_GPIO1_OEN, KERNEL_IO1_OEN);
	regwrite(*pREG_GPIO1_IEN, KERNEL_IO1_IEN);


    while (1){

		wifiwrite (0xFF, temp);

		for ( i = 1; i <= 165536; i++)
		{
		}

		temp++;

		if (temp > 40)
		{
			temp = 36;
		}
		printf ("%d \n", temp);
    }
	return 0;
}