recently, i am working with LDC1000-STM32F3.
I have tried both of HW SPI and SW SPI to follow the guide in datasheet, but i all failed to get the data read from LDC1000.
Here is the code i did. I checked the SCLK, MOSI, CBS, all them are correced with datasheet. i connected the head of LDC1000EVM+Sensor to my STM32F3
please tell me what i was wrong with this code.
Thnk you so much
#include "ldc1000.h"
/*---------------------------------------- Global variable ----------------------------------------*/ uint8_t RegArray[REG_LEN]; void delay_a(uint32_t nCount); /*---------------------------------------- Function Function: LDC GPIO initialization Function parameters: IO port connection diagram INT <-> PA7 <-> GPIO <-> P6-3 CSB PA2 <-> <-> P6-2 DCLK <-> PA8 <-> 6MHz <-> P6-1 SCLK <-> PC10 <-> LDC_SPI_SCK <-> P6-4 SDO <-> PC11 <-> LDC_SPI_MISO <-> P6-5 SDI <-> PC12 <-> LDC_SPI_MOSI <-> P6-6 VIO <-> 3V3 <-> P6-9 GND <-> GND <-> P6-11 GND <-> GND <-> P7-8 +5V <-> +5V <-> P7-9 ----------------------------------------*/ void LDC_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; // SPI_InitTypeDef SPI_InitStructure; /*!< LDC_SPI disable */ SPI_Cmd(LDC_SPI, DISABLE); /*!< LDC_SPI DeInit */ // SPI_I2S_DeInit(LDC_SPI); /*!< Disable SPI clock */ // RCC_APB1PeriphClockCmd(LDC_SPI_CLK, DISABLE); /* Enable clock port A,B,C */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); /* Configure MCO Pin: DCLK */ GPIO_InitStructure.GPIO_Pin = LDC_DCLK_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOA, &GPIO_InitStructure); // Alternate function source set GPIO_PinAFConfig(GPIOA, GPIO_PinSource8, GPIO_AF_0); RCC_MCOConfig(RCC_MCOSource_SYSCLK); /* Config LDC pin _ CS as GPIO function */ GPIO_InitStructure.GPIO_Pin = LDC_CS_PIN; //PA2 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOA, &GPIO_InitStructure); /* Configure SPI pins: SCK, MOSI */ GPIO_InitStructure.GPIO_Pin = LDC_SPI_SCK_PIN | LDC_SPI_MOSI_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIO_LDC, &GPIO_InitStructure); /* Configure SPI pins: MISO*/ GPIO_InitStructure.GPIO_Pin = LDC_SPI_MISO_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIO_LDC, &GPIO_InitStructure); /* Configure SPI pins PA7: INT*/ GPIO_InitStructure.GPIO_Pin = LDC_INT_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; /*!< High Speed:50MHz */ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOA, &GPIO_InitStructure); // Init IO GPIO_SetBits(GPIOA,LDC_CS_PIN); GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); GPIO_ResetBits(GPIO_LDC,LDC_SPI_MOSI_PIN); GPIO_ResetBits(GPIO_LDC,LDC_SPI_MISO_PIN); } void LDC_WriteReg8(uint8_t dat) { uint8_t tmp=0; uint32_t i = 0; delay_a(1); GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); delay_a(1); // Write data _ Rising edge for (i=0;i<7;i++) { tmp = (dat >> (7-i)) & 0x01; GPIO_WriteBit(GPIO_LDC,LDC_SPI_MOSI_PIN,(BitAction)tmp); delay_a(1); GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); delay_a(1); GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); } // Last bit tmp = (dat >> (7-i)) & 0x01; GPIO_WriteBit(GPIO_LDC,LDC_SPI_MOSI_PIN,(BitAction)tmp); delay_a(1); GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); delay_a(5); } /*---------------------------------------- Function: LDC write register Function parameters: - addr register address - dat data ----------------------------------------*/ void LDC_WriteReg(int8_t addr, uint8_t dat) { uint8_t tmp=0; uint32_t i = 0; addr = addr & 0x7F; // The MSB is a 0-write register, which is a 1-read register LDC_CS_LOW; delay_a(1); GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); delay_a(1); // Write address _ Rising edge for (i=0;i<8;i++) { tmp = (addr >> (7-i)) & 0x01; GPIO_WriteBit(GPIOC,LDC_SPI_MOSI_PIN,(BitAction)tmp); delay_a(1); GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); delay_a(1); // GPIO_ResetBits(GPIO_LDC,LDC_SPI_MOSI_PIN); GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); } // Write data _ Rising edge for (i=0;i<7;i++) { tmp = (dat >> (7-i)) & 0x01; GPIO_WriteBit(GPIO_LDC,LDC_SPI_MOSI_PIN,(BitAction)tmp); delay_a(1); GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); delay_a(1); GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); } // Last bit tmp = (dat >> (7-i)) & 0x01; GPIO_WriteBit(GPIO_LDC,LDC_SPI_MOSI_PIN,(BitAction)tmp); delay_a(1); GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); delay_a(5); LDC_CS_HIGH; delay_a(2); } /*---------------------------------------- Function: LDC read register Function parameters: - addr register address ----------------------------------------*/ uint8_t LDC_ReadReg(int8_t addr) { uint8_t tmp=0; uint32_t i = 0; uint32_t data=0; addr = addr | 0x80; // The MSB is 1-read register LDC_CS_LOW; delay_a(1); GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); delay_a(1); // Write address _ Rising edge for (i=0;i<7;i++) { tmp = (addr >> (7-i)) & 0x01; GPIO_WriteBit(GPIO_LDC,LDC_SPI_MOSI_PIN,(BitAction)tmp); delay_a(1); GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); delay_a(1); GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); } // Last Address bit tmp = addr & 0x01; GPIO_WriteBit(GPIOC,LDC_SPI_MOSI_PIN,(BitAction)tmp); delay_a(1); GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); // Read data _ Falling edge for (i=0;i<8;i++) { GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); delay_a(1); tmp = GPIO_ReadInputDataBit(GPIO_LDC,LDC_SPI_MISO_PIN); data |= (uint32_t)((tmp & 0x01) << (7-i)); delay_a(1); GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); delay_a(1); } delay_a(1); //GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); LDC_CS_HIGH; // delay_a(1); } // // Last Address bit // tmp = addr & 0x01; // GPIO_WriteBit(GPIOC,LDC_SPI_MOSI_PIN,(BitAction)tmp); // delay_a(1); // GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); // // // Read data _ Falling edge // for (i=0;i<8;i++) // { // GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); // delay_a(1); // tmp = GPIO_ReadInputDataBit(GPIO_LDC,LDC_SPI_MISO_PIN); // data |= (uint32_t)((tmp & 0x01) << (7-i)); // // delay_a(1); // GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); // delay_a(1); // } // // delay_a(1); // //GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); // LDC_CS_HIGH; // // delay_a(1); // // Read data _ Rising edge // for (i=0;i<7;i++) // { // delay_a(1); // GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); // delay_a(1); // // tmp = GPIO_ReadInputDataBit(GPIO_LDC,LDC_SPI_MISO_PIN); // data |= (uint32_t)((tmp & 0x01) << (7-i)); // // GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); // delay_a(1); // } // // GPIO_SetBits(GPIO_LDC,LDC_SPI_SCK_PIN); // delay_a(1); // // tmp = GPIO_ReadInputDataBit(GPIO_LDC,LDC_SPI_MISO_PIN); // data |= (uint32_t)((tmp & 0x01) << (7-i)); // // delay_a(2); // //GPIO_ResetBits(GPIO_LDC,LDC_SPI_SCK_PIN); // LDC_CS_HIGH; // return data; // LDC_WriteReg(LDC_CMD_RPMAX, 0x13); //0x13 // //delay(10); // LDC_WriteReg(LDC_CMD_RPMIN, 0x3B); //0x13 // //delay(10); // LDC_WriteReg(LDC_CMD_SENSORFREQ, 0x94); //0x94 - B3- 1MHz // //delay(10); // LDC_WriteReg(LDC_CMD_LDCCONFIG, 0x13); //0x17 // //delay(10); // LDC_WriteReg(LDC_CMD_CLKCONFIG, 0x01); //0x00 // //delay(10); // LDC_WriteReg(LDC_CMD_INTCONFIG, 0x02); //0x02 // //delay(10); // LDC_WriteReg(LDC_CMD_THRESHILSB, 0x50); //0x50 // //delay(10); // LDC_WriteReg(LDC_CMD_THRESHIMSB, 0x14 );//0x14 // //delay(10); // LDC_WriteReg(LDC_CMD_THRESLOLSB, 0xC0); //0xC0 // //delay(10); // LDC_WriteReg(LDC_CMD_THRESLOMSB, 0x12); //0x12 // //delay(10); // LDC_WriteReg(LDC_CMD_PWRCONFIG, 0x01); // Active Mode, Conversion is Enabled /*---------------------------------------- Function: LDC initialization ----------------------------------------*/ void LDC_Init(void) { LDC_GPIO_Init(); LDC_WriteReg(LDC_CMD_RPMAX, 0x13); //0x13 //delay(10); LDC_WriteReg(LDC_CMD_RPMIN, 0x3B); //0x13 //delay(10); LDC_WriteReg(LDC_CMD_SENSORFREQ, 0x94); //0x94 - B3- 1MHz //delay(10); LDC_WriteReg(LDC_CMD_LDCCONFIG, 0x13); //0x17 //delay(10); LDC_WriteReg(LDC_CMD_CLKCONFIG, 0x01); //0x00 //delay(10); LDC_WriteReg(LDC_CMD_INTCONFIG, 0x02); //0x02 //delay(10); LDC_WriteReg(LDC_CMD_THRESHILSB, 0x50); //0x50 //delay(10); LDC_WriteReg(LDC_CMD_THRESHIMSB, 0x14 );//0x14 //delay(10); LDC_WriteReg(LDC_CMD_THRESLOLSB, 0xC0); //0xC0 //delay(10); LDC_WriteReg(LDC_CMD_THRESLOMSB, 0x12); //0x12 //delay(10); LDC_WriteReg(LDC_CMD_PWRCONFIG, 0x01); // Active Mode, } /*---------------------------------------- Function: LDC initialization ----------------------------------------*/ void LDC_Init1(void) { LDC_GPIO_Init(); LDC_CS_LOW; LDC_WriteReg(LDC_CMD_RPMAX, 0x13); //0x13 //delay(10); LDC_WriteReg8(0x3B); //0x13 //delay(10); LDC_WriteReg8(0x94); //0x94 - B3- 1MHz //delay(10); LDC_WriteReg8(0x13); //0x17 //delay(10); LDC_WriteReg8(0x01); //0x00 //delay(10); LDC_WriteReg8(0x02); //0x02 //delay(10); LDC_WriteReg8(0x50); //0x50 //delay(10); LDC_WriteReg8(0x14 );//0x14 //delay(10); LDC_WriteReg8(0xC0); //0xC0 //delay(10); LDC_WriteReg8(0x12); //0x12 //delay(10); LDC_WriteReg8(0x01); // Active Mode delay(1); LDC_CS_HIGH; } /*---------------------------------------- Function: Send one byte of data to the LDC Function parameters: the data to be sent dat Return Value: The device sends back the data ----------------------------------------*/ uint8_t LDC_SendByte(uint8_t dat) { LDC_CS_LOW; while(SPI_I2S_GetFlagStatus(LDC_SPI, SPI_I2S_FLAG_TXE) == RESET); SPI_SendData8(LDC_SPI, dat); while(SPI_I2S_GetFlagStatus(LDC_SPI, SPI_I2S_FLAG_RXNE) == RESET); LDC_CS_HIGH; return (uint8_t)LDC_SPI->DR; } /*---------------------------------------- Function Function: Read LDC one byte Function parameters: empty Return Value: One byte of data sent from the device ----------------------------------------*/ uint8_t LDC_ReadByte(void) { return 0x00; } /*---------------------------------------- Function: Read LDC len bytes Function parameters: - addr - pBuffer - len Call example: LDC_ReadBytes (LDC_CMD_REVID, & RegArray [0], 12); ----------------------------------------*/ void LDC_ReadBytes(int8_t addr, uint8_t* pBuffer, uint8_t len) { addr = addr | 0x80; //Read Data LDC_CS_LOW; LDC_SendByte(addr); while(len > 0) { *pBuffer = LDC_ReadByte(); pBuffer++; len--; } LDC_CS_HIGH; } //void LDC1000_Reg_Check(){ ////Rp_MAX // LDC_ReadReg // //} // void Induct_Measure(void){ unsigned long Fcount, prox, temp, temp1; char txt1[21], txt2[15]; float ind, fsens; LDC_CS_LOW; LDC_ReadReg(0xA1); prox=LDC_ReadReg(0xFF); LDC_CS_HIGH; LDC_CS_LOW; LDC_ReadReg(0xA2); temp1=LDC_ReadReg(0xFF); LDC_CS_HIGH; temp1=temp1<<8; prox=prox+temp1; // LongLongUnsignedToStr(prox, txt1); // UART1_Write_Text("Proximity Data = "); // UART1_Write_Text(txt1); // UART1_Write(13); // UART1_Write(10); delay(100); LDC_CS_LOW; LDC_ReadReg(0xA3); Fcount=LDC_ReadReg(0xFF); LDC_CS_HIGH; LDC_CS_LOW; LDC_ReadReg(0xA4); temp=LDC_ReadReg(0xFF); LDC_CS_HIGH; temp=temp<<16; Fcount=Fcount+temp; //Measuring Sensor frequency // fsens = (1/3)*(Fext/Fcount)*(Response Time) //Fext is the frequency of the external clock (6MHz) //Fcount is the value obtained from the Frequency Counter Data register(address 0x23,0x24,0x25) //Response Time is the programmed response time (see LDC configuration register, address 0x04) fsens=(1./3.)*(6000000./Fcount)*(6144); //Measuring Sensor inductance ind=1e6/(100e-12*((2.*3.14*fsens)*(2.*3.14*fsens))); // FloatToStr(ind, txt2); // UART1_Write_Text("Impedance L = "); // UART1_Write_Text(txt2); // UART1_Write_Text(" uH"); // UART1_Write(13); // UART1_Write(10); // UART1_Write(13); // UART1_Write(10); delay(100); } // Delay ms void delay_a(uint32_t nCount) { uint32_t index = 0; for(index = (nCount*1); index != 0; index--) ; } //void LDC_WriteReg(int8_t addr, uint8_t dat) //{ // addr = addr & 0x7F; // The MSB is a 0-write register, which is a 1-read register // LDC_CS_LOW; // SPI_SendData8(LDC_SPI, addr); // while(SPI_I2S_GetFlagStatus(LDC_SPI, SPI_I2S_FLAG_TXE) == RESET); // SPI_SendData8(LDC_SPI, dat); // while(SPI_I2S_GetFlagStatus(LDC_SPI, SPI_I2S_FLAG_TXE) == RESET); // //LDC_CS_HIGH; //} // //uint8_t LDC_ReadReg(int8_t addr) //{ // uint8_t temp; // addr = addr | 0x80;//MSB is a 1-read register, which is a 0-write register // LDC_CS_LOW; // while(SPI_I2S_GetFlagStatus(LDC_SPI, SPI_I2S_FLAG_TXE) == RESET); // SPI_SendData8(LDC_SPI, addr); // while(SPI_I2S_GetFlagStatus(LDC_SPI, SPI_I2S_FLAG_BSY) == RESET); // SPI_SendData8(LDC_SPI, 0x00); // while(SPI_I2S_GetFlagStatus(LDC_SPI, SPI_I2S_FLAG_BSY) == RESET); // // temp = (uint8_t)SPI_ReceiveData8(LDC_SPI); // while(SPI_I2S_GetFlagStatus(LDC_SPI, SPI_I2S_FLAG_RXNE) == RESET); // // //LDC_CS_HIGH; // return temp; //} // //void LDC_GPIO_Init(void) { // GPIO_InitTypeDef GPIO_InitStructure; // SPI_InitTypeDef SPI_InitStructure; // // /*!< LDC_SPI disable */ // SPI_Cmd(LDC_SPI, DISABLE); // // /*!< LDC_SPI DeInit */ // SPI_I2S_DeInit(LDC_SPI); // // /*!< Disable SPI clock */ // RCC_APB1PeriphClockCmd(LDC_SPI_CLK, DISABLE); // // /* Enable clock port A,B,C */ // RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE); // RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE); // RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); // // /* Config LDC pin _ CS as GPIO function */ // GPIO_InitStructure.GPIO_Pin = LDC_CS_PIN; //PA2 // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; // GPIO_Init(GPIOA, &GPIO_InitStructure); // // /* Configure MCO Pin: DCLK */ // GPIO_InitStructure.GPIO_Pin = LDC_DCLK_PIN; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; // GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; // GPIO_Init(GPIOA, &GPIO_InitStructure); // // Alternate function source set // GPIO_PinAFConfig(GPIOA, GPIO_PinSource8, GPIO_AF_0); // RCC_MCOConfig(RCC_MCOSource_SYSCLK); // // /* Configure SPI pins: SCK, MISO and MOSI */ // GPIO_InitStructure.GPIO_Pin = LDC_SPI_SCK_PIN | LDC_SPI_MOSI_PIN; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; // GPIO_Init(GPIO_LDC, &GPIO_InitStructure); // // /* Configure SPI pins: MISO*/ // GPIO_InitStructure.GPIO_Pin = LDC_SPI_MISO_PIN; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; // GPIO_Init(GPIO_LDC, &GPIO_InitStructure); // // /* Configure SPI pins PA7: INT*/ // GPIO_InitStructure.GPIO_Pin = LDC_INT_PIN; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; // GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; /*!< High Speed:50MHz */ // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; // GPIO_Init(GPIOA, &GPIO_InitStructure); // // /* SPI3 configuration */ // // /*!< Enable SPI clock */ // RCC_APB1PeriphClockCmd(LDC_SPI_CLK, ENABLE); // // /* Connect PC.10 to SPI SCK */ // GPIO_PinAFConfig(GPIO_LDC, LDC_SPI_SCK_SOURCE, LDC_SPI_SCK_AF); // // /* Connect PC.11 to SPI MISO */ // GPIO_PinAFConfig(GPIO_LDC, LDC_SPI_MISO_SOURCE, LDC_SPI_MOSI_AF); // // /* Connect PC.12 to SPI MOSI */ // GPIO_PinAFConfig(GPIO_LDC, LDC_SPI_MOSI_SOURCE, LDC_SPI_MOSI_AF); // // SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; // SPI_InitStructure.SPI_Mode = SPI_Mode_Master; // SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; // SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; // SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; // SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; // SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_32; // SPI_BaudRatePrescaler_4 // SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; // SPI_InitStructure.SPI_CRCPolynomial = 7; // SPI_Init(LDC_SPI, &SPI_InitStructure); // // /* Configure the RX FIFO Threshold to Quarter Full */ // // SPI_RxFIFOThresholdConfig(LDC_SPI, SPI_RxFIFOThreshold_QF); // // SPI_Cmd(LDC_SPI, ENABLE); /* Enable SPI3 */ // //}