AnsweredAssumed Answered

AD5293 not accepting SPI commands

Question asked by GurpreetSingh on Mar 31, 2013
Latest reply on Apr 8, 2013 by GurpreetSingh

Hello everyone,

 

I am interfacing STM32f407 micro with AD5293 using SPI mode 1, Clock idle Low ,but its not working properly . As i poweron my circuit AD5293 Wiper reads +1.6v(midscale) as soon as micro starts communicating with Ad5293 its wiper starts showing +3.1v

Vlogic=+3.3v

VSS= -15v

VDD= +15v

Have tried different clock speeds but still not geting it worked. Please guide me so that i can finish my project.

 

code:

SPI_InitStruct.SPI_Direction = SPI_Direction_2Lines_FullDuplex ; // set to full duplex mode, seperate MOSI and MISO lines

SPI_InitStruct.SPI_Mode = SPI_Mode_Master; // transmit in master mode, NSS pin has to be always high

SPI_InitStruct.SPI_DataSize = SPI_DataSize_16b; // one packet of data is 8 bits wide

SPI_InitStruct.SPI_CPOL = SPI_CPOL_Low; // clock is low when idle

SPI_InitStruct.SPI_CPHA = SPI_CPHA_2Edge; // data sampled at first edge

SPI_InitStruct.SPI_NSS = SPI_NSS_Soft | SPI_NSSInternalSoft_Set; // set the NSS management to internal and pull internal NSS high

SPI_InitStruct.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2; // SPI frequency is APB2 frequency / 2

SPI_InitStruct.SPI_FirstBit = SPI_FirstBit_MSB;// data is transmitted MSB first

 

 

GPIOA->BSRRH |= GPIO_Pin_4; // set PE7 (CS) low

 

received_val1 = SPI1_send(0x1802);     // transmit dummy byte and receive data

 

GPIOA->BSRRL |= GPIO_Pin_4; // set PE7 (CS) high

 

Delay(100L);

 

GPIOA->BSRRH |= GPIO_Pin_4; // set PE7 (CS) low

 

  received_val2 = SPI1_send(0x0500); // transmit dummy byte and receive data

 

GPIOA->BSRRL |= GPIO_Pin_4; // set PE7 (CS) high

        Delay(10L); //spi#####end#####////

Attachments

Outcomes