EmbDev.net

Forum: FPGA, VHDL & Verilog Lattice MACHXO2 EFB i2c. No activity in simulation


Author: Antony Mathew (antony_mat)
Posted on:

Rate this post
0 useful
not useful
Hi all
 Perhaps someone with Lattice experience can answer this for me. I am 
building a design on a MachXO2 using the EFB for I2C MASTER 
communication
 I builtmy own state machine for writing and reading to the wishbone 
bus.

I have success in Reading and Writing EFB registers VIA WISHBONE and 
have properly written all registers like TXDR, Command Register, Control 
Register of Secondary i2c . But in simulation i dont see any kind of 
activity in SCL and SDA lines from EFB primitive block...

Both lines are always in High Impedence (Blue in Modelsim, Green if 
Aldec Simulator Used).
In Test Bench i do
1. An initial Reset
2. Enable I2c core by writing 0x80 to 0x4a register(Control)
3. Write Clock Prescale Registers 0x4c and 0x4d with proper value
4. Read back and verified these registers
5. Wrote Data 0xF1to TXDR register
6. Issued 0x94 to Command Register for a (Start + Write)

But i dont see any activity in SCL , SDA liness....

Am i missing something here.. Any help would be very helpful... 
Thanks....


Device : MACHXO2-7000
Tool : Lattice Diamond 3.1.0.96 (64 bit)

Author: Lattice User (Guest)
Posted on:

Rate this post
0 useful
not useful
In case you are using verilog, try to add to your testbench toplevel.
assign ( pull1, strong0 ) SCL = 1'b1;
assign ( pull1, strong0 ) SDA = 1'b1;

This simulates the pullup resistors.

Author: Antony Mathew (antony_mat)
Posted on:

Rate this post
0 useful
not useful
thank you for the reply... i am using vhdl for RTL.. will try to mimic 
pull up in testbench as u suggested.

But my another doubt is that even if we dont use this pull up , we 
should be able to  see the activity of SCL and SDA as between 'Z' and 
'0'.

Please correct me if i am wrong in this concept...

Author: Duke Scarring (Guest)
Posted on:

Rate this post
0 useful
not useful
Antony Mathew wrote:
> Am i missing something here.. Any help would be very helpful...
> Thanks....
Is your code top secret, or can you share your code?
In the latter case I can give it a try on my simulator...

Duke

Author: Antony Mathew (antony_mat)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Duke Scarring wrote:
> Antony Mathew wrote:
>> Am i missing something here.. Any help would be very helpful...
>> Thanks....
> Is your code top secret, or can you share your code?
> In the latter case I can give it a try on my simulator...
>
> Duke

Ok duke .. thank you for the effort
please see the attached .zip containing project

/rtl contains the user logic wishbone master and a top module to contain 
the efb block and user wishbone master

/tb contains the test bench which initiates the read/write using user 
wishbone                    master

/syn contains the lattice diamond project

/ipcore contains the efb i2c ipexpress generated files

/sim contains a 'wishbone.do' which can be used for simulation if u are 
using modelsim

: Edited by User
Author: Antony Mathew (antony_mat)
Posted on:

Rate this post
0 useful
not useful
Lattice User wrote:
> In case you are using verilog, try to add to your testbench toplevel.
>
>
> assign ( pull1, strong0 ) SCL = 1'b1;
> assign ( pull1, strong0 ) SDA = 1'b1;
> 
>
> This simulates the pullup resistors.

Hi Lattice User
I tried as u told... now Issue is solved i guess...

Below lines added to VHDL testbench
-- Mimic Weak Pullup Resistors on i2c lines 
 i2c_sec_scl_s <= 'H'; 
 i2c_sec_sda_s <= 'H';

Now i can see SDA, SCL lines toggling properly as per data in TXDR 
register

Thank you all for the support....

: Edited by User

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.