Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - i2c Start and stop detection

 
Thread Tools Search this Thread
Old 05-18-2009, 09:27 PM   #1
Default i2c Start and stop detection


Hi all

I am implementing the I2C Slave and I am using the I2C clock SCL for
detecting the start and stop condition . I am detecting the start and
stop successfully in simulation but i am not able to do the same in
the post synthesis scenario. More so I am getting a setup time
violation for the same in the timing analysis . I am running the I2C
at a very slow speed of 100KHz.

The code is below

process (SDA_IN, START_RST,rst)
begin
if rst ='1' then
STARTOP <='0';
-- elsif (START_RST = '1') then
-- STARTOP <= '0';
elsif (SDA_IN'event and SDA_IN = '0') then
STARTOP <= scl;
end if;
end process;
------------------------------------------------------------------------------
-- stop condition detection
process (RST, SCL, SDA_IN, STARTOP)
begin
if RST = '1' or SCL = '0' or STARTOP='1' then
STOPOP <= '0';
elsif SDA_IN = '1' and SDA_IN'event then
if SCL = '1' then
STOPOP <= '1';
end if ;

end if;
end process;

Can any one give me a reliable way to detect the start and stop
condition that the synthesis tool doesnot give any setup time
violation. I am not using a high clock for sampling as the requirement
is to use the SCL only. May be to save board resourse and space.

Help will be appreciated. I am using Altera max II CPLD and the
synthesis tool is quartus 9.0

Thanks

Vipul


VIPS
  Reply With Quote
Old 05-19-2009, 12:12 AM   #2
Mike Treseler
 
Posts: n/a
Default Re: i2c Start and stop detection
VIPS wrote:

> I am implementing the I2C Slave and I am using the I2C clock SCL for
> detecting the start and stop condition . I am detecting the start and
> stop successfully in simulation but i am not able to do the same in
> the post synthesis scenario.


That scenario requires a synchronous process
something like this:
....
begin
if reset = '1' then
init_regs;
elsif rising_edge(clock) then
update_regs;
end if;
update_ports;
end process;

> Help will be appreciated.


An i2c controller is a complex shift register
with case statements for bit and byte control.
A working design will require several
hundred lines of code.

Google a bit. This has been done.

-- Mike Treseler


Mike Treseler
  Reply With Quote
Old 05-19-2009, 02:19 PM   #3
VIPS
 
Posts: n/a
Default Re: i2c Start and stop detection
On May 18, 7:12*pm, Mike Treseler <mtrese...@gmail.com> wrote:
> VIPS wrote:
> > I am implementing the I2C Slave and I am using the I2C clock SCL for
> > detecting the start and stop condition . I am detecting the start and
> > stop successfully in simulation but i am not able to do the same in
> > the post synthesis scenario.

>
> That scenario requires a synchronous process
> something like this:
> ...
> begin
> * if reset = '1' then
> * * *init_regs;
> * elsif rising_edge(clock) then
> * * *update_regs;
> * end if;
> * update_ports;
> end process;
>
> > Help will be appreciated.

>
> An i2c controller is a complex shift register
> with case statements for bit and byte control.
> A working design will require several
> hundred lines of code.
>
> Google a bit. This has been done.
>
> * * * -- Mike Treseler


Thanks Mike for the reply . I have implemented the I2C slave as a
state machine and the start and stop condition in data going from
high to low when the clock is high . It is working fine in simulation
but i am stuck up in the start and stop detection condition as it is
asynchronous and on synthesis itis giving a setup time violation in
synthesis in quartus. This is the main issue as to design a ckt for
start and stop condition with I2C clock . I am not using oversampled
clock as it is desired to use the I2C clock


VIPS
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
STOP 0X000000ED error mencik General Help Related Topics 0 03-05-2008 03:29 PM
Printer Spooler stop maddy_o General Help Related Topics 0 09-25-2007 07:26 PM
Two Error messages after Windows XP Start up Annette MCTS 0 08-25-2007 06:30 AM
STOP: 0x000000ED occuring every few months Tony A+ Certification 2 07-19-2004 01:45 AM
folder opening on start up Bruce A+ Certification 2 12-27-2003 06:24 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46