STM32 F303RE SPI using HAL - API explanation - interfacing MAX7219 - 8*8 led matrix driver

 Step 1:

Create project in STM32 cube MX

Enable SPI 1

Configure SPI 1 as follows 

Max7219 timing diagram and data format


Max 7219 register address details:

a

a

Step 2: Code implementation

 Declare SPI_HandleTypeDef object for SPI 1 as shown below

SPI_HandleTypeDef hspi1; 

Use  HAL_SPI_Transmit( ) to send data to MAX7219

 

      HAL_SPI_Transmit( ) arguments  

  param 1:  hspi pointer to a SPI_HandleTypeDef structure that contains
                 the configuration information for SPI module.
  param  2: pData pointer to data buffer
  param  3: Size amount of data to be sent
  param  4: Timeout Timeout duration




Comments