cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 5, 3 & 1

Yash_r
New Contributor II

Hello, @MotooTanaka san,

Apologies for bothering you again.
The current thread is an extension to the earlier thread where I was seeking your assistance link.

As mentioned in the earlier thread, I am trying to get the PCF 8563 RTC module to work with the PSOC 5LP over the I2C interface, but sadly, I am not able to do so.
I have tried the I2C write and read operations as mentioned in the I2C component datasheet with the slave address changed, but that didn't help.
Also, I tried the implementation mentioned in the thread which is DS1307, but that implementation didn't work out either.

 

The datasheet of the PCF 8563 can be accessed from the link:https://www.waveshare.com/w/upload/5/5d/PCF8563.pdf
(To read the time, the seconds register 0x02 is to be accessed and a buffer of 6 bytes can be read to display the time and date.)

I have tried the same RTC with STM32F407, and it worked out just fine. The implementation and API working is a bit different and I am not able to figure out what is going wrong with PSOC.

I will really appreciate any help on this.

Regards,
Yash

0 Likes
9 Replies
Len_CONSULTRON
Honored Contributor II

Yash,

I've read your previous thread as well as this one.

There is some confusing/conflicting information.

Apparently you're interfacing the PCF 8563 RTC yet you are using the RTC component in your TopDesign.

Which do you plan to use, the PCF 8563 RTC or the RTC?   You don't need both.  It would be redundant.

If you are going to use the PSoC's RTC component, you need to provide a 32.768KHz crystal across P15.2 and P15.3 pins.  The PCF 8563 RTC is not needed.

If you plan to use the PCF 8563 RTC, you will need to place the 32.768KHz across the OSCI and OSCO pins on that device and connect the SCL and SDA pins to two port pins on the PSoC.  Then you will need to configure those PSoC pins to be connected to a I2C component in your TopDesign.

Additional questions:

Are you using a PSoC kit or eval board for this project.   If so, which one?

It appears you are using a LCD display, which one?

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Yash_r
New Contributor II

Hello Len,

I am trying to access the PCF 8563 via RTC and am using the PSOC 5LP CY8CKIT-059 kit.
The PCF 8563 kit has an onboard 32.768KHz crystal.
I have also connected the PCF 8563 kit over the I2C pins P12[0] and P12[1].
I am currently trying to debug the incoming data by checking the Watch screen in Debug mode, so still haven't added UART or LCD yet.

The main goal for now is to access the PCF 8563 via I2C and write to/read from, the date and time registers every second and then write to UART.

Hope i have clarified the doubt better.

Regards,
Yash

0 Likes
MotooTanaka
Esteemed Contributor

Hi,

To test basic components, I posted sample projects below

(CY8CKIT-059)

https://community.infineon.com/t5/Code-Examples/MCU-Tester-a-Swiss-Army-Knife-for-PSoC-CY8CKIT-059-v...

(CY8CKIT-050)

https://community.infineon.com/t5/Code-Examples/MCU-Tester-a-Swiss-Army-Knife-for-PSoC-CY8CKIT-050-v...

Please try one close to your environment and access I2C via a serial terminal, such as Tera Term.

If it works, you can refer to my i2c_utils.[ch] source to access I2C.

If it does not work, may be you are having some problem with hardware.

moto

MotooTanaka
Esteemed Contributor

Hi,

If you are using CY8CKIT-059 and connecting I2C via P12[0] and P12[1], you don't need pull-up resistors,

so I hope you are ready to go.

Please down load and try my sample for CY8CKIT-059 above and run "I2C > scan" 

then if the module is working, its I2C address will be reported.

If not, please check if the module is 

(1) Powered correctly

(2) SCL is connected with P12[0], SDA is connected with P12[1] and GND is connected together

If you see the I2C address of the module reported,

then I hope that the rest is the problem of the program sequence.

moto

Yash_r
New Contributor II

Hello, @MotooTanaka san,


Thank you so much for sharing that project code example. It helped me to make sure that the RTC is working properly and returning data as expected.

I have imported the functions for I2C read and write transactions into my project and can see that the RTC is reporting the time and date properly over UART (Attaching project in case it helps someone else in the future).

 

While going through, i noticed that the I2C transfers are done using I2C_MasterWriteByte() and I2C_MasterReadByte() in the functions i2c_write_reg() and i2c_read_regs().

Is there a way to use the I2C_MasterReadBuf() and I2C_MasterWriteBuf() to implement the same instead of using Byte functions?

Just curious about how to use the Buf() functions for the same example.

Thanks a lot for your help, again!!!

Regards,
Yash

MotooTanaka
Esteemed Contributor

Dear Yash-san,

First of all, I'm glad hearing that there was no hardware or serious problem

and your project has started working!

 

Just curious about how to use the Buf() functions for the same example.
To be honest, I think that I also failed to use Buf() functions, before.

As I was lazy, I did not try to find the root cause.

Since I also ordered a PCF8563 RTC Module to test for this thread,

I will try to check the Buf() function, when the module arrives.

(But since your project is OK now, I may not going to hurry...)

 

Best Regards,

19-Nov-2021

Motoo Tanaka

 

0 Likes
Yash_r
New Contributor II

Tanaka san,

Thank you for your help.

Looking forward to a code example involving the I2C buf() functions being used to interface with the PCF 8563 RTC.

Thanks a lot.

Regards,
Yash

0 Likes
Len_CONSULTRON
Honored Contributor II

Yash,

I've attached a project for the CY8CKIT-059 that uses the PSoC5s RTC component.

The only thing that needs to be added to the board is a very inexpensive 32.768KHz crystal.

If you're using the CY8CKIT-050, it already has a 32.768KHz crystal.   You only need to change the target device to the CPU used on this kit.

I set the initial date to 1, Jan, 2022 00:00:00.  The RTC advances the time and pushes it out to the UART once a second.

 

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Yash_r
New Contributor II

Len,

Thank you for your advice and help, but I already got the RTC component in the PSOC 5LP working properly before, with the help from Tanaka-san.

I wanted to get the PCF 8563 RTC from Waveshare working now, over I2C.
And with Tanaka-san's help, I got it working and attached the project in my previous response as it might be helpful to someone in the future.

Regards,
Yash

0 Likes