cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103c8tx bmp280 SPI

guillaume-ibanez
Associate
Posted on November 20, 2016 at 11:59

Hello!

I post this subject because I have some problems to communicate with my BMP I'm using SPI protocol and configured it like this:

spi_card.Instance = SPI2;
spi_card.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_64;
spi_card.Init.CLKPhase = SPI_PHASE_1EDGE;
spi_card.Init.CLKPolarity = SPI_POLARITY_LOW;
spi_card.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
spi_card.Init.DataSize = SPI_DATASIZE_8BIT;
spi_card.Init.Direction = SPI_DIRECTION_2LINES;
spi_card.Init.FirstBit = SPI_FIRSTBIT_MSB;
spi_card.Init.Mode = SPI_MODE_MASTER;
spi_card.Init.NSS = SPI_NSS_SOFT;
spi_card.Init.TIMode = SPI_TIMODE_DISABLE;
spi_card.Init.CRCPolynomial = 7;

SCLK and MOSI pins are in ''GPIO_MODE_AF_PP'' mode, and MISO is in ''GPIO_MODE_INPUT'' mode (I tried withGPIO_MODE_AF_INPUT but nothing changed). All pins are ''SPEED_HIGH'' and ''NOPULL''. I simply use the functionHAL_SPI_TransmitReceive to send the register byte and a dummy byte to get the value I need but it doesn't work. When I test with the arduino library, I obtainthis digital timing diagram: 0690X00000605SnQAI.png And with my stm32f103, I get this: 0690X00000605IGQAY.png Why after sending my dummy byte, the MOSI pin doesn't goes to high level? And why don't I get my 0x58 register value? Thank you! Yours faithfully #stm32f103 #spi #bmp280
0 REPLIES 0