Skip to main content
Visitor II
August 25, 2025
Solved

STM32H753 SPI Transmission

  • August 25, 2025
  • 1 reply
  • 522 views

Hi,

 

I'm using the STM32H753-NUCLEO Board for some SW development, and I'm having some issues with the SPI Handling.

I'm attempting to transmit a single 16-bit data packet, however on the scope I'm transmitting two 16-bit data packets. When I change my data packet type to 8 bits, I'm transmitting 4 8-bit data packets.

I've scoured the RM0433 manual but cannot find the register which tells the peripheral to only transmit a single data packet.

Could someone point me to the correct register and what it should be set to to achieve this please?

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

    Use byte or half-word writes to DR, otherwise it does data packing.

    // half-word write
    *(volatile uint16_t*)&SPIx->TXDR = .;
    
    // byte write
    *(volatile uint8_t*)&SPIx->TXDR = .;

     

    https://github.com/STMicroelectronics/stm32h7xx-hal-driver/blob/dbfb749f229e1aa89e50b54229ca87766e180d2d/Inc/stm32h7xx_ll_spi.h#L2504

     

    1 reply

    TDKAnswer
    Super User
    August 25, 2025

    Use byte or half-word writes to DR, otherwise it does data packing.

    // half-word write
    *(volatile uint16_t*)&SPIx->TXDR = .;
    
    // byte write
    *(volatile uint8_t*)&SPIx->TXDR = .;

     

    https://github.com/STMicroelectronics/stm32h7xx-hal-driver/blob/dbfb749f229e1aa89e50b54229ca87766e180d2d/Inc/stm32h7xx_ll_spi.h#L2504

     

    Visitor II
    August 26, 2025

    That's perfect, thank you!