Jump to content
  • 0

AD2 behaving as I2C slave


av_disp

Question

Hello,

I was wondering if there is a way to use AD2 as i2C slave ? It isn't a problem to use it as I2C master, it works as expected and is very useful for data exchange visualization. But somehow I have difficult time to figure out how to use it in slave mode, I assume it has to be some sort or script. But looking at the available script commands ( I am neither an expert in WF nor i2C communication) I cannot figure out how to do that.

Thanks.

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Hello,

I decided to use Pi 3B (pigpio lib, python) as a I2C slave and AD2 as master just to learn more about AD2 features and I2C protocol in general.

the script itself:
var ddd = []
if(Clear()!=true) return "I2C bus error. Check the pull-ups."
i_ret = Write(0x13, 116)
if( i_ret != 0) return i_ret; // "Device NAK";
//wait(0.1);
ddd = Read(0x13,10)
FileWriteBinary("~/Desktop/data2.bin", ddd);
return ddd

A simple scenario: AD2 sends a command from a script (100 kHz freq) , in 10-100 ms Pi (I2C slave) responds with 10 bytes of data, I want to capture the request/response data. What can be simpler? But the problem is that I am limited by the number of samples (16K at best).
First and foremost - I cannot use "Record" mode because I need to run the script (in "Record" mode this option is not available from I2C tab).

So, I have 16K samples max (with noise turned on I have only 8K), the bus speed is 100 kHZ, therefore I need the sample rate faster than 2XX kHz.
I noticed that the result greatly depends on the selected rate: odd numbers like 200, 300 kHz may/will yield some sensible results but 280 kHz, 310 kHz almost guarantied to lead to totally inadequate results.
With 300kHz rate, 8K samples I can cover only (1 / 300000) * 8192 = 27.3 ms or for 16K => 54ms, which no enough for this example.

What is more - many captures just contain incomplete/incorrect data but I think this is the result of low sampling rate (300 kHz). Some of them contain just captured request data, some - response data (and that is really weird since it means that request data _was sent but missed by AD2).

So, what is the right way to achieve this simple goal with AD2?


PS: I read about real-time sample compression used in different types of logic analyzers and I think that it could be a very nice solution to this type of problems and great improvement for AD2 - most of the time during that 10-100 ms time frame the state of signals don't change i.e. the state is static and therefore being compressed it would take very little space in the buffer. That would lead automatically to the longer observation period, using the same sampling rate. Simple and powerful...

Thanks.


Edited by av_disp
Just a small addition:
Link to comment
Share on other sites

  • 0
On 5/24/2017 at 9:57 AM, attila said:

Hi @av_disp,

Currently I2C slave is not supported in Protocol interface, only master mode.
You can use Logic Analyzer I2C interpreter for such purpose.

The next software version will bring I2C and SPI slave/spy features in Protocol interface.

Has this software been released?

Link to comment
Share on other sites

  • 0

Hi @attila

Do you know when the functionality will be provided to run the AD2 as an I2C slave? Here you have described that the logic analyzer provides the function. Could you please describe in more detail how this works? Thanks a lot!

On 5/24/2017 at 9:57 AM, attila said:

Hi @av_disp,

Currently I2C slave is not supported in Protocol interface, only master mode.
You can use Logic Analyzer I2C interpreter for such purpose.

The next software version will bring I2C and SPI slave/spy features in Protocol interface.

 

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...