0

SPI Signal
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

SPI Signal

by ACCULOGIC on Tue Aug 20, 2019 3:45 pm

I am using "FT232H USB 2.0 to Parallel and Serial Interface Evaluation Board" for testing ADS1118IDGST.
I followed all the instructions in "Adafruit FT232H Breakout" document to setup the module.
I wrote a small piece of python to communicate with ADS1118IDGST through Adafruit FT232H Breakout. Here is my code:

import Adafruit_GPIO.FT232H as FT232H
FT232H.use_FT232H()
ft232h = FT232H.FT232H()
spi = FT232H.SPI(ft232h, cs=9, max_speed_hz=100000, mode=1, bitorder=FT232H.MSBFIRST)
spi.write([0xC5,0X8B])

I captured the signals on CS, SCLK, Din
- For writing two bytes, instead of 16 clocks there are 15 clocks.
- I selected mode 1 but the Data change on SCLK falling edge(In mode 1, data are changed on SCLK rising edge and data are read on SCLK falling edge)

I greatly appreciate your help

ACCULOGIC
 
Posts: 6
Joined: Tue Aug 20, 2019 12:30 pm

Re: SPI Signal

by adafruit_support_carter on Tue Aug 20, 2019 5:24 pm

What are you using to capture the signals?

adafruit_support_carter
 
Posts: 12975
Joined: Tue Nov 29, 2016 2:45 pm

Re: SPI Signal

by ACCULOGIC on Wed Aug 21, 2019 8:13 am

I am using "Tektronix MSO 3034 Mixed Signal Oscilloscope" for capturing the signals.

ACCULOGIC
 
Posts: 6
Joined: Tue Aug 20, 2019 12:30 pm

Re: SPI Signal

by ACCULOGIC on Wed Aug 21, 2019 10:10 am

Hi,
I attached the image of signals that has been captured by oscilloscope.
Thanks
Attachments
tek00000.png
The is an image of signals that has been captured by oscilloscope
tek00000.png (23.63 KiB) Viewed 150 times

ACCULOGIC
 
Posts: 6
Joined: Tue Aug 20, 2019 12:30 pm

Re: SPI Signal

by adafruit_support_carter on Wed Aug 21, 2019 1:13 pm

Which operating system option did you follow in the guide?

adafruit_support_carter
 
Posts: 12975
Joined: Tue Nov 29, 2016 2:45 pm

Re: SPI Signal

by adafruit2 on Wed Aug 21, 2019 1:41 pm

what if you send a 'fake' byte to start right after init, can do it without toggling CS, that might get the clock going in the right direction?

adafruit2
Site Admin
 
Posts: 18661
Joined: Fri Mar 11, 2005 7:36 pm

Re: SPI Signal

by ACCULOGIC on Wed Aug 21, 2019 3:01 pm

The PC has 64 bit operating system, Windows 10 Pro.
I sent a dummy data without toggling the CS. The result is the same as before.

ACCULOGIC
 
Posts: 6
Joined: Tue Aug 20, 2019 12:30 pm

Re: SPI Signal

by adafruit2 on Wed Aug 21, 2019 3:14 pm

what happens if you use the default mode?

adafruit2
Site Admin
 
Posts: 18661
Joined: Fri Mar 11, 2005 7:36 pm

Re: SPI Signal

by ACCULOGIC on Wed Aug 21, 2019 3:40 pm

Do you mean Mode 0?

I tried all three modes(0, 1, 2, and 3). The same result.

ACCULOGIC
 
Posts: 6
Joined: Tue Aug 20, 2019 12:30 pm

Re: SPI Signal

by adafruit2 on Wed Aug 21, 2019 4:00 pm

@carter you saw the same?

adafruit2
Site Admin
 
Posts: 18661
Joined: Fri Mar 11, 2005 7:36 pm

Re: SPI Signal

by adafruit_support_carter on Thu Aug 22, 2019 12:38 pm

Mode 0 seems to work for me. I ran through each mode, using test from first post. Results:

[EDIT] also note, test run with sudo python2 since guide is currently still Python 2

MODE 0
spi_test_mode0.jpg
spi_test_mode0.jpg (59.74 KiB) Viewed 70 times


MODE 1
spi_test_mode1.jpg
spi_test_mode1.jpg (60.07 KiB) Viewed 70 times


MODE 2
spi_test_mode2.jpg
spi_test_mode2.jpg (60.17 KiB) Viewed 70 times


MODE 3
spi_test_mode3.jpg
spi_test_mode3.jpg (60.47 KiB) Viewed 70 times


NOTE: Saleae SPI analyzer settings changed for each case to match mode
Code: Select all | TOGGLE FULL SIZE
MODE=0 -> CPOL=0, CPHA=0
MODE=1 -> CPOL=0, CPHA=1
MODE=2 -> CPOL=1, CPHA=0
MODE=3 -> CPOL=1, CPHA=1

adafruit_support_carter
 
Posts: 12975
Joined: Tue Nov 29, 2016 2:45 pm

Re: SPI Signal

by ACCULOGIC on Fri Aug 23, 2019 1:51 pm

It seems that I can not use this module in Mode 1. Right?

ACCULOGIC
 
Posts: 6
Joined: Tue Aug 20, 2019 12:30 pm

Re: SPI Signal

by adafruit_support_carter on Fri Aug 23, 2019 2:01 pm

Unfortunately, it does appear there is an issue with the current state of the driver. The current one is very soon to be deprecated, as is the entire repo it lives in. No ETA on when it will be available, but you can watch here:
https://github.com/adafruit/Adafruit_Blinka/issues/60
That is where the new/replacement driver for the FT232H will be added.

adafruit_support_carter
 
Posts: 12975
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.