cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 Disc SPI3 initially it's working fine then MISO pin stop working?

MarkEvens
Associate II

I am using STMCubeIDE for my project.

SPI3 connected with PC10, PC11, and PC12  pins but When I connected the logic analyzer with the PC11 pin while reading TMC5160 register it showed nothing. The pin will be high whatever I do.

 

I know this thing not give you a full Idea but tell me anything you want I will share it. B-coz I don't know what info will be useful to debug.

 

 

7 REPLIES 7

> When I connected the logic analyzer

Then it sounds like hardware damage, it may be on either side (STM32, target, LA) or all.

SCK works?

You can try to bit-bang some basic protocol to exclude any other influence.

JW

Sarra.S
ST Employee

Hello @MarkEvens

Maybe share your SPI3 configuration/ connection with TMC5160 chip 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Look at reasons why the Slave device isn't responding.

Is there a pin controlling I2C/SPI mode, or how chip select is activated.

Is it always doing this or does it work for a period after the power is cycled. How long and what access patterns? 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
MarkEvens
Associate II

Logic analyzer Image

White                    -> sck

Second orange    -> CS

Red is                  -> MOSI

Last is                  ->  MISO

 

signal_capture.PNG

MarkEvens
Associate II

hspi2.Instance = SPI2;

hspi2.Init.Mode = SPI_MODE_MASTER;

hspi2.Init.Direction = SPI_DIRECTION_2LINES;

hspi2.Init.DataSize = SPI_DATASIZE_8BIT;

hspi2.Init.CLKPolarity = SPI_POLARITY_HIGH;

hspi2.Init.CLKPhase = SPI_PHASE_2EDGE;

hspi2.Init.NSS = SPI_NSS_SOFT;

hspi2.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4;

hspi2.Init.FirstBit = SPI_FIRSTBIT_MSB;

hspi2.Init.TIMode = SPI_TIMODE_DISABLE;

hspi2.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;

hspi2.Init.CRCPolynomial = 10;

if (HAL_SPI_Init(&hspi2) != HAL_OK) {

is_hspi2_initialized = 1;

}

 

hspi3.Instance = SPI3;

hspi3.Init.Mode = SPI_MODE_MASTER;

hspi3.Init.Direction = SPI_DIRECTION_2LINES;

hspi3.Init.DataSize = SPI_DATASIZE_8BIT;

hspi3.Init.CLKPolarity = SPI_POLARITY_HIGH;

hspi3.Init.CLKPhase = SPI_PHASE_2EDGE;

hspi3.Init.NSS = SPI_NSS_SOFT;

hspi3.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4;

hspi3.Init.FirstBit = SPI_FIRSTBIT_MSB;

hspi3.Init.TIMode = SPI_TIMODE_DISABLE;

hspi3.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;

hspi3.Init.CRCPolynomial = 10;

if (HAL_SPI_Init(&hspi3) != HAL_OK) {

is_hspi3_initialized = 1;

}

 

This is spi initialization and below is my used pins

pins_selection.PNG

Only write register is working

MarkEvens
Associate II

Thank you everyone for your support.

I found a mistake I am using the TMC5160-BoB module which has two separate supply options one is for the motor and the second is named vcc_io.

 

So I am trying to read from the module without powering the motor supply pins. That is the main power supply for the module. vcc_io is just for resetting the module it is not providing complete power to module 😂

 

So as I powered the motor pins it started working.