Xymox
Member
I recently dealt with a time accuracy issue with the Powerlinc 1132CU. It was not obvious initially what was going on and required a few weeks of monitoring and testing along with installing new parts in the 1132CU and testing the solution. I was successful and I have isolated a serious hardware design problem with the currently shipping Powerlinc 1132CU. Below is my report to Smarthome.
I thought it wise to get this up on forums so Google could index it and help other DIY people in the future.
Once you understand what is going on, its very clear the board layout on the 1132CU was very poor and will lead to time accuracy issues in every system depending on the amount of power line garbarge present.
Below is my email to Smarthome:
____________________________________________________________
Having read the Q&A on timekeeping issues on the PLC at Smarthome and using the current software, I still had a issue where my brand new 1132 PLC would suddenly revert to the last previously set time and then continue from there leaving hours of time offset. This seemed to occur almost randomly. This would appear to a customer as a large time offset that occurs almost randomly and could also appear as large long term time accuracy drift with moderate amounts of power line noise. This problem may also come and go depending on the content of the power line noise.
I design electronics for a living so I decided to void the warranty and investigate the problem myself. Putting test equipment on the unit and letting it run produced interesting results. First, the Li battery was fine. However there were power line spikes from my Air Cond compressor at about 100Khz that were being radiated by the power transformer in the unit and being picked up by the high impedance crystal oscillator circuit acting as a antenna because of a lack of shielding and the proximity of the xtal to the transformer - 1/8". While this caused small time offsets This was not enough to explain why the PLC was reverting to a previously set time and then continuing. However according to Maxim, the people who make the chip, intermittant 100Khz on the 32Khz xtal circuit would cause unpredictable results. This was producing a small and random time accuracy issue in addition.
It appears that when a change of power state ( plugged in / un plugged on battery ) the 1132 PLC will read the DS1307 and if the DS1307 ends up in a stuck state then it reports the last time sent to the 1307. Rather then using the DS1307 + xtal to keep time however the PLC only seems to read the RTC under certain conditions and at least once a day. I confirmed this by removing the Xtal stopping all 32Kkz operations and stopping the RTC.
Stopping the RTC reliably reproduced the issue. I can set the time, the time will increment in the PLC even with the RTC is stopped. All operations work in the PLC. Timer events occur on schedule and it keeps very accurate time during this period even though the RTC is stopped and has the wrong time internally. However upon power line removal it will revert to the last time set in the RTC. So it appears that the PLC uses the power line as its primary time freq source ( wise ) and only refers to the RTC on power up and once a day and not as a primary time source ? Thats my best guess.
After reading the App notes for the Maxim DS1307 I decided to add the Maxim DS32Khz temp controlled crystal oscillator as Maxim suggests. The low output impedance, sharp waveform edges and 1.5 V of swing make the circuit far less susceptible to induced power line garbage in this case. It also makes the RTC -far- more accurate. I also opted to NOT use the 1M resistor and cap to reduce current consumption from the battery because this would increase impedance and lead to induced RFI/EMI susceptability. I added a bigger Li battery to cover the additional current draw.
Maxim talks about the most common problems with its RTC's not keeping accurate time comes from poor shielding where RFI induces issues by being picked up by the Xtal circuit. I can confirm this occurs with power line noise in a 1132A. By removing the xtal and hooking a 30Mohm scope to X0 and X1 I captured large noise components from the power line being induced into the chip and causing the RTC to increment even though no Xtal was present. This is prob due to the long, and not recommended by Maxim, lengths of PC board trace to the Xtal. The Xtal was moved to the location by the transformer prob to thermally couple it to the transformer for time accuracy reasons. Which was smart. However the noise picked up by the long trace and even by the Xtal itself makes this design less appealing and in fact created the problem. However the 1/2" distance from the Transformer to the DS1307 itself might be a issue without shielding.
The actual time in the DS1307 is only read once a day or when the 1132 makes a transistion in power - unplugged/plugged in. At that point the PLC will read the DS1307 time and update the clock in the 1132 PLC. Just FYI.
My problem has completely vanished after adding the DS32khz chip. My PLC now keeps hyper accurate time and never has issues. I feel the complete absence of the symptoms confirms my analysis of the problem.
I think a change to the PLC should be done. Adding a DS32khz TXCO to the circuit would obviously fix the prob by lowering the suscibility of the Xtal inputs, however these are expensive in production. Switching over to the DS3231 would also be very good and replace the current DS1307 - however this requires board rework, however the control protocol looks the same so it will just drop into the circuit without the need for code changes on the CPU side. However I have not fully investigated the software interface issues.
The noise issue is covered in the DS1307 app note under the subsection "Crystal Layout Guidelines" in the document
http://www.maxim-ic.com/appnotes.cfm/appnote_number/58
Shielding or board layout will help in fixing the problem if no part or board changes are planned.
I thought it wise to get this up on forums so Google could index it and help other DIY people in the future.
Once you understand what is going on, its very clear the board layout on the 1132CU was very poor and will lead to time accuracy issues in every system depending on the amount of power line garbarge present.
Below is my email to Smarthome:
____________________________________________________________
Having read the Q&A on timekeeping issues on the PLC at Smarthome and using the current software, I still had a issue where my brand new 1132 PLC would suddenly revert to the last previously set time and then continue from there leaving hours of time offset. This seemed to occur almost randomly. This would appear to a customer as a large time offset that occurs almost randomly and could also appear as large long term time accuracy drift with moderate amounts of power line noise. This problem may also come and go depending on the content of the power line noise.
I design electronics for a living so I decided to void the warranty and investigate the problem myself. Putting test equipment on the unit and letting it run produced interesting results. First, the Li battery was fine. However there were power line spikes from my Air Cond compressor at about 100Khz that were being radiated by the power transformer in the unit and being picked up by the high impedance crystal oscillator circuit acting as a antenna because of a lack of shielding and the proximity of the xtal to the transformer - 1/8". While this caused small time offsets This was not enough to explain why the PLC was reverting to a previously set time and then continuing. However according to Maxim, the people who make the chip, intermittant 100Khz on the 32Khz xtal circuit would cause unpredictable results. This was producing a small and random time accuracy issue in addition.
It appears that when a change of power state ( plugged in / un plugged on battery ) the 1132 PLC will read the DS1307 and if the DS1307 ends up in a stuck state then it reports the last time sent to the 1307. Rather then using the DS1307 + xtal to keep time however the PLC only seems to read the RTC under certain conditions and at least once a day. I confirmed this by removing the Xtal stopping all 32Kkz operations and stopping the RTC.
Stopping the RTC reliably reproduced the issue. I can set the time, the time will increment in the PLC even with the RTC is stopped. All operations work in the PLC. Timer events occur on schedule and it keeps very accurate time during this period even though the RTC is stopped and has the wrong time internally. However upon power line removal it will revert to the last time set in the RTC. So it appears that the PLC uses the power line as its primary time freq source ( wise ) and only refers to the RTC on power up and once a day and not as a primary time source ? Thats my best guess.
After reading the App notes for the Maxim DS1307 I decided to add the Maxim DS32Khz temp controlled crystal oscillator as Maxim suggests. The low output impedance, sharp waveform edges and 1.5 V of swing make the circuit far less susceptible to induced power line garbage in this case. It also makes the RTC -far- more accurate. I also opted to NOT use the 1M resistor and cap to reduce current consumption from the battery because this would increase impedance and lead to induced RFI/EMI susceptability. I added a bigger Li battery to cover the additional current draw.
Maxim talks about the most common problems with its RTC's not keeping accurate time comes from poor shielding where RFI induces issues by being picked up by the Xtal circuit. I can confirm this occurs with power line noise in a 1132A. By removing the xtal and hooking a 30Mohm scope to X0 and X1 I captured large noise components from the power line being induced into the chip and causing the RTC to increment even though no Xtal was present. This is prob due to the long, and not recommended by Maxim, lengths of PC board trace to the Xtal. The Xtal was moved to the location by the transformer prob to thermally couple it to the transformer for time accuracy reasons. Which was smart. However the noise picked up by the long trace and even by the Xtal itself makes this design less appealing and in fact created the problem. However the 1/2" distance from the Transformer to the DS1307 itself might be a issue without shielding.
The actual time in the DS1307 is only read once a day or when the 1132 makes a transistion in power - unplugged/plugged in. At that point the PLC will read the DS1307 time and update the clock in the 1132 PLC. Just FYI.
My problem has completely vanished after adding the DS32khz chip. My PLC now keeps hyper accurate time and never has issues. I feel the complete absence of the symptoms confirms my analysis of the problem.
I think a change to the PLC should be done. Adding a DS32khz TXCO to the circuit would obviously fix the prob by lowering the suscibility of the Xtal inputs, however these are expensive in production. Switching over to the DS3231 would also be very good and replace the current DS1307 - however this requires board rework, however the control protocol looks the same so it will just drop into the circuit without the need for code changes on the CPU side. However I have not fully investigated the software interface issues.
The noise issue is covered in the DS1307 app note under the subsection "Crystal Layout Guidelines" in the document
http://www.maxim-ic.com/appnotes.cfm/appnote_number/58
Shielding or board layout will help in fixing the problem if no part or board changes are planned.