cancel
Showing results for 
Search instead for 
Did you mean: 

G431 - SPI brings big noise on the MISO

Tobe
Senior III

I have tried normal GPIO setting with pullup/down and setting AF5, but it just stays the same level, but its shape changes (see additional pictures).

I have just connected the probes. (MISO is blue)big noise.jpg

 

 

 

  // *** SPI ***
  // NSS  (PB12)
  GPIO_InitStruct.Pin = GPIO_PIN_12;
  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

  GPIOB->AFR[1] |= (GPIO_AFRH_AFSEL12_2 | GPIO_AFRH_AFSEL12_0); //AF 5

  // SCK  (PB13)
  GPIO_InitStruct.Pin = GPIO_PIN_13;
  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

  GPIOB->AFR[1] |= (GPIO_AFRH_AFSEL13_2 | GPIO_AFRH_AFSEL13_0); //AF 5

  // MISO (PB14)
//  GPIO_InitStruct.Pin = GPIO_PIN_14;
//  GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
//  GPIO_InitStruct.Pull = GPIO_PULLDOWN;	//TODO: remove?
//  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
//  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

  GPIOB->AFR[1] |= (GPIO_AFRH_AFSEL14_2 | GPIO_AFRH_AFSEL14_0); //AF 5

  // MOSI (PB15)
  GPIO_InitStruct.Pin = GPIO_PIN_15;
  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

  GPIOB->AFR[1] |= (GPIO_AFRH_AFSEL15_2 | GPIO_AFRH_AFSEL15_0); //AF 5

 

 

 

 

2 REPLIES 2
MM..1
Chief II

MISO is as name say input pin with high sensitivity. When yuor pcb routing or scope quality is low, you receive crosstalks of signals in area. Here perfectly you see crostalked SCK and MOSI

And your code init example is too non standart. When you use HAL use HAL and MSP for init , not mixed ...

I dissagree: A function "MISO" does say nothing about the pin configuration. I am using a Nucleo board, and i use a SIglent SDS814X HD which does cost 600€.