Problem with I2C address 0x00

Hello,

The CapSense Click module is using Cypress CY8C201A0 chip, which has a default address of 0x00.
Using this address with TinyCLR 2.0 gives a timeout exception :

Le thread ‘’ (0x2) s’est arrêté avec le code 0 (0x0).
#### Exception System.Exception - CLR_E_TIMEOUT (1) ####
#### Message:
#### GHIElectronics.TinyCLR.Devices.I2c.Provider.I2cControllerApiWrapper::WriteRead [IP: 0000] ####
#### GHIElectronics.TinyCLR.Devices.I2c.I2cDevice::WriteRead [IP: 0021] ####
#### GHIElectronics.TinyCLR.Devices.I2c.I2cDevice::Write [IP: 000c] ####
#### MBN.Modules.CapSenseClick::SetRegister [IP: 001e] ####
#### MBN.Modules.CapSenseClick::Init [IP: 0040] ####
#### Examples.Program::Main [IP: 0008] ####
Exception levée : ‘System.Exception’ dans GHIElectronics.TinyCLR.Devices.I2c.dll

0x00 is indeed a special address but it should still be useable, to me.

Btw, the module address can/could be changed but it still needs to be accessed at address 0x00 the first time, so I’m stuck.

Issue #554 raised.

I am not sure if I have correct manual, but what I have is, the address is not zero as default.

To me, and as they say in your doc, those are example addresses, not the real address.

In each code I’ve seen, including original MikroE samples or Arduino projects, the address for this module is 0x00.
And btw, this module works flawlessly with NETMF and address 0x00.

But more generally, my question was about that special address, which is a general call address and therefore perfectly valid. Which does not seem to be the case here.

I have never heard of address 0x00!!

image

I remember something about address 0x00 and I googled it General Call Address – I2C Bus

So address 0x00 is a special address that you can use to write only as it goes to all connected slaves. I do not fully 100% understand it but we will investigate.

When you implemented the AddressFormat.TenBit, you did not notice this 0x00 address ?

I am not even sure we support 10 bit. No worries we will revisit. Thanks for pointing this out.

Not support 10 bit yet.

In 20 years I have not used 10bit addressing. Anyone uses it?!

I did not see one device yet either.
Had I the choice, I would prefer 16bit SPI implemention :yum:

it does 32 bit internally.
Example:
10 bytes => write 3 times (4 bytes + 4 bytes + 2 bytes)

He wants to send short instead of byte.

I’ve moved my question to a dedicated thread, as it was about SPI, not I2C and this issue.

We just tried address zero, on CapSense Click. The address 0x00 just fine, no exception.

We don’t go further because we see nothing wrong with address zero, or please send us piece of your code so we can save our time to read their datasheet. :)).

The following code does produce an exception (SC20260D) :

private static I2cDevice _toto;

    static void Main()
    {
        _toto = I2cController.FromName(SC20260.I2cBus.I2c1).GetDevice(new I2cConnectionSettings(0x00, 100000));
        SetRegister(0xA0, 0x08);
        SetRegister(0x07, 0x1F);
        SetRegister(0x06, 0x18);
        SetRegister(0x08, 0x03);
        SetRegister(0x11, 0x03);
        SetRegister(0xA0, 0x01);
        SetRegister(0xA0, 0x06);
        Thread.Sleep(20);
        SetRegister(0x77, 0x0C);
        SetRegister(0x77, 0x0C);
        SetRegister(0x78, 0x80);
        SetRegister(0x04, 0x03);

        Thread.Sleep(Timeout.Infinite);
    }

    private static void SetRegister(Byte register, Byte value)
    {
        _toto.Write(new[] { register, value });
        Thread.Sleep(20);
    }

What is weird, however, is that if you step on each SetRegister() call, no exception is thrown…
I’ve tried to increase delays between Writes to 50ms but it does not change anything.

The thing is

SetRegister(0xA0, 0x01);
SetRegister(0xA0, 0x06);

If I put

SetRegister(0xA0, 0x01);
Thread.Sleep(1000);
SetRegister(0xA0, 0x06);

It works. So the problem is not zero address issue. Problem is after send SetRegister(0xA0, 0x01); likely device is busy and doesn’t accept any other transaction for awhile.

I don’t see anywhere in document say detail about address 0xA0, what does address do?

Actually I tried Thread.Sleep(50); work fine, no need 1000. But (20) is not enough.

So, does SetRegister(0xA0, 0x01); do a reset, wake up, initialize something… that take at least 50ms?

I am looking here https://www.cypress.com/file/134021/download and the 0xA0 is the command register.

@Bec_a_Fuel Regardless, the data from our end look fine on a logic analyzer. We will wait for a few days to see if you can provide more info. If you can’t find anything then we will close the issue for now. Please let us know.

1 Like

oh yes, I search 0xA0 so not much thing can see. But only A0 then, yes, found something.

And likely SetRegister(0xA0, 0x01); is store configuration and require at least 120 ms

So it may requires delay 120ms after SetRegister(0xA0, 0x01);

1 Like