kaeroul

STM32F4 Discovery SPI ADAU1701 READBACK

Discussion created by kaeroul on Sep 5, 2016
Latest reply on Sep 6, 2016 by BenKB

hello guys, i try to read readback block of ADAU1701 using STM32F4 Discovery for SPI communication.

i have succeded to control volume cell but now i am facing problem on how to read the readback cell. I have follow all the protocol needed to communicate between uC n adau1701 and i succeded before using arduino uno but not this time using stm32f4 discovery.

 

could aynone please help me?

below is the program. tq in advanced.

-kal-

 

HAL_GPIO_WritePin(GPIOE,GPIO_PIN_3,GPIO_PIN_RESET); //bring the cs pin low to activate the slave device
ChipaddrRw = 0x00; // chip address and write bit
HAL_SPI_Transmit(&hspi2, &ChipaddrRw, 1,50);
celladdress1 = 0x08; // MSB Address
HAL_SPI_Transmit(&hspi2, &celladdress1, 1,50);
celladdress2 = 0x1A; // LSB Address
HAL_SPI_Transmit(&hspi2, &celladdress2, 1,50);

data1 = 0x00; // MSB Data
HAL_SPI_Transmit(&hspi2, &data1, 1,50);
data2 = 0x6A; // LSB Data
HAL_SPI_Transmit(&hspi2, &data2, 1,50);
HAL_GPIO_WritePin(GPIOE,GPIO_PIN_3,GPIO_PIN_SET); // disable Slave Select by bringing cs pin High

 

// read data from data capture register
HAL_GPIO_WritePin(GPIOE,GPIO_PIN_3,GPIO_PIN_RESET);

ChipaddrRw = 0x00; // chip address and write bit
HAL_SPI_Transmit(&hspi2, &ChipaddrRw, 1,50);
celladdress1 = 0x08; // MSB Address
HAL_SPI_Transmit(&hspi2, &celladdress1, 1,50);
celladdress2 = 0x1A; // LSB Address
HAL_SPI_Transmit(&hspi2, &celladdress2, 1,50);

/*
HAL_SPI_TransmitReceive(&hspi2, 0x00,&dataR1, 1,50);
HAL_SPI_TransmitReceive(&hspi2, 0x00,&dataR2, 1,50);
HAL_SPI_TransmitReceive(&hspi2, 0x00,&dataR3, 1,50);
*/


HAL_SPI_Transmit(&hspi2, 0x00, 1,50); //9
HAL_SPI_Receive(&hspi2, &dataR1, 1,50); //10
HAL_SPI_Transmit(&hspi2, 0x00, 1,10);
HAL_SPI_Receive(&hspi2, &dataR2, 1,10);
HAL_SPI_Transmit(&hspi2, 0x00, 1,10);
HAL_SPI_Receive(&hspi2, &dataR3, 1,10);

HAL_GPIO_WritePin(GPIOE,GPIO_PIN_3,GPIO_PIN_SET);

Outcomes