Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTC ds1307 #113

Open
rocksail opened this issue Jun 14, 2024 · 14 comments
Open

RTC ds1307 #113

rocksail opened this issue Jun 14, 2024 · 14 comments

Comments

@rocksail
Copy link

Describe the bug
Hi - I am trying to make this spare part work with various libraries :
The time i set fine but when I read the time the clock is reset to 2070/1/1 1:0:0 after the call.

I suspect that the command : RTCLIB_WIRE.write(0); to request data from ds1307 is resetting the time.

thanks again

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Files
If applicable, add a minimal source code together with a PICSimLab workspace (.pzw file) to help reproduce your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Troubleshooting:
The simulation in PICSimLab consists of 3 parts:

  • The microcontroller program
  • Microcontroller simulation (made by picsim and simavr)
  • Simulation of boards and parts

When a problem occurs it is important to detect where it is occurring.

One of the most common problems is the error in the microcontroller program. Before creating an issue, test your code on a real circuit (even partially) to make sure the problem is not there.

Errors in the microcontroller simulation can be detected using code debugging. Any instruction execution or peripheral behavior outside the expected should be reported in the project of simulator used (picsim or simavr).

If the problem is not in either of the previous two options, the problem is probably in PICSimLab. A good practice is to send a source code together with a PICSimLab workspace (.pzw file) to open the issue about the problem.

@lcgamboa
Copy link
Owner

Hi @rocksail ,

checking the ds1307 code I discovered 2 problems. The current code does not support the 12h mode and the day of the week does not range from 1 to 7 as it should, but from 0 to 6. I am fixing these problems.
Please provide some example code where the problem you described occurs to see if it works after the correction.

@lcgamboa
Copy link
Owner

I have fixed some issues with DS1307 in the Latest code build.

@rocksail
Copy link
Author

rocksail commented Jun 17, 2024 via email

@rocksail
Copy link
Author

rocksail commented Jun 17, 2024 via email

@lcgamboa
Copy link
Owner

HI @rocksail ,
your example works without problem in PICSimLab 0.9.1 and 0.9.2 using Arduino IDE 1.8.19 with Uno board . Try the workspace in the annex.
rtc_test.pzw.zip

@rocksail
Copy link
Author

rocksail commented Jun 19, 2024 via email

@lcgamboa
Copy link
Owner

Hi @rocksail ,

The problem only occurs with the Windows version of PICSimLab . It appears to be something related to the OS's time synchronization functions of DS1307 part. Now that I managed to reproduce the problem I will try to fix it.
Thanks for the feedback.

@lcgamboa
Copy link
Owner

Hi @rocksail ,

I fixed the error, it was a problem formatting the year internally in the DS1307. You can test with this patched version.

@rocksail
Copy link
Author

rocksail commented Jun 20, 2024 via email

@rocksail
Copy link
Author

rocksail commented Jun 20, 2024 via email

@lcgamboa
Copy link
Owner

Hi @rocksail ,
I appreciate your support in testing the PICSimLab. Yes, there was a bug in the year calculation again, but it is now fixed. I have updated the patched version.

@rocksail
Copy link
Author

rocksail commented Jun 21, 2024 via email

@lcgamboa
Copy link
Owner

I couldn't reproduce this problem, but I found another one. When you open the PICSimLab the date is recorded correctly in the RTC, but when the reset button is pressed the date is no longer recorded. Apparently, after the reset, the first byte of I2C is always corrupted. The problem is in the Arduino's i2c code, this problem will take more time to be fixed.

@rocksail
Copy link
Author

rocksail commented Jun 24, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants