2019-04-05 08:19 AM
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
2019-04-05 08:56 AM
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.
2019-04-05 08:57 AM
If you only needs to exchange few data bytes, better use USART between both devices...
2019-04-05 10:33 AM
yes but i mean the Buffer has an adress in the Register or not ? so i can try with it in Simulink
2019-04-05 11:18 AM
There is no address register in SPI HW registers.
2019-04-05 12:53 PM
yes thats why i said "slave register address" and not "slave address register"