2016-11-20 02:59 AM
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:
And with my stm32f103, I get this:
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