AnsweredAssumed Answered

STM32F103c8tx bmp280 SPI

Question asked by prive.GUILLAUME on Nov 20, 2016
Hello!

I post this subject because I have some problems to communicate with my BMP280.

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 with GPIO_MODE_AF_INPUT but nothing changed). All pins are "SPEED_HIGH" and "NOPULL". 

I simply use the function HAL_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 obtain this digital timing diagram:
spi_arduino.png

And with my stm32f103, I get this:spi_stm32.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

Outcomes