Discussion:
Communication between 2 arduinos using I2C/SPI and Matlab Simulik
(too old to reply)
Mohsen
2016-11-09 00:08:03 UTC
Permalink
Hi,

I am trying to communicate between two arduino boards (a Feather and a Due). I am using Simulink for programming my boards, but from my understanding, the I2C/SPI blocks in the Arduniolib in simulink are designed for the arduino to be the master. Is there any code/trick out there so I can define an arduino as a slave board in Simulink? I am assuming if no such block exists, I should write my own S function block. Is anybody aware of such block. Please share if you have any solutions or experience you have about this.

Thanks in advance,
Mohsen
Sudeshna Bhattacharya
2016-11-15 06:23:03 UTC
Permalink
The SPI support in Simulink Support Package for Arduino is based on the official library: https://www.arduino.cc/en/Reference/SPI

Since the library itself does not support Slave Mode there is no Slave mode support in the Simulink Support Package.

In case of I2C the Slave is based on some interrupts. Currently no I2C Slave is supported by Simulink Support Package for Arduino Hardware.

You need to create your own device driver for the same. You can refer the below file exchange submission to get started:

https://www.mathworks.com/matlabcentral/fileexchange/39354-device-drivers
Post by Mohsen
Hi,
I am trying to communicate between two arduino boards (a Feather and a Due). I am using Simulink for programming my boards, but from my understanding, the I2C/SPI blocks in the Arduniolib in simulink are designed for the arduino to be the master. Is there any code/trick out there so I can define an arduino as a slave board in Simulink? I am assuming if no such block exists, I should write my own S function block. Is anybody aware of such block. Please share if you have any solutions or experience you have about this.
Thanks in advance,
Mohsen
m***@gmail.com
2017-06-20 17:57:56 UTC
Permalink
Hi Mohsen,

Have you found a solution for your problem? If yes, I am interesting to it.

In fact, I want to communicate between multiple Arduinos using I2C to share information so your question is really relevant.

Best regards,
Florian
r***@gmail.com
2017-11-29 10:05:18 UTC
Permalink
Post by Mohsen
Hi,
I am trying to communicate between two arduino boards (a Feather and a Due). I am using Simulink for programming my boards, but from my understanding, the I2C/SPI blocks in the Arduniolib in simulink are designed for the arduino to be the master. Is there any code/trick out there so I can define an arduino as a slave board in Simulink? I am assuming if no such block exists, I should write my own S function block. Is anybody aware of such block. Please share if you have any solutions or experience you have about this.
Thanks in advance,
Mohsen
Hello i have the same problem , if you find the solution can you please share it ?
Best regard
Redouane

Loading...