How can one change the SPI timing property that deals
with the "sample point" setting?
Currently, there are only two options: sample at END or MIDDLE
The device i am using ADXL345 accelerometer calls for sampling the
data at the trailing edge of the clock...
You can edit the properties of the sample point and it lists the options
as follows:
000 Middle
001 End
How does one define a third property such as trailing edge sampling?
From the ADXL345 datasheet...quote:
"Data is updated on the falling edge of SCLK and should be sampled on the rising edge of SCLK."
Thanx
Mark
SPI Properties
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: SPI Properties
Hi Mark,
I think that the "Trailing Edge" is equivalent to "Sample At End".
I think that the "Trailing Edge" is equivalent to "Sample At End".
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode v5 User
- Posts: 118
- Joined: Thu Sep 17, 2009 1:30 pm
- Has thanked: 3 times
- Been thanked: 11 times
- Contact:
Re: SPI Properties
Hi Ben,
I think you are referring to the clock phase....but i need to change
sample point.
The only options are middle or end for sample point, but i need
to have a 3rd option which is a "begin" or rising edge of clock, of which there is
no option....
I think you are referring to the clock phase....but i need to change
sample point.
The only options are middle or end for sample point, but i need
to have a 3rd option which is a "begin" or rising edge of clock, of which there is
no option....
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: SPI Properties
Mark,
Flowcode setting 'Sample Point' set to 'End' is equivalent to what you called 'trailing edge' in your first message. From the description you also need 'Clock Polarity' set to 'Idle High' and "Clock Phase" set to "Trailing Edge".
Best regards,
Jac
Flowcode setting 'Sample Point' set to 'End' is equivalent to what you called 'trailing edge' in your first message. From the description you also need 'Clock Polarity' set to 'Idle High' and "Clock Phase" set to "Trailing Edge".
Best regards,
Jac
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Flowcode v5 User
- Posts: 118
- Joined: Thu Sep 17, 2009 1:30 pm
- Has thanked: 3 times
- Been thanked: 11 times
- Contact:
Re: SPI Properties
Hi Jac,
Hmmm, no i think everyone is not reading my messages
properly...
I am referring to the sample point...it needs a setting of "begin"
or in other words "rising edge" ...of the clock signal
This involves a SPI read operation, when the data is SAMPLED
Currently, the only settings for sample point are "middle" and "end"
of the clock signal....i need a setting that will be for better words
a "begin" or "rising edge"...this would be a 3rd option setting but
does not exist
Hmmm, no i think everyone is not reading my messages
properly...
I am referring to the sample point...it needs a setting of "begin"
or in other words "rising edge" ...of the clock signal
This involves a SPI read operation, when the data is SAMPLED
Currently, the only settings for sample point are "middle" and "end"
of the clock signal....i need a setting that will be for better words
a "begin" or "rising edge"...this would be a 3rd option setting but
does not exist
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: SPI Properties
Mark,
I even took the trouble of reading the original data sheet.
The clock for your device is idle high, the sample needs to be taken when the clock goes from low to high, the rising edge of the clock signal, that means in the middle of a clock cycle, not at the start.
EDIT: sample should be taken in the middle of the cycle, not at the end. My mistake. Check Wikipedia the diagram at the right show the correct waveform for CPOL=1 and CPHA=1 (sample at blue line) (this can be found in the data sheet at page 15). For PIC this translates to CKP=1, SMP=0 and CKE=0. In Flowcode these settings are: Clock Polarity = Idle High, Clock Phase = Leading Edge and Sample Point = Middle.
I even took the trouble of reading the original data sheet.
The clock for your device is idle high, the sample needs to be taken when the clock goes from low to high, the rising edge of the clock signal, that means in the middle of a clock cycle, not at the start.
EDIT: sample should be taken in the middle of the cycle, not at the end. My mistake. Check Wikipedia the diagram at the right show the correct waveform for CPOL=1 and CPHA=1 (sample at blue line) (this can be found in the data sheet at page 15). For PIC this translates to CKP=1, SMP=0 and CKE=0. In Flowcode these settings are: Clock Polarity = Idle High, Clock Phase = Leading Edge and Sample Point = Middle.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Flowcode v5 User
- Posts: 118
- Joined: Thu Sep 17, 2009 1:30 pm
- Has thanked: 3 times
- Been thanked: 11 times
- Contact:
Re: SPI Properties
Hi Jac (Kersing),
That worked! Thank you very much....it seems it is sometimes bit
difficult to interpret the waveforms correctly and as such i will
need to study these setting more intently in future
And thank you for taking the time and effort to look at the datasheet
etc...
Many thanx
Mark
That worked! Thank you very much....it seems it is sometimes bit
difficult to interpret the waveforms correctly and as such i will
need to study these setting more intently in future
And thank you for taking the time and effort to look at the datasheet
etc...
Many thanx
Mark