STM32L-Discovery serial (RS232) communication
Hi,
I'm triyng to transmit data from an accelerometer to STM32L-Discovery and send this data from STM32L-Discovery to PC using SPI and RS232This is my initialization code
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);
GPIO_InitStruct1.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_InitStruct1.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStruct1.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStruct1.GPIO_Speed = GPIO_Speed_40MHz;
GPIO_Init( GPIOB, &GPIO_InitStruct1);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource12, GPIO_AF_SPI2);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource13, GPIO_AF_SPI2);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource14, GPIO_AF_SPI2);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource15, GPIO_AF_SPI2);
SPI_InitTypeDef SPI_InitStruct1;
SPI_InitStruct1.SPI_Direction = SPI_Direction_2Lines_FullDuplex ;
SPI_InitStruct1.SPI_Mode = SPI_Mode_Master;
SPI_InitStruct1.SPI_DataSize = SPI_DataSize_8b;
SPI_InitStruct1.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStruct1.SPI_CPHA = SPI_CPHA_1Edge;
SPI_InitStruct1.SPI_NSS = SPI_NSS_Soft;
SPI_InitStruct1.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2;
SPI_InitStruct1.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStruct1.SPI_CRCPolynomial = 7;
SPI_Init(SPI2, &SPI_InitStruct1);
SPI_Cmd(SPI2, ENABLE);
and this is the code for trasmit from accelerometer to STM32Lwhile(1){
uint16_t Data;
Data = SPI_I2S_ReceiveData(SPI2);}Now, could someone tell me if there are examples, libraries or other that I can use to receive data and show it onto the PC?Thanks