2024-03-30 10:02 PM - edited 2024-03-30 11:07 PM
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)
// *** 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
2024-03-31 01:10 AM - edited 2024-03-31 01:13 AM
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 ...
2024-03-31 02:15 AM - edited 2024-03-31 02:16 AM
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€.