SigmaStudio ADAU145x I2C Bitrate below 400 kHz

I have reached a disconnect between your documentation and your program.

The datasheet for the ADAU145x says the Master Control Port set to I2C communication can support 20-400 kHz and the toolbox help wiki "Master Control Port Runtime Sequential Write (ADAU145x)" says the range is "20 kHz - 400 kHz" however the widget in SigmaStudio version 4.5 gives me options of '400 kHz', '800 kHz', '1000 kHz'.

I am trying to control a device that can only be communicated at <100 kHz. Is there a patch coming?

  • +1
    •  Analog Employees 
    on May 22, 2020 2:55 PM

    Hello JWhite,

    This is a great observation. The Sigma350 parts are capable of running at 1MHz for I2C so I guess when the programmers made the change they kept it at three choices and did not just expand it for the faster speeds. I will put in a request but it will be a while before this gets done. 

    There is a work-around if you want to hack into the parameters for the cell. It is a bit convoluted but can be done. 

    There is a parameter for the I2C_Speed. Here it is in the params window:

    Now I wish it were as simple as putting in a number like 80kHz but it is not. Here are the details of what is in this parameter: 

    Keep in mind I do not have the full internal documentation so some of this I do not have the answer to. 

    It is a 32 bit memory location and as far as I know bits 25 to 31 are unused and should be zero. 

    Bit 24 is the fast/slow mode. It is always set to fast. I do not know what changes when slow is selected. 

    Bit 23 is the I2C enable... set it to 1 to enable. 

    Now the fun part. The rest of the bits are three variables. 

    One is a prescaler that divides down the system clock. Note that in a ADAU1450 it is half speed. 

    This divided clock is used to produce the I2C clock by counting the number of cycles it is high and the number of cycles it is low. 

    Therefore the other two variables is the number of clocks cycles the I2C clock is high and the other variable is how long it is low. 

    In my screenshot you will see it has this for the parameter:

    0x 01 9D 09 10

    So stripping off the 24th and 23rd bit you are left with:

    0x 00 1D 09 10

    So the prescaler is 0x1D (This is a 7-bit field size)

    The number of clock ticks that the I2C clock is hi is 9 ( This is an 8-bit field size)

    The number of clock ticks that the I2C is low is 10 (This is an 8-bit field size)

    So the entire I2C clock period is 19 ticks of the presacaled system clock. 

    So this is what the result should be:

    294.912MHz / 29 = 10.16937931 MHz. 

    This divided by 19 = ~535kHz I2C clock speed. 

    In my internal documentation it says to use 47 and 53 for 100kHz with a prescaler of 30. This gives you 98.3kHz result.

    and to use  9, 16 for 400kHz with a prescaler of 30. This gives you 393kHz result. 

    I do not know why they did not suggest to use 50 and 50 instead of 47 and 53 for the high a low counters but there must be a reason. These numbers will produce a 47/53 duty cycle. 

    Anyhow, so you can stuff in your own values into this parameter and operate the serial port at the speed you desire. If you have a system controller then you can directly do this. I suspect you do not since you want the DSP to read and control another device. In that case you can use a parameter update cell to do this from within the DSP program. We can discuss those details later if you need them. 

    I hope you were able to follow this. 

    Dave T

  • This worked very well, though I have to rewrite the values every time I reload the code while in the IDE it gets me past this issue.

    Thank you

  • 0
    •  Analog Employees 
    on May 25, 2020 8:16 PM in reply to JWhite

    Hello JWhite,

    Have a look at this project. It uses a DC cell to update a parameter. You can set this up to update the I2C_Speed parameter. The only little thing with using this parameter update cell is that you have to compile the project before the parameter selection pull down window is populated. Then select the I2C_speed, it may be a long list of parameters if your project is large. 

    Now your project will be self-sufficient. 

    Dave T

    5545.ADAU1452 Parameter Update Selecting an