Lattice MACHXO2 EFB i2c. No activity in simulation

OP #3840448
Rate this post
• ▲ 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)
OP #3841564
Rate this post
• ▲ 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...
OP #3841583
Rate this post
• ▲ 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
Attached files:
OP #3841694
Rate this post
• ▲ useful
▼ not useful
Lattice User wrote:
> In case you are using verilog, try to add to your testbench toplevel.
>
>
1
> assign ( pull1, strong0 ) SCL = 1'b1;
2
> assign ( pull1, strong0 ) SDA = 1'b1;
3
>
>
> 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
1
-- Mimic Weak Pullup Resistors on i2c lines 
2
 i2c_sec_scl_s <= 'H'; 
3
 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....

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.