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?
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.
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"
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,
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).
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.
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.