你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

【经验分享】STM32 SPI相关函数和类型

[复制链接]
STMCU小助手 发布时间:2022-6-16 18:00
01. SPI简介
SPI 是英语 Serial Peripheral interface 的缩写,顾名思义就是串行外围设备接口。是 Motorola首先在其 MC68HCXX 系列处理器上定义的。SPI 接口主要应用在 EEPROM,FLASH,实时时钟,AD 转换器,还有数字信号处理器和数字信号解码器之间。SPI,是一种高速的,全双工,同步的通信总线,并且在芯片的管脚上只占用四根线,节约了芯片的管脚,同时为 PCB 的布局上节省空间,提供方便,正是出于这种简单易用的特性,现在越来越多的芯片集成了这种通信协议,STM32F4 也有 SPI 接口。

02. 相关类型
SPI Init structure definition

  1. /**
  2.   * @brief  SPI Init structure definition  
  3.   */

  4. typedef struct
  5. {
  6.   uint16_t SPI_Direction;           /*!< Specifies the SPI unidirectional or bidirectional data mode.
  7.                                          This parameter can be a value of @ref SPI_data_direction */

  8.   uint16_t SPI_Mode;                /*!< Specifies the SPI operating mode.
  9.                                          This parameter can be a value of @ref SPI_mode */

  10.   uint16_t SPI_DataSize;            /*!< Specifies the SPI data size.
  11.                                          This parameter can be a value of @ref SPI_data_size */

  12.   uint16_t SPI_CPOL;                /*!< Specifies the serial clock steady state.
  13.                                          This parameter can be a value of @ref SPI_Clock_Polarity */

  14.   uint16_t SPI_CPHA;                /*!< Specifies the clock active edge for the bit capture.
  15.                                          This parameter can be a value of @ref SPI_Clock_Phase */

  16.   uint16_t SPI_NSS;                 /*!< Specifies whether the NSS signal is managed by
  17.                                          hardware (NSS pin) or by software using the SSI bit.
  18.                                          This parameter can be a value of @ref SPI_Slave_Select_management */

  19.   uint16_t SPI_BaudRatePrescaler;   /*!< Specifies the Baud Rate prescaler value which will be
  20.                                          used to configure the transmit and receive SCK clock.
  21.                                          This parameter can be a value of @ref SPI_BaudRate_Prescaler
  22.                                          @note The communication clock is derived from the master
  23.                                                clock. The slave clock does not need to be set. */

  24.   uint16_t SPI_FirstBit;            /*!< Specifies whether data transfers start from MSB or LSB bit.
  25.                                          This parameter can be a value of @ref SPI_MSB_LSB_transmission */

  26.   uint16_t SPI_CRCPolynomial;       /*!< Specifies the polynomial used for the CRC calculation. */
  27. }SPI_InitTypeDef;
复制代码

I2S Init structure definition

  1. /**
  2.   * @brief  I2S Init structure definition  
  3.   */

  4. typedef struct
  5. {

  6.   uint16_t I2S_Mode;         /*!< Specifies the I2S operating mode.
  7.                                   This parameter can be a value of @ref I2S_Mode */

  8.   uint16_t I2S_Standard;     /*!< Specifies the standard used for the I2S communication.
  9.                                   This parameter can be a value of @ref I2S_Standard */

  10.   uint16_t I2S_DataFormat;   /*!< Specifies the data format for the I2S communication.
  11.                                   This parameter can be a value of @ref I2S_Data_Format */

  12.   uint16_t I2S_MCLKOutput;   /*!< Specifies whether the I2S MCLK output is enabled or not.
  13.                                   This parameter can be a value of @ref I2S_MCLK_Output */

  14.   uint32_t I2S_AudioFreq;    /*!< Specifies the frequency selected for the I2S communication.
  15.                                   This parameter can be a value of @ref I2S_Audio_Frequency */

  16.   uint16_t I2S_CPOL;         /*!< Specifies the idle state of the I2S clock.
  17.                                   This parameter can be a value of @ref I2S_Clock_Polarity */
  18. }I2S_InitTypeDef;
复制代码

