Jump to content
  • 0

I2C Write command is always 'true'


PabloFocus

Question

Hi,

I'm running an I2C script to find the connected devices in the bus, but it "detects" devices that are not connected. I'm attaching part of the script I'm running (is the protocol example code adapted for script window) an its output.

image.png.be965dc9057aa8c7aa12f4e13b38003f.png

 

image.png.d70b471f761811a924f42064582178b4.png

Any idea of what's happening or how to solve this?

I'm using WaveForms 3.22.20 on Windows 11 and an AD2 for this test.

Regards,

P

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

I found something "crazy" about this.

This is the code I'm running:

image.png.e40c8f0a214bb492f6fe950a0bcb0241.png

In another window I have the next setup:

image.thumb.png.6cfa70be9554041c2fa4e634178b938e.png

If I use the debugger Logic Analyzer the result of the protocol.i2c.write function is always "true"

image.thumb.png.9feb4808bada80d6d7db7807a6a5d4af.png

BUT when this opion is unchecked:

image.thumb.png.028d696683ac85aeaf0f3f041259beba.png

The result of the scipt is correct:

image.thumb.png.36b88b11ff2003bfe5c79ab980bd6f5d.png

What is happening here? is this a known issue I wasn't aware of? where can I read about them to avoid further problems with this?

 

Regards,

P

Link to comment
Share on other sites

  • 0

Hi @PabloFocus

Leave the 'clock stretching' checked unless you really need the simple pattern mode.
I let this option in front for backward compatibility, since the 'no stretch' mode was the first implemented one, but now I may have to hide this option.

image.png

Link to comment
Share on other sites

  • 0

Hi @PabloFocus

Protocol instrument does not receive/read data when "Debug with Logic Analyzer. No Data Reception!" is checked.
To be able to debug more script, custom code, I tried setting the functions to return success in this case.

image.png

image.png

Link to comment
Share on other sites

  • 0

This also happens for script window? I'm not using the script tab from protocol, but the general script window. I only enable or disable the 'debug with logic analyzer' from the protocol tab so "it works" the I2C protocol in the script window.

Sorry for not being clear enough, To reproduce the error I'm facing is:

1. enable the 'Debug with logic analyzer' from the protocol window.

2. run I2C device detection script in the general script window.

3. disable the 'Debug with logic analyzer' from the protocol window.

4. Run the I2C device detection script in the general script window.

At this point you should see different reactions from both runs.

Link to comment
Share on other sites

  • 0

Hi @attila,

Exactly, as you can see when 'Debug with Logic Analyzer' the script finds that all devices/addresses are connected to the bus, which is false. This only works correctly when you disable 'Debug with Logic Analyzer'. Is this a known issue? shouldn't be possible to run the script correctly even when logic analyzer is enabled?

Link to comment
Share on other sites

  • 0

Hi @attila,

Ok, I guess I get it now. So it doesn;t matter if it's the protocol or script window if 'Debug with Logic Analyzer' is enabled, it will not receive data and act as if everything is OK, right?

Last question, is there any way to prematurely finish a script without an error/warning? I'm doing:

if(!Tools.question("continue?")) return;

But this is a syntax error, which cause an 'abort' situation.

 

Regards,

P

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...