cancel
Showing results for 
Search instead for 
Did you mean: 

On NucleoF7 evaluation board, 3-wire SPI communication

Ming Yue
Associate
Posted on January 16, 2018 at 22:56

with STM32F7 Nucleo evaluation board, we are tying to use SPI protocol to communicate with a MLX90316 (a Rotray Position Sensor). with a little bit different from the normal SPI set up, this IC only have one MOSI port, and I have attached wiring diagram (caputure from the chip's data sheet), we have followed this, and not sure if this type of 3-wire SPI set up works with STM32 family or not, since from reference manual (RM0410), the SPI setup section 35.5, there is no set up shows as attached wiring diagram.  so my question is if STM32 micro processor can be used to set up SPI as that, what kind of setting I will need and how the message can be send and received (since MISO is inverted from MOSI, when reading the data back, do I need any extra steps?):

I have attached SPI set up code as below:

hspi4.Instance = SPI4;

hspi4.Init.Mode = SPI_MODE_MASTER;

hspi4.Init.Direction = SPI_DIRECTION_2LINES;

hspi4.Init.DataSize = SPI_DATASIZE_8BIT;

//based on MLX chip, the CPHA = 1; CPOL = 0;

hspi4.Init.CLKPolarity = SPI_POLARITY_LOW;

hspi4.Init.CLKPhase = SPI_PHASE_2EDGE;

//using the GPIO set up the CS pin 

hspi4.Init.NSS = SPI_NSS_HARD_OUTPUT;

hspi4.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;

hspi4.Init.FirstBit = SPI_FIRSTBIT_MSB;

hspi4.Init.TIMode = SPI_TIMODE_DISABLE; //SPI_TIMODE_DISABLE

hspi4.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;

hspi4.Init.CRCPolynomial = 3;

hspi4.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;

hspi4.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;

if (HAL_SPI_Init(&hspi4) != HAL_OK)

{

Error_Handler();

}

#spi-communication #3-wire-spi
0 REPLIES 0