SPI_Exported_Constants

  1. /** @defgroup SPI_Exported_Constants
  2.   * @{
  3.   */

  4. #define IS_SPI_ALL_PERIPH(PERIPH) (((PERIPH) == SPI1) || \
  5.                                    ((PERIPH) == SPI2) || \
  6.                                    ((PERIPH) == SPI3) || \
  7.                                    ((PERIPH) == SPI4) || \
  8.                                    ((PERIPH) == SPI5) || \
  9.                                    ((PERIPH) == SPI6))

  10. #define IS_SPI_ALL_PERIPH_EXT(PERIPH) (((PERIPH) == SPI1)    || \
  11.                                        ((PERIPH) == SPI2)    || \
  12.                                        ((PERIPH) == SPI3)    || \
  13.                                        ((PERIPH) == SPI4)    || \
  14.                                        ((PERIPH) == SPI5)    || \
  15.                                        ((PERIPH) == SPI6)    || \
  16.                                        ((PERIPH) == I2S2ext) || \
  17.                                        ((PERIPH) == I2S3ext))

  18. #define IS_SPI_23_PERIPH(PERIPH)  (((PERIPH) == SPI2) || \
  19.                                    ((PERIPH) == SPI3))

  20. #define IS_SPI_23_PERIPH_EXT(PERIPH)  (((PERIPH) == SPI2)    || \
  21.                                        ((PERIPH) == SPI3)    || \
  22.                                        ((PERIPH) == I2S2ext) || \
  23.                                        ((PERIPH) == I2S3ext))

  24. #define IS_I2S_EXT_PERIPH(PERIPH)  (((PERIPH) == I2S2ext) || \
  25.                                     ((PERIPH) == I2S3ext))
复制代码

SPI_data_direction

  1. /** @defgroup SPI_data_direction
  2.   * @{
  3.   */

  4. #define SPI_Direction_2Lines_FullDuplex ((uint16_t)0x0000)
  5. #define SPI_Direction_2Lines_RxOnly     ((uint16_t)0x0400)
  6. #define SPI_Direction_1Line_Rx          ((uint16_t)0x8000)
  7. #define SPI_Direction_1Line_Tx          ((uint16_t)0xC000)
  8. #define IS_SPI_DIRECTION_MODE(MODE) (((MODE) == SPI_Direction_2Lines_FullDuplex) || \
  9.                                      ((MODE) == SPI_Direction_2Lines_RxOnly) || \
  10.                                      ((MODE) == SPI_Direction_1Line_Rx) || \
  11.                                      ((MODE) == SPI_Direction_1Line_Tx))
复制代码

SPI_mode

  1. /** @defgroup SPI_mode
  2.   * @{
  3.   */

  4. #define SPI_Mode_Master                 ((uint16_t)0x0104)
  5. #define SPI_Mode_Slave                  ((uint16_t)0x0000)
  6. #define IS_SPI_MODE(MODE) (((MODE) == SPI_Mode_Master) || \
  7.                            ((MODE) == SPI_Mode_Slave))
复制代码

SPI_data_size

  1. /** @defgroup SPI_data_size
  2.   * @{
  3.   */

  4. #define SPI_DataSize_16b                ((uint16_t)0x0800)
  5. #define SPI_DataSize_8b                 ((uint16_t)0x0000)
  6. #define IS_SPI_DATASIZE(DATASIZE) (((DATASIZE) == SPI_DataSize_16b) || \
  7.                                    ((DATASIZE) == SPI_DataSize_8b))
复制代码

SPI_Clock_Polarity

  1. /** @defgroup SPI_Clock_Polarity
  2.   * @{
  3.   */

  4. #define SPI_CPOL_Low                    ((uint16_t)0x0000)
  5. #define SPI_CPOL_High                   ((uint16_t)0x0002)
  6. #define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_CPOL_Low) || \
  7.                            ((CPOL) == SPI_CPOL_High))
复制代码

SPI_Clock_Phase

  1. /** @defgroup SPI_Clock_Phase
  2.   * @{
  3.   */

  4. #define SPI_CPHA_1Edge                  ((uint16_t)0x0000)
  5. #define SPI_CPHA_2Edge                  ((uint16_t)0x0001)
  6. #define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_CPHA_1Edge) || \
  7.                            ((CPHA) == SPI_CPHA_2Edge))
复制代码

SPI_Slave_Select_management

  1. /** @defgroup SPI_Slave_Select_management
  2.   * @{
  3.   */

  4. #define SPI_NSS_Soft                    ((uint16_t)0x0200)
  5. #define SPI_NSS_Hard                    ((uint16_t)0x0000)
  6. #define IS_SPI_NSS(NSS) (((NSS) == SPI_NSS_Soft) || \
  7.                          ((NSS) == SPI_NSS_Hard))
复制代码

