Jump to content
  • 0

Where can I find the specification for JavaScript I2C 'Write' function


Kota Uchida

Question

I'm trying to send I2C signals from Analog Discovery 2 to an I2C device.

I read an article I2C Protocol Viewer and the example worked. Next I modified the example code to fit my need. I found 'Write' function can't handle data more than 113 bytes.

Here the code that doesn't work:

DATA = []
for (i = 0; i < 113; i++) {
    DATA[i] = i
}
Write(1, DATA)

 

If I change 113 to 112, it works.

I want to read the specification of the Write function. In addition to that, I want to know other functions or APIs that can be used in this script in order to develop more complicated scripts.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi @Kota Uchida

The maxim number of Bytes is only visible in I2C/ Master mode. pic 1
I'll add a more visible information information for this, like it is for the Spy/Slave/RD. pic 2

Without "Clock Stretching" the 1st device configuration having 1Ki Patterns buffer supports up to 112 Bytes (+address) and with the 4th configuration 16Ki buffer up to 1819 Bytes transfers.
With the "Clock Stretching" checked it allows up to 1MB transfers. The data may be split based on the device buffer size at 9B (1Ki) or 151B (16Ki), having a few ms delay between the chunks. pic 3,4

image.png.1c743834abb44206616f5c1437da8096.png

image.png.b6631c6107c9a2ad92e7a642756e6ea4.png

image.png.636658abb0967cb216406da033ff2cd3.png

image.png.1efcaae0067a3fbfad1f4e6fafb11830.png

 

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