Skip to main content
Explorer II
March 21, 2025
Solved

SPI Speed delay nucleo H755

  • March 21, 2025
  • 2 replies
  • 1261 views

Good day,

I've been working on getting an external adc on the nucleo H755ziq to work at max speed. The adc can reach up to 1 million samples a second with a clock cycle time of 10ns. Problem is that it's only seeming to go at a speed of 60ns per clock cycle. Spi is set at 200mhz with a /2 prescaler on an external 48mhz crystal. Any idea why it's getting this 60ns speed instead of 10ns? Ive set the GPIO for spi to very high speed as well encase that was the issue.

    This topic has been closed for replies.
    Best answer by TDK

    nucleo H755ziq

    external 48mhz crystal

    This board doesn't have a 48 MHz crystal. It does have a 8 MHz clock source from the ST-Link chip which is connected by default. Note that 8/48 = 0.1666 so maybe your clock source is just wrong (HSE_VALUE).

    2 replies

    Super User
    March 21, 2025

    Hi,

    not clear : you have an  external adc at 1 Msps . Why ( internal 16b ADC can do this also ) ?

    +

    SPI at 100Mbit set (bit high...for 1 Ms conversion rate - or not ?) - but runs 6x slower - right ?

     

    Did you check with MCO , the internal clock is what you expect ?

    IgneousAuthor
    Explorer II
    March 21, 2025

    It's an external ADC bc of a project Im working on that I can't specify more about. It's a custom ADC is as much as I can say. The important part is that, when checking the speed in the code, it shows the correct speeds of 100mhz for the spi (simply checked with HAL_RCC_GetPCLK2Freq()). meanwhile the logic analyser shows the speed of 60ns per clock cycle which suggests a 16.667mhz speed instead. It's like a 6x prescaler is added on or something. 

    Super User
    March 21, 2025

    Ok,

    so what is set as prescaler for this spi ?

    see in your main: (example on spi4)

    static void MX_SPI4_Init(void)
    {
    
     /* USER CODE BEGIN SPI4_Init 0 */
    
     /* USER CODE END SPI4_Init 0 */
    
     /* USER CODE BEGIN SPI4_Init 1 */
    
     /* USER CODE END SPI4_Init 1 */
     /* SPI4 parameter configuration*/
     hspi4.Instance = SPI4;
     hspi4.Init.Mode = SPI_MODE_MASTER;
     hspi4.Init.Direction = SPI_DIRECTION_2LINES;
     hspi4.Init.DataSize = SPI_DATASIZE_8BIT;
     hspi4.Init.CLKPolarity = SPI_POLARITY_LOW;
     hspi4.Init.CLKPhase = SPI_PHASE_1EDGE;
     hspi4.Init.NSS = SPI_NSS_SOFT;
     hspi4.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
     hspi4.Init.FirstBit = SPI_FIRSTBIT_MSB;
     hspi4.Init.TIMode = SPI_TIMODE_DISABLE;

    ...here prescaler /2 , so look, whats in your xx.init .

    +

    If this looks good, check with a scope on MCO , the internal clock is really what you expect !

    Technical Moderator
    March 21, 2025

    Hello @Igneous 

    Could you share with us your system clock config please?

    IgneousAuthor
    Explorer II
    March 21, 2025

    this should do for that

    Igneous_0-1742559379169.png

    Igneous_1-1742559397689.png