SPI_BaudRate_Prescaler

  1. /** @defgroup SPI_BaudRate_Prescaler
  2.   * @{
  3.   */

  4. #define SPI_BaudRatePrescaler_2         ((uint16_t)0x0000)
  5. #define SPI_BaudRatePrescaler_4         ((uint16_t)0x0008)
  6. #define SPI_BaudRatePrescaler_8         ((uint16_t)0x0010)
  7. #define SPI_BaudRatePrescaler_16        ((uint16_t)0x0018)
  8. #define SPI_BaudRatePrescaler_32        ((uint16_t)0x0020)
  9. #define SPI_BaudRatePrescaler_64        ((uint16_t)0x0028)
  10. #define SPI_BaudRatePrescaler_128       ((uint16_t)0x0030)
  11. #define SPI_BaudRatePrescaler_256       ((uint16_t)0x0038)
  12. #define IS_SPI_BAUDRATE_PRESCALER(PRESCALER) (((PRESCALER) == SPI_BaudRatePrescaler_2) || \
  13.                                               ((PRESCALER) == SPI_BaudRatePrescaler_4) || \
  14.                                               ((PRESCALER) == SPI_BaudRatePrescaler_8) || \
  15.                                               ((PRESCALER) == SPI_BaudRatePrescaler_16) || \
  16.                                               ((PRESCALER) == SPI_BaudRatePrescaler_32) || \
  17.                                               ((PRESCALER) == SPI_BaudRatePrescaler_64) || \
  18.                                               ((PRESCALER) == SPI_BaudRatePrescaler_128) || \
  19.                                               ((PRESCALER) == SPI_BaudRatePrescaler_256))
复制代码

SPI_MSB_LSB_transmission

  1. /** @defgroup SPI_MSB_LSB_transmission
  2.   * @{
  3.   */

  4. #define SPI_FirstBit_MSB                ((uint16_t)0x0000)
  5. #define SPI_FirstBit_LSB                ((uint16_t)0x0080)
  6. #define IS_SPI_FIRST_BIT(BIT) (((BIT) == SPI_FirstBit_MSB) || \
  7.                                ((BIT) == SPI_FirstBit_LSB))
复制代码

SPI_I2S_Mode

  1. /** @defgroup SPI_I2S_Mode
  2.   * @{
  3.   */

  4. #define I2S_Mode_SlaveTx                ((uint16_t)0x0000)
  5. #define I2S_Mode_SlaveRx                ((uint16_t)0x0100)
  6. #define I2S_Mode_MasterTx               ((uint16_t)0x0200)
  7. #define I2S_Mode_MasterRx               ((uint16_t)0x0300)
  8. #define IS_I2S_MODE(MODE) (((MODE) == I2S_Mode_SlaveTx) || \
  9.                            ((MODE) == I2S_Mode_SlaveRx) || \
  10.                            ((MODE) == I2S_Mode_MasterTx)|| \
  11.                            ((MODE) == I2S_Mode_MasterRx))
复制代码

SPI_I2S_Standard


  1. /** @defgroup SPI_I2S_Standard
  2.   * @{
  3.   */

  4. #define I2S_Standard_Phillips           ((uint16_t)0x0000)
  5. #define I2S_Standard_MSB                ((uint16_t)0x0010)
  6. #define I2S_Standard_LSB                ((uint16_t)0x0020)
  7. #define I2S_Standard_PCMShort           ((uint16_t)0x0030)
  8. #define I2S_Standard_PCMLong            ((uint16_t)0x00B0)
  9. #define IS_I2S_STANDARD(STANDARD) (((STANDARD) == I2S_Standard_Phillips) || \
  10.                                    ((STANDARD) == I2S_Standard_MSB) || \
  11.                                    ((STANDARD) == I2S_Standard_LSB) || \
  12.                                    ((STANDARD) == I2S_Standard_PCMShort) || \
  13.                                    ((STANDARD) == I2S_Standard_PCMLong))
复制代码

SPI_I2S_Data_Format

  1. /** @defgroup SPI_I2S_Data_Format
  2.   * @{
  3.   */

  4. #define I2S_DataFormat_16b              ((uint16_t)0x0000)
  5. #define I2S_DataFormat_16bextended      ((uint16_t)0x0001)
  6. #define I2S_DataFormat_24b              ((uint16_t)0x0003)
  7. #define I2S_DataFormat_32b              ((uint16_t)0x0005)
  8. #define IS_I2S_DATA_FORMAT(FORMAT) (((FORMAT) == I2S_DataFormat_16b) || \
  9.                                     ((FORMAT) == I2S_DataFormat_16bextended) || \
  10.                                     ((FORMAT) == I2S_DataFormat_24b) || \
  11.                                     ((FORMAT) == I2S_DataFormat_32b))
