hithesh123
Full Member level 6
- Joined
- Nov 21, 2009
- Messages
- 324
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,298
- Location
- lax
- Activity points
- 3,548
I discourage you from using the SPI clock as the FPGA's system clock.
The signal quality and jitter will be very questinable.
This is the correct way to achieve the functionallity you want on an FPGA:
2. Create flags of the SPI clock's rising and falling edges.
With this approach, you'll be still using a single (high quality) clock edge.
signal sck_m : std_logic_vector(0 to 2);
signal sck_rise, sck_fall : std_logic;
...
process (reset,clk)
begin
if reset = '1' then
sck_m <= "000";
sck_rise <= '0';
sck_fall <= '0';
elsif rising_edge(clk) then
sck_m <= sck & sck_m(0 to 1);
end if;
end;
sck_rise <= sck_m(1) AND NOT sck_m(2);
sck_fall <= NOT sck_m(1) AND sck_m(2);
The synchronizer is required in front of the edge flag generation, using a delay chain of 3 FFs in total.
Code:signal sck_m : std_logic_vector(0 to 2); signal sck_rise, sck_fall : std_logic; ... process (reset,clk) begin if reset = '1' then sck_m <= "000"; sck_rise <= '0'; sck_fall <= '0'; elsif rising_edge(clk) then sck_m <= sck & sck_m(0 to 1); end if; end; sck_rise <= sck_m(1) AND NOT sck_m(2); sck_fall <= NOT sck_m(1) AND sck_m(2);
if rising_edge(clk) then
if sck_rise='1' then
sdata<=sdata(6 downto 0) & sdi;
elsif sck_fall='1'; then
sdo<=sdata(7)
end if;
end if;
Yes, that's the suggestion.So basically, I have to use sck_rise and sck_fall as enables to clock-in serial data?
You want to use your double synchronized SCLK as a system clock ??If I use the serial clock after running it thru a dual rank synchronizer, wouldn't it be significantly reliable.
Yes, that's the suggestion.
You want to use your double synchronized SCLK as a system clock ??
You have to be familiar with FPGA architecture to understand why that's a bad idea.
Manufacturers go long ways to ensure that their clock signals are balanced (reach all FFs at the same time). They dedicate special pins for the clock signals (global pins). These pins connect to special nets (global nets).
You suggest to take a weak DFF output (that doesn't go into a global net) and treat it as if it was a proper clock...I'm not saying that it won't work - it just isn't the correct solution.
The problem isn't if you can use sclk as a clock. That's well possible. The problem is about having multiple clock domains in your design and how to handle domain crossing.But what if I buffer the sclk signal using a Global clock buffer or a low skew buffer in the FPGA.
Why?? What are the benefits of such an approach??Thanks. But what if I buffer the sclk signal using a Global clock buffer or a low skew buffer in the FPGA.
I presume, the OP didn't intend to use SCK as the system clock. He considered to use it as a second clock which involves the discussed domain crossing problems.Another problem when using the SCLK is that it is generated by the master, and I think it has the power to stop the clock. That wont do your design much good...
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?