I am running tests with the Aardvark I2C/SPI Host Adapter using the Aardvark API Software. I have a question about the API Master Write-Read command aa_i2c_write_read. I input eight values using Arg 8 (in_data) to an array, but when I display array[0] and [1] to different elements, they show the same value. Let’s say I input 4 bytes, {00,11,22,33} - what is the data sequence – what exactly should I read back?
Here are snippets of the code I’m using:
Here’s the captured data:
Here’s another question, I’m not sure what Arg 7 and Arg 9 represent. I assume Arg 7 sets the number of bytes I want to read – is that correct? Can you define what all those arguments indicate?
Response from Technical Support:Thanks for your questions! It looks like the data you want to read may not be transmitted over the bus. In addition to the meaning of the arguments and how to read the data, we have a tip for making sure the slave response data is being transmitted over the bus.
The argument data_in within the API is actually a pointer to the data or an array that is being read from the slave. In your code, make sure the contents are saved and read back from an array and not some other data structure. For more information, please refer to the API examples using the data_in argument, as well as the API Documentation section in the Aardvark I2C/SPI Host Adapter User Manual.
We recommend confirming if the data from the slave is actually being read or available on the bus. You can easily do that by monitoring the bus with a non-intrusive protocol analyzer, such as the Beagle I2C/SPI Protocol Analyzer.
Here are the descriptions of each argument:
API software updates Arg 9 with the value of the number of bytes that were read. For example, if you received AA BB CC as the slave response, then Arg 9 would be updated as 3, which indicates 3 bytes of data were received. To verify if your slave actually read the data, you can check the value acquired in Arg 9.
Additional resources that you may find helpful include the following:
We hope this answers your questions. If you have other questions about our host adapters or other Total Phase products, feel free to email us at sales@totalphase.com. You can also request a demo that is specific for your application.