Problem with changing spi mode of Arduino Uno

4 views (last 30 days)
Stefan
Stefan on 2 Dec 2015
Edited: Stefan on 9 Dec 2015
Hi, I try to use the MATLAB Support Package for Arduino Hardware for SPI communication. I use Matlab 2015b and an Arduino Uno. When I try to change the spi mode it has no effect.
The code is like this:
a = arduino('COM7','Uno', 'Libraries', 'SPI')
dev = spidev(a, 'D10', 'mode', 3)
I checked the signals with a logic analyzer and the SCLK is always mode0 no matter which mode (0, 1, 2, or 3) I want to use.
Any idea?
  2 Comments
Madhu Govindarajan
Madhu Govindarajan on 2 Dec 2015
I am not particularly familiar with this topic, but according to this page https://www.arduino.cc/en/Reference/SPI it looks like the Clock is on Pin 13?
HTH
Stefan
Stefan on 8 Dec 2015
Edited: Stefan on 9 Dec 2015
That's right. Pin connection is correct and I checked the clock on pin 13 but it's always mode 0. For example see the image below. The data I transmitted is b'01010101. The mode I chose shall be 3 but it's not.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!