Changing control register through mmio for ps iic

Is there any possibility to change ps iic frequency through changing control reg value through pynq mmio?

Currently PS IIC (default zcu104 pynq image) is sending 400KHz signal, I’ve connected a device to it which support only 100khz. Is there anyway around without going through changing device tree, dtb or building the image again?

I’ve tried with following code but nothings happening:

mmio = MMIO(0xFF0200000, 0x100)
mmio.write(0, 0xC00E)

Thank you for your support.

Hi there,

It looks like the correct way to interact with the register, and from what I can tell it appears that the divisor_a and divisor_b bits are being set correctly. Have you tried using the MMIO to read the register after setting it to make sure that it is actually being set?

In the TRM it says that when altering the I2C clock you need to check to make sure that there is no data being transferred by checking the Transfer_Size register (offset 0x14). Can you read this register before setting the clocks to make sure that it is 0?

All the best,

hi Shane,
Actually my first try was reading the address, and it was something like 9b993332, i have 'or’ed with 15-16bit as i need to divide by 4. (set to something like 9b99F332). But later on i tried the other option directly placing 0x0000C00E.
All the register i could read giving some strange values which is definitely not related to i2c register defined in corresponding website (here). Even setting up the registers to zero not stopping the i2c to send or receiving. I am assuming, we can’t access those register via MMIO or it has no affect after boot.

I’m not 100% sure. But I think in order to access the registers in this address range you need to allow it in the processing system config when the creating the overlay.

When you have IPI open in Vivado, right click on the processing system and go to recustomise IP. That will open up the PS configuration window where you can select “Switch to Advanced Mode” at the top. Then an option “Isolation Configuration” should appear. Here for the relevant address range you can select “Enable Isolation”, then from there you can make the appropriate address range that you want to read and write to “non-secure”. I’ve attached an image for what the menu looks like for me.

You then need to regenerate that overlay and load into onto your device and then try reading/writing to the registers in that range.

Again, not sure if this the correct way to go about it. In older versions of Vivado there was a button to enable access to the SLCR (system-level control registers) which used to do this. I think the Isolation Configuration is the newer and better version of that.

Hope this helps, be interested to hear if it works for you!

All the best,

1 Like

Hi Shane,
Thank you for sharing the information. There is no available option for iic nor the register range I need to change.