FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.
5422 Discussions

interfacing RTC module to hps driven i2c pins

snehal_p
New Contributor I
180 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
8 Replies
JingyangTeh
Employee
149 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


snehal_p
New Contributor I
136 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

JingyangTeh
Employee
122 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


snehal_p
New Contributor I
114 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

JingyangTeh
Employee
98 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



snehal_p
New Contributor I
72 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

 

 

JingyangTeh
Employee
22 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...


Regards

Jingyang, Teh


snehal_p
New Contributor I
16 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

Reply