SPI receive block on F28335 connect with Arduino Nano timeout error

10 views (last 30 days)
I tried to use SPI communication to send data from Arduino Nano to F28335, configure Arduino as master and F28335 as slave.
I'm using C2000 embedded simulink block on my R2017a matlab. But when I run the model which can be run, I receive output status message from receiver block as
"2: Data not ready, a time out occur while the block was waiting to receive data".
and when I try sending data from Arduino (25 as integer), nothing is displayed on receiver side.
I'm not sure how to solve, maybe it's need to deal with clock signal. If anyone has suggestion it would be very appreciated.
Thank you so much
<<
>>

Answers (1)

Aditya Padmanabha
Aditya Padmanabha on 5 Jun 2018
Hi Jirada,
You need to ensure the SPI clock mode match properly between Arduino Nano and F28335. For example,
  • If you select Mode 1 in Arduino Nano, you need to select options Rising edge, No delay in F28335
  • If you select Mode 2 in Arduino Nano, you need to select options Falling edge, delay half cycle for F28335
to get the same SPI clock mode.
Ardunio boards - Mega 2560, Mega ADK, Uno, Nano 3.0, Micro and Leonardo uses 5V supply. Ensure that you use proper voltage level shift between Arduino and C2000 SPI pins for proper working of SPI.
Arduino boards - Due and MKR 1000 uses 3.3V supply. You can connect them directly to C2000 boards and get the SPI running.
Also ensure the Master and Slave is synchronized properly as discussed in https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/545531?c2000-as-spi-slave-message-synchronization. You can make use of SPI receive interrupt in F28335 to read the data.
Regards,
Aditya

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!