Thanks for replying. Do you have any idea how I can use an eeprom in this RTC?1. you can ignore the EEPROM if you don't need it. Just don't use its I2C address.
2. This is almost certainly a connection problem, if the power/ground breaks even for a moment, you have to reinitialize the IC.
3. I2C EEDPROM have diferent internal addresses and sometimes different commands but most are very similar. If you change the address to 24C32 it will probably work just the same but with 32 times more storage!
Brian.
Thanks a lot for sharing this information.Treat it as an EEPROM that is not on the board. The SDA and SCL lines are shared with the RTC but the I2C protocol states the communication with a device starts by putting its address on the bus so using address B'1101000x' will communicate with the DS1307 and address B'1010AAAx' will communicate with the AT24C32.
In both examples, 'x' is the read/write bit (I2C uses adjacent addresses to read or write to a device) and in the case of the AT24C32, 'AAA' is the bit pattern on pins A2,A1,A0. As these pins seem to be permanently grounded on the PCB you can treat them as all zero.
For the specifics of how to use the 24C32 you have to refer to its data sheet but it is a very easy device to use.
Brian.
Thank you for such a perfect answer.It says WARNING
Negative undershoots below -0.3V while the part is in battery-backed mode may cause loss of data
Imagine how the Vbat can be used to save the time of day for a few seconds or minute to save the date, hour and minute while the battery is being changed and the capacitor gets discharged too much. Why do you think they sense the battery voltage using 1.5/2.1 Meg or 71% and if they rely on the input logic level at 50% or 1.3V for 74HCTxx thresholds when should they save date & time into EEPROM first before it stops? Or maybe it is still powered up with 5V and the battery is dead what parameters should it use to update Date & time into EE?
Do you think it should have a cap on the Vbat? Maybe not if Vbat drops below Vcc and (if it) causes SCR shutdown when Vcc comes back up and Vbat exceeds Vcc by the do not exceed rating. Or maybe that port's high impedance is affected by stray E-fields in your cable from high CM grid fields and has exceeded the Not to Exceed thresholds into the 0.5 Meg Vbat port
Std 3.0V Li battery...."
Backup Supply Input for Any Standard 3V Lithium Cell or Other Energy Source. Battery
voltage must be held between the minimum and maximum limits for proper operation.
Diodes in series between the battery and the Vbat pin may prevent proper operation. If a
backup supply is not required, Vbat must be grounded. The nominal power-fail trip point
(VPF) voltage at which access to the RTC and user RAM is denied is set by the internal
circuitry as 1.25 x Vbat nominal. A lithium battery with 48mAh or greater will back up the
DS1307 for more than 10 years in the absence of power at +25°C"
When Vcc falls below 1.25 x Vbat, the device terminates an access in progress and resets the device
address counter. Inputs to the device will not be recognized at this time to prevent erroneous data from being
written to the device from an out-of-tolerance system. When Vcc falls below Vbat, the device switches into a low-
current battery-backup mode. Upon power-up, the device switches from battery to Vcc when Vcc is greater than
Vbat +0.2V and recognizes inputs when Vcc is greater than 1.25 x Vbat.
Try 1nF on Vbat port.
Use shielded or twisted wires to suppress CM E-fields.
use a magnifying lens on all solder joints.
--- Updated ---
24C32 4.5 to 55V won't work on power fail using 3V
View attachment 187838
I omitted the R2, R1 and D1 and I connected cr2032 directly to ds1307. The result was when I disconnect Vcc from ds1307 it can save the time correctly but it can not show it on serial terminal.The topic of these little boards has come up before. They are not well designed and the advertising is misleading.
The purpose of D1 and R5 is to provide a charging current to a RECHARGEABLE coin cell. They do nothing if a normal CR2023 cell is fitted, in fact there is a tiny risk of the cell being damaged although it is unlikely and shouldn't be dangerous.
R2 and R1 are to drop the voltage at the VBAT pin to a safe level if the battery isn't fitted or can't sink enough current, otherwise it could rise to around (5V - Vf of D1) = 4.4V.
A more sensible design would omit D1, R1,R2 and R5 altogether and just rely on a battery being fitted for backup. Someone somewhere designed this without really thinking through the consequences or at least explaining how it was supposed to be used. They didn't follow the data sheet.
Brian.
To test this I disconnected VCC from ds1307 but I made pullup I2C pins to an external VCC by same ground. I expected besides saving time it could show the time on serial terminal. Unfortunately it just saved the time. Have I tested in a wrong way? If so, I2c pins of ds1307 do not work with VBAT, Am I Right?That is how it is supposed to work.
The cell is only there to keep the clock operating when VCC is removed, otherwise without any power it would forget all the register contents. VCC is still needed for the I2C interface to work.
Brian.
Correct.If so, I2c pins of ds1307 do not work with VBAT, Am I Right?
By this explanation I won't be able to use the time during the absence of VCC. it can just save the time, if I am not mistaken.Hi,
I´m not surprised, because I believe in datasheet informations like:
When VCC falls below 1.25 x VBAT, the device terminates an access in progress and resets the device
address counter. Inputs to the device will not be recognized at this time to prevent ..
Klaus
What I mean is I just disconnected VCC from ds1307, not from microcontroller, meanwhile microcontroller is connected to VCC. I did this to see if RTC can work with Vbat or not. Accordingly, I realized ds1307 can save time with Vbat but can not communicate with microcontroller by I2C. If I concluded wrongly let me know?If VCC is absent how does the controller read the data anyway? Normally it would share the same VCC supply.
VBAT is just an alternative power input that keeps the timekeeping part running so the clock updates normally but you can't actually read or write the time/date unless VCC is also present.
Brian.
Module has a 32K eeprom (24c32), but I used a 1k eeprom (24AA01)
You are experiencing mechanical & EMC issues. If you squeeze a 10:1 probe tip without touching ground clip floating, you ought to easily get >> 50Vpp.Hi Everyone,
It has been a few days that I have been struggling with DS1307 RTC and I have some questions and problems. I should mention I had tested a library for ds1307 on its prepared module, then I decided to make the circuit separately with its components. These are the ds1307 module pic and its circuit diagram. In addition I attached ds1307 and its module datasheet here. However, there was not appropriate datasheet for its module.
View attachment 187789View attachment 187790
1. Based on the datasheet ds1307 has 56B nvSRAM, so my first question is what is the usage of eeprom in this module? is it necessary to use eeprom on my board or not?
2. Second, I have a very big problem. After creating this circuit on PCB, it works correctly when the board is fixed o its place. But sometimes by a simple movement of board the timer gets stuck and sometimes it works well. My first guess was the crystal oscillator stops working by moving the board. But then I decided to touch crystal by my hand to test it and it was OK. I do not know where is the problem.
3. I should mention the only difference between the module and my circuit is the type of eeprom. Module has a 32K eeprom (24c32), but I used a 1k eeprom (24AA01). Can this difference affect the performance. I still do not know the usage of eeprom here.
Thanks for providing this information.You are experiencing mechanical & EMC issues. If you squeeze a 10:1 probe tip without touching ground clip floating, you ought to easily get >> 50Vpp.
if you rattle the board & connections while one hand is grounded to 0V and PE gnd., it should not fail. If so, minimize by tapping the faulty connection.
Regarding EEPROM , here are some examples.
Here are a few more examples of how external EEPROM and an RTC (Real-Time Clock) like the DS1307, along with the 24C32 EEPROM, might be used in embedded systems or electronic projects:
These examples showcase the versatility of combining an RTC with external EEPROM to enhance the functionality of embedded systems and electronic projects. Always refer to the datasheets of the specific components you are using for detailed information and guidelines.
- Data Logging:
- Scenario: You have a data logging project where you want to record sensor readings at specific intervals.
- Implementation: Use the RTC to timestamp each sensor reading, and store the data in the external EEPROM. This allows you to log data with a time reference.
- Configuration Storage:
- Scenario: Your device has user-configurable settings that need to be retained even when the power is turned off.
- Implementation: Store configuration parameters (e.g., user preferences, calibration data) in the external EEPROM. The RTC can be used to timestamp when the configuration was last modified.
- Event Logging:
- Scenario: You want to log specific events or occurrences in your system.
- Implementation: When an event occurs, use the RTC to timestamp the event and store relevant details in the external EEPROM. This can be useful for debugging or system monitoring.
- Security System:
- Scenario: Building a security system where you want to log access attempts.
- Implementation: Use the RTC to timestamp each access attempt and store information in the external EEPROM. This can include details such as the user ID, access point, and result of the attempt.
- Energy Monitoring:
- Scenario: Designing a system to monitor energy consumption over time.
- Implementation: Store periodic energy consumption readings in the external EEPROM with timestamps from the RTC. This allows you to analyze energy usage patterns.
- Temperature Data Storage:
- Scenario: You are building a temperature monitoring system.
- Implementation: Use the RTC to timestamp temperature readings and store the data in the external EEPROM. This provides a historical record of temperature changes over time.
- Alarming System:
- Scenario: Implementing an alarm system with programmable alarms.
- Implementation: Store alarm settings and trigger conditions in the external EEPROM. The RTC can be used to manage time-related aspects of the alarms.
- Firmware Update Tracking:
- Scenario: Keeping track of when firmware updates occurred.
- Implementation: Store firmware update timestamps and version information in the external EEPROM using the RTC. This helps in monitoring the history of firmware updates.
Thanks to GPT3.5 and my prompts.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?