复制代码

SPI_I2S_MCLK_Output

  1. /** @defgroup SPI_I2S_MCLK_Output
  2.   * @{
  3.   */

  4. #define I2S_MCLKOutput_Enable           ((uint16_t)0x0200)
  5. #define I2S_MCLKOutput_Disable          ((uint16_t)0x0000)
  6. #define IS_I2S_MCLK_OUTPUT(OUTPUT) (((OUTPUT) == I2S_MCLKOutput_Enable) || \
  7.                                     ((OUTPUT) == I2S_MCLKOutput_Disable))
复制代码

SPI_I2S_Audio_Frequency

  1. /** @defgroup SPI_I2S_Audio_Frequency
  2.   * @{
  3.   */

  4. #define I2S_AudioFreq_192k               ((uint32_t)192000)
  5. #define I2S_AudioFreq_96k                ((uint32_t)96000)
  6. #define I2S_AudioFreq_48k                ((uint32_t)48000)
  7. #define I2S_AudioFreq_44k                ((uint32_t)44100)
  8. #define I2S_AudioFreq_32k                ((uint32_t)32000)
  9. #define I2S_AudioFreq_22k                ((uint32_t)22050)
  10. #define I2S_AudioFreq_16k                ((uint32_t)16000)
  11. #define I2S_AudioFreq_11k                ((uint32_t)11025)
  12. #define I2S_AudioFreq_8k                 ((uint32_t)8000)
  13. #define I2S_AudioFreq_Default            ((uint32_t)2)

  14. #define IS_I2S_AUDIO_FREQ(FREQ) ((((FREQ) >= I2S_AudioFreq_8k) && \
  15.                                  ((FREQ) <= I2S_AudioFreq_192k)) || \
  16.                                  ((FREQ) == I2S_AudioFreq_Default))
复制代码

SPI_I2S_Clock_Polarity

  1. /** @defgroup SPI_I2S_Clock_Polarity
  2.   * @{
  3.   */

  4. #define I2S_CPOL_Low                    ((uint16_t)0x0000)
  5. #define I2S_CPOL_High                   ((uint16_t)0x0008)
  6. #define IS_I2S_CPOL(CPOL) (((CPOL) == I2S_CPOL_Low) || \
  7.                            ((CPOL) == I2S_CPOL_High))
复制代码

SPI_I2S_DMA_transfer_requests

  1. /** @defgroup SPI_I2S_DMA_transfer_requests
  2.   * @{
  3.   */

  4. #define SPI_I2S_DMAReq_Tx               ((uint16_t)0x0002)
  5. #define SPI_I2S_DMAReq_Rx               ((uint16_t)0x0001)
  6. #define IS_SPI_I2S_DMAREQ(DMAREQ) ((((DMAREQ) & (uint16_t)0xFFFC) == 0x00) && ((DMAREQ) != 0x00))
复制代码

SPI_NSS_internal_software_management

  1. /** @defgroup SPI_NSS_internal_software_management
  2.   * @{
  3.   */

  4. #define SPI_NSSInternalSoft_Set         ((uint16_t)0x0100)
  5. #define SPI_NSSInternalSoft_Reset       ((uint16_t)0xFEFF)
  6. #define IS_SPI_NSS_INTERNAL(INTERNAL) (((INTERNAL) == SPI_NSSInternalSoft_Set) || \
  7.                                        ((INTERNAL) == SPI_NSSInternalSoft_Reset))
复制代码

SPI_CRC_Transmit_Receive

  1. /** @defgroup SPI_CRC_Transmit_Receive
  2.   * @{
  3.   */

  4. #define SPI_CRC_Tx                      ((uint8_t)0x00)
  5. #define SPI_CRC_Rx                      ((uint8_t)0x01)
  6. #define IS_SPI_CRC(CRC) (((CRC) == SPI_CRC_Tx) || ((CRC) == SPI_CRC_Rx))
复制代码

SPI_direction_transmit_receive

  1. /** @defgroup SPI_direction_transmit_receive
  2.   * @{
  3.   */

  4. #define SPI_Direction_Rx                ((uint16_t)0xBFFF)
  5. #define SPI_Direction_Tx                ((uint16_t)0x4000)
  6. #define IS_SPI_DIRECTION(DIRECTION) (((DIRECTION) == SPI_Direction_Rx) || \
  7.                                      ((DIRECTION) == SPI_Direction_Tx))
复制代码

SPI_I2S_interrupts_definition

  1. /** @defgroup SPI_I2S_interrupts_definition
  2.   * @{
  3.   */

  4. #define SPI_I2S_IT_TXE                  ((uint8_t)0x71)
  5. #define SPI_I2S_IT_RXNE                 ((uint8_t)0x60)
  6. #define SPI_I2S_IT_ERR                  ((uint8_t)0x50)
  7. #define I2S_IT_UDR                      ((uint8_t)0x53)
  8. #define SPI_I2S_IT_TIFRFE               ((uint8_t)0x58)

  9. #define IS_SPI_I2S_CONFIG_IT(IT) (((IT) == SPI_I2S_IT_TXE) || \
  10.                                   ((IT) == SPI_I2S_IT_RXNE) || \
  11.                                   ((IT) == SPI_I2S_IT_ERR))

  12. #define SPI_I2S_IT_OVR                  ((uint8_t)0x56)
  13. #define SPI_IT_MODF                     ((uint8_t)0x55)
  14. #define SPI_IT_CRCERR                   ((uint8_t)0x54)

  15. #define IS_SPI_I2S_CLEAR_IT(IT) (((IT) == SPI_IT_CRCERR))

  16. #define IS_SPI_I2S_GET_IT(IT) (((IT) == SPI_I2S_IT_RXNE)|| ((IT) == SPI_I2S_IT_TXE) || \
  17.                                ((IT) == SPI_IT_CRCERR)  || ((IT) == SPI_IT_MODF) || \
  18.                                ((IT) == SPI_I2S_IT_OVR) || ((IT) == I2S_IT_UDR) ||\
  19.                                ((IT) == SPI_I2S_IT_TIFRFE))
复制代码

SPI_I2S_flags_definition

  1. /** @defgroup SPI_I2S_flags_definition
  2.   * @{
  3.   */

  4. #define SPI_I2S_FLAG_RXNE               ((uint16_t)0x0001)
  5. #define SPI_I2S_FLAG_TXE                ((uint16_t)0x0002)
  6. #define I2S_FLAG_CHSIDE                 ((uint16_t)0x0004)
  7. #define I2S_FLAG_UDR                    ((uint16_t)0x0008)
  8. #define SPI_FLAG_CRCERR                 ((uint16_t)0x0010)
  9. #define SPI_FLAG_MODF                   ((uint16_t)0x0020)
  10. #define SPI_I2S_FLAG_OVR                ((uint16_t)0x0040)
  11. #define SPI_I2S_FLAG_BSY                ((uint16_t)0x0080)
  12. #define SPI_I2S_FLAG_TIFRFE             ((uint16_t)0x0100)

  13. #define IS_SPI_I2S_CLEAR_FLAG(FLAG) (((FLAG) == SPI_FLAG_CRCERR))
  14. #define IS_SPI_I2S_GET_FLAG(FLAG) (((FLAG) == SPI_I2S_FLAG_BSY) || ((FLAG) == SPI_I2S_FLAG_OVR) || \
  15.                                    ((FLAG) == SPI_FLAG_MODF) || ((FLAG) == SPI_FLAG_CRCERR) || \
  16.                                    ((FLAG) == I2S_FLAG_UDR) || ((FLAG) == I2S_FLAG_CHSIDE) || \
  17.                                    ((FLAG) == SPI_I2S_FLAG_TXE) || ((FLAG) == SPI_I2S_FLAG_RXNE)|| \
  18.                                    ((FLAG) == SPI_I2S_FLAG_TIFRFE))
复制代码

