cancel
Showing results for 
Search instead for 
Did you mean: 

2 STM32 Boards SPI

Samuel1
Associate III

Hallo,

2 STM32 μc (NucleoF767ZI and Nucleo F446RE) should communicate via SPI. The first µc is programmed with Simulink using the Nucleo Support Package. As it stands, the μc with the Support Package can only work as a master. Now I just want to send a number from 0-255 to the slave μc for testing. And see the message with debugging mode. According to the Simulink block parameter, the Slave address register must be entered.

Then i am going to measure the the Duty Cycle of a PWM signal and send to via spi to the Master µc in Simulink, so the µc will function as a Sensor.

So my question, is it possible that my SPI of the slave µc (e.g., SPI2) has an address?

/* USER CODE BEGIN 0 */
uint8_t Rx[2];
/* USER CODE END 0
 
  /* USER CODE BEGIN 2 */
__HAL_SPI_ENABLE(&hspi1);
  /* USER CODE END 2 */
 
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
    HAL_SPI_Receive(&hspi1,Rx,1,10);
    HAL_Delay(50);
  }
  /* USER CODE END 3 */
}

#SPI​ #Nucleo-f767zi​ #Simulink​ 

5 REPLIES 5
S.Ma
Principal

At hardware level SPI does not have addresses like I2C devices are.

If say someone decides that the first transmitted byte is called address, this is SW implementation.

Not specialist of Matlab, so only answering the peripheral related question only.

S.Ma
Principal

If you only needs to exchange few data bytes, better use USART between both devices...

Samuel1
Associate III

yes but i mean the Buffer has an adress in the Register or not ? so i can try with it in Simulink​

S.Ma
Principal

There is no address register in SPI HW registers.

Samuel1
Associate III

yes thats why i said "slave register address" and not "slave address register"