I am trying to read the current state of any counter over I2C, but it always returns 0. I have some digital logic feeding the clock input of CNT2 and the counter data set to 10. I have also tried using a square wave. I get a pulse on the output after 10 cycles as expected. (Please ignore the buffer in the schematic)
I have validated the Counter Data by reading register 0xAF over i2c which returns 10.
However, when I read 0x7E the Counted Value it is always zero. In fact, 0x7C/0x7D, or CNT0, is also zero which I am using as a Wake Sleep Controller.
My expectation is the current state of the counter between 0-10. For example, Counted Value should read 5 if it has seen 5 clock edges. Have I misunderstood something?
Read register 7E (not 7F) for CNT2.
I should have used my spectacles. Sorry.
Could you check if the CLK input and Reset weren't swapped?
How do you read the Counted Value? Do you use one of Renesas Boards? If you use an external I2C master, please check for proper communication between the slave and the master.
It would be good if you send the design file, and I will look into where the issue is.
Thanks for the reply. I have created a standalone design to reproduce my problem. I've connected OSC1 to CNT2 and validated the output signal on Pin 6. https://drive.google.com/file/d/1ykR2rSZ_XMlHulJTHwAEoIGElw5K0pyH/view?usp=sharing
The SLG IC is on a custom board and I am reading it with a microcontroller. I am able to read the Counter Data of 200 which I programmed so I believe the method is good.. However, All of the Counted Values (0x7C to 0x7F) are zero. The only difference in the i2c code is the change of address. Regarding the reset line, I have it tied to POR.
Quick update. I found an error in the I2C address bit manipulation and it seems to work now. I'm surprised I was still able to read the correct counter data even with the address error. I'll do some more investigation to understand more.