03. 相关函数
  1. /* Exported macro ------------------------------------------------------------*/
  2. /* Exported functions --------------------------------------------------------*/

  3. /*  Function used to set the SPI configuration to the default reset state *****/
  4. void SPI_I2S_DeInit(SPI_TypeDef* SPIx);

  5. /* Initialization and Configuration functions *********************************/
  6. void SPI_Init(SPI_TypeDef* SPIx, SPI_InitTypeDef* SPI_InitStruct);
  7. void I2S_Init(SPI_TypeDef* SPIx, I2S_InitTypeDef* I2S_InitStruct);
  8. void SPI_StructInit(SPI_InitTypeDef* SPI_InitStruct);
  9. void I2S_StructInit(I2S_InitTypeDef* I2S_InitStruct);
  10. void SPI_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState);
  11. void I2S_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState);
  12. void SPI_DataSizeConfig(SPI_TypeDef* SPIx, uint16_t SPI_DataSize);
  13. void SPI_BiDirectionalLineConfig(SPI_TypeDef* SPIx, uint16_t SPI_Direction);
  14. void SPI_NSSInternalSoftwareConfig(SPI_TypeDef* SPIx, uint16_t SPI_NSSInternalSoft);
  15. void SPI_SSOutputCmd(SPI_TypeDef* SPIx, FunctionalState NewState);
  16. void SPI_TIModeCmd(SPI_TypeDef* SPIx, FunctionalState NewState);

  17. void I2S_FullDuplexConfig(SPI_TypeDef* I2Sxext, I2S_InitTypeDef* I2S_InitStruct);

  18. /* Data transfers functions ***************************************************/
  19. void SPI_I2S_SendData(SPI_TypeDef* SPIx, uint16_t Data);
  20. uint16_t SPI_I2S_ReceiveData(SPI_TypeDef* SPIx);

  21. /* Hardware CRC Calculation functions *****************************************/
  22. void SPI_CalculateCRC(SPI_TypeDef* SPIx, FunctionalState NewState);
  23. void SPI_TransmitCRC(SPI_TypeDef* SPIx);
  24. uint16_t SPI_GetCRC(SPI_TypeDef* SPIx, uint8_t SPI_CRC);
  25. uint16_t SPI_GetCRCPolynomial(SPI_TypeDef* SPIx);

  26. /* DMA transfers management functions *****************************************/
  27. void SPI_I2S_DMACmd(SPI_TypeDef* SPIx, uint16_t SPI_I2S_DMAReq, FunctionalState NewState);

  28. /* Interrupts and flags management functions **********************************/
  29. void SPI_I2S_ITConfig(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT, FunctionalState NewState);
  30. FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG);
  31. void SPI_I2S_ClearFlag(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG);
  32. ITStatus SPI_I2S_GetITStatus(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT);
  33. void SPI_I2S_ClearITPendingBit(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT);
复制代码

04. 结构体封装
  1. /**
  2.   * @brief Serial Peripheral Interface
  3.   */

  4. typedef struct
  5. {
  6.   __IO uint16_t CR1;        /*!< SPI control register 1 (not used in I2S mode),      Address offset: 0x00 */
  7.   uint16_t      RESERVED0;  /*!< Reserved, 0x02                                                           */
  8.   __IO uint16_t CR2;        /*!< SPI control register 2,                             Address offset: 0x04 */
  9.   uint16_t      RESERVED1;  /*!< Reserved, 0x06                                                           */
  10.   __IO uint16_t SR;         /*!< SPI status register,                                Address offset: 0x08 */
  11.   uint16_t      RESERVED2;  /*!< Reserved, 0x0A                                                           */
  12.   __IO uint16_t DR;         /*!< SPI data register,                                  Address offset: 0x0C */
  13.   uint16_t      RESERVED3;  /*!< Reserved, 0x0E                                                           */
  14.   __IO uint16_t CRCPR;      /*!< SPI CRC polynomial register (not used in I2S mode), Address offset: 0x10 */
  15.   uint16_t      RESERVED4;  /*!< Reserved, 0x12                                                           */
  16.   __IO uint16_t RXCRCR;     /*!< SPI RX CRC register (not used in I2S mode),         Address offset: 0x14 */
  17.   uint16_t      RESERVED5;  /*!< Reserved, 0x16                                                           */
  18.   __IO uint16_t TXCRCR;     /*!< SPI TX CRC register (not used in I2S mode),         Address offset: 0x18 */
  19.   uint16_t      RESERVED6;  /*!< Reserved, 0x1A                                                           */
  20.   __IO uint16_t I2SCFGR;    /*!< SPI_I2S configuration register,                     Address offset: 0x1C */
  21.   uint16_t      RESERVED7;  /*!< Reserved, 0x1E                                                           */
  22.   __IO uint16_t I2SPR;      /*!< SPI_I2S prescaler register,                         Address offset: 0x20 */
  23.   uint16_t      RESERVED8;  /*!< Reserved, 0x22                                                           */
  24. } SPI_TypeDef;
复制代码



收藏 评论0 发布时间:2022-6-16 18:00

举报

0个回答
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版