FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
Announcements
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.
5853 Discussions

interfacing RTC module to hps driven i2c pins

snehal_p
New Contributor I
1,849 Views

Hello,

I need help in interfacing RTC 3231 breakout board to the hps driven pins. While trying to read the rtc I'm getting connection timed out. PFA screenshot for the error.

Can anyone help with this.

Thanks,

snehal_p

0 Kudos
15 Replies
JingyangTeh
Employee
1,818 Views

Hi snehal_p


I found that the DE1SOC has a multiplexer for the I2C.

Could you try setting the HPS_I2C_CONTROL (GPIO48) high before trying out the i2c command?


Regards

Jingyang, Teh


0 Kudos
snehal_p
New Contributor I
1,805 Views

Hello Jingyang,

PFA screenshot of the debug console, 68h is the address for the rtc breakout board. It seems that it is detecting rtc and also returns value for i2cget command but when executing rtc application it returns wrong values.

PFA rtc.c code.

Thanks,

snehal_p

0 Kudos
JingyangTeh
Employee
1,791 Views

Hi Snehal


I took a look at your source code and the screenshots.

It seems like the i2c is working as the log shows that the application is able to connect to the i2c device.

A little comment on the main function, the calling of the "rtc_get" and "rtc_set " there are no pointers being passed into those function.


To interact with the rtc module the i2c you would need to set the device register first.

You might need multiple set and get function call:


"i2cset- 1 0x68 0x6"

"i2cget -1 0x68 0x00"



Below is a snippet from the datasheet of the DS3231.


"

Data transfer from a master transmitter to a slave receiver. The first byte transmitted by the master is the slave address. Next follows a number of data bytes. The slave returns an acknowledge bit after each received byte. Data is transferred with the most significant bit (MSB) first.


Data transfer from a slave transmitter to a master receiver. The first byte (the slave address) is transmitted by the master. The slave then returns an acknowledge bit. Next follows a number of data bytes transmitted by the slave to the master. The master returns an acknowledge bit after all received bytes other than the last byte. At the end of the last received byte, a not acknowledge is returned. The master device generates all the serial clock pulses and the START and STOP conditions. A transfer is ended with a STOP condition or with a repeated START condition. Since a repeated START condition is also the beginning of the next serial transfer, the bus will not be released. Data is transferred with the most significant bit (MSB) first"


Regards

Jingyang, Teh


0 Kudos
snehal_p
New Contributor I
1,783 Views

Hello Jingyang,

Thanks!

PFA screenshot of debug console. Can you please help me understand the output of i2cdetect as UU.

I'm also facing issue with .dtb file, PFA debuglog , after switching on the system it works well but after I switch it off and on again it hangs after Starting kernel. Can you help me diagnose the issue

 

Thanks and regards,

snehal_p

0 Kudos
JingyangTeh
Employee
1,767 Views

Hi Snehal


For the RTC Module did you associate it to a kernel driver?

From the starting logs that the rtc is being registered under the kernel.

"[  1.217136] rtc-ds1307 0-0068: setting system clock to 2000-04-24 05:56:41 UTC (956555801)"

That is why the address is showing UU when you are using the i2cget command.


Regarding the kernel hang, does it happen all the time?

I see that the uboot version is quite an outdate one. I would suggest you to use the latest uboot version(U-Boot 2022.04).


Regards

Jingyang, Teh



0 Kudos
snehal_p
New Contributor I
1,741 Views

Hello Jingyang,

 

Thanks, RTC detect sorted. but not able to read the correct date and time.PFA c code

Kernel hang is still the issue at times, what could be the probable reason.

Also can you help with the example code for RS232 with flow control.

 

Thanks,

snehal_p

 

 

0 Kudos
JingyangTeh
Employee
1,691 Views

Hi Snehal


I am not too sure on what could cause the kernel hang but I would suggest you use a newer version of the linux kernel.


From my experience with RS232, I have not seen a software flow control for RS232.

The RS232 got lots of hardware flow control that we could utilize.

I could be wrong on this statement.


However I managed to find this RS232 example from the Intel website.

https://www.intel.com/content/dam/support/us/en/programmable/support-resources/fpga-wiki/asset03/max-baud-rate-cyclone-v-soc-design-example.pdf


Regards

Jingyang, Teh


0 Kudos
snehal_p
New Contributor I
1,685 Views

Hello Jingyang,

 

Thanks,

RS232 with hardware flow control IC I'm using MAX3241EEAI+T.

If you can help me with the example code.

 

Thanks,

snehal_p

0 Kudos
snehal_p
New Contributor I
1,167 Views

Hello Jingyang,

 

Can you please help me with the project folder or uart.c  code mentioned in the document.

 

Thanks,

snehal_p

0 Kudos
JingyangTeh
Employee
1,653 Views

Hi Snehal


Sorry that we do not have an example for the RS232 with flowcontrol.


Regards

Jingyang, Teh


0 Kudos
JingyangTeh
Employee
1,609 Views

Hi


Any update on this?


Regards

Jingyang, Teh


0 Kudos
snehal_p
New Contributor I
1,596 Views

Hi Jingyang,

I'm still facing issue of kernel hang, I tested different sd card  images and could conclude that it has to be a .dtb file as this issue is only with the sd card images in which I2C is enabled for RTC interface, others are working OK

PFA .dtb files with rtc and without rtc. Can you please help me with the issue.

 

Thanks,

snehal_p

0 Kudos
JingyangTeh
Employee
1,560 Views

Hi Snehal


Could you switch the files in between the sd card?

I take a look of the dtb file and the only changes are enabling the i2c.

I dont see it could cause the kernel to hang.


Regards

Jingyang, Teh


0 Kudos
JingyangTeh
Employee
1,489 Views

Hi Snehal


Is the kernel hang issue still occurring after swapping the sdcard?


Regards

Jingyang, Teh


0 Kudos
JingyangTeh
Employee
1,416 Views

Hi


Since there are no feedback for this thread, I shall set this thread to close pending. Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.


If you happened to close this thread you might receive a survey. If you think you would rank your support experience less than 10 out of 10, please allow me to correct it before closing or if the problem can’t be corrected, please let me know the cause so that I may improve your future service experience.



Regards

Jingyang, Teh


0 Kudos
Reply