SPI receive - TI LAUNCHXL-F28379D
5 views (last 30 days)
Show older comments
Hi Friends,
I'm working in a control project using LAUNCHXL-F28379D. I have installed all the third-party software "TI ControlSuite 3.4.2 / TI CCS 8 / TI C2000ware 1.00.04" and the Simulink Embedded coder support package "Embedded Coder Support Package for Texas Instruments C2000 Processors - version 18.1.0".
I want to receive data from other controller using SPI communication.
To simulate the receiving data, I implemented a loop-back with physical connections: I used SPI-A as master mode to transmit data and SPI-B as slave mode to receive the data. See picture below
Also, see SPI config
The problem is: I always receive data 0 and the status is 0 !!!
what did I do wrong?
Thank you,
Fares Marjieh Control Engineer
0 Comments
Answers (1)
Aditya Padmanabha
on 25 May 2018
Hi Oleg,
Please use the latest update of the support package - "18.1.2" (in the MATLAB main window go to Add-Ons --> Check for Updates --> Hardware Support Packages) as we made recent changes to the SPI module.
In the above settings, looks like you are trying to use SPI in tri-wire mode. In tri-wire mode, we need to set TALK bit to 1 for transmitting the data and set TALK to 0 for receiving the data. But in our code, we are setting the TALK bit to 1 by default causing SPI to be in transmit mode always.
We are currently tracking this issue internally. I apologize for the inconvenience caused, we will work on this issue and fix it as soon as possible in the future support package updates.
I have a workaround to unblock you in the meantime. You can use the custom code with the SPI Transmit and Receive block to set the TALK bit to 1 or 0 before Transmit and Receive block. I have attached one example model for your reference.
Thanks,
Aditya
1 Comment
Zak Campbell
on 30 Apr 2020
Hello fellow C2000 users. I am wondering if the last comment made on this topic still stands as of April 2020. I am using embedded coder support for th C2000 version 19.2.2. I am in need of fixing the 3 wire communications issue I have, where, similar to the problem statement above, I am getting all zeros read out of the peripheral when I am seeing pretty clear data being read out on the o-scope.
Thanks,
Zak
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!