ECN Electrical Forum - Discussion Forums for Electricians, Inspectors and Related Professionals
ECN Shout Chat
Shout Box
Recent Posts
Changing a Bulb
by mbhydro. 07/21/18 05:57 PM
Opinions & comments
by HotLine1. 07/21/18 04:44 PM
Tray cable?
by gfretwell. 07/11/18 10:18 PM
Eaton Heavy Duty 30A and 60A Safety Switches
by Admin. 07/11/18 09:49 PM
ORTOVOX Recalls Avalanche Transceivers
by Admin. 07/11/18 09:44 PM
New in the Gallery:
Plug terminals
Housebilding DIY wiring
Who's Online Now
0 registered members (), 26 guests, and 17 spiders.
Key: Admin, Global Mod, Mod
Previous Thread
Next Thread
Print Thread
Rate Thread
EEPROM errors on XC7Z010-2CLG225I chip #218834
11/01/17 03:15 AM
11/01/17 03:15 AM
V
vivitern  Offline OP
New Member
Joined: Oct 2017
Posts: 1
shenzhen,guangdong
I'm running a Xilinx XC7Z010-2CLG225I chip. I have this chip on several PCBs, all running the same software, and observe the same problem on all of them. This implies a systemic problem, not a one-off production issue. The problem is also reproducible, implying I should be able to kill it if I know where to look. But I'm still having surprising difficulty debugging the application.

The board under test accepts 24V, which gets stepped down to 5V through a V7805. The chip runs on its internal oscillator, with a 16x PLL, giving an operation speed of ~29.5 MIPS. The relevant code on this board is essentially very simple: wake up, read data from EEPROM, then enter an infinite loop. Interrupt every millisecond, observe some environmental data, and write an updated value to EEPROM. There's other stuff going on, but the problem still occurs even if the unrelated code is commented out, so I can be reasonably certain it's not relevant to the problem at hand.

In general use, 95% of the time the board wakes up with the correct value in memory, and goes on about its business. The other 5% of the time, though, it wakes up with an incorrect value. Specifically, it wakes up with a bit-flipped version of the data it's supposed to have. It's a four-byte unsigned long that I'm watching, and either the upper or lower word of the long can get flipped. For example, 10 becomes 2^16-10, which later becomes 2^32-10. I can reproduce the glitch by manually cycling power several dozen times, but that's not very consistent, and my switch finger gets worn out.

In order to reproduce the problem in a controlled fashion, I built a second board which drives the 24V supply to the board under test. (Another dsPIC driving a darlington optocoupler.) The tester board turns the 24V off for 1.5 seconds (long enough for the 5V rail to drop to essentially 0 and stay there for one second), then turns the 24V on for some configurable length of time. With an on-time of approximately 520 mS, I can reproduce this EEPROM glitch within five power cycles, every time.

The 5V rail is behaving reasonably. It settles at 5V within 1 mS of turn-on, with perhaps .4V of overshoot, assuming I can trust my scope. At turn-off it decays to 0V exponentially, reaching 1V within 50 mS. I have no build warnings that seem relevant, just unused variables and missing newlines at the end of files.

I've tried several things:

Enabling/disabling the MCLR
Enabling/disabling the WDT
Enabling/disabling code protection
Enabling/disabling/changing brownout detect voltage
Enabling/disabling/changing the power-on timer
Different PLL settings on the main internal oscillator
Connecting/disconnecting my PICkit 3 programmer
Adding 470 uF of capacitance to the 5V rail
Adding/removing .1 uF across the 4.7k pullup on my MCLR pin
Disabling all interrupts in the code and leaving nothing but EEPROM updates in the main loop
Adding a 1.5 second delay to my startup routine before I start reading EEPROM
I've also written separate test code which does nothing but continually write values to EEPROM and then read them back, making sure that the value has not changed. Tens of thousands of iterations gave no errors. All I can conclude is that something goes wrong with EEPROM read or write, specifically at powerup/powerdown.

I've been using the same EEPROM libraries since 2007. I've seen occasional glitches, but nothing reproducible. The relevant code can be found here:
http://srange.net/code/eeprom.c
http://srange.net/code/readEEByte.s
http://srange.net/code/eraseEEWord.s
http://srange.net/code/writeEEWord.s

I've seen EEPROM errors before in other applications, but always as one-off glitches, nothing this reproducible or consistent.

Does anyone have any idea what's going on? I'm running out of things to try.

Last edited by vivitern; 11/01/17 03:17 AM.
Tools for Electricians:
Re: EEPROM errors on XC7Z010-2CLG225I chip [Re: vivitern] #218843
11/06/17 08:56 PM
11/06/17 08:56 PM
J
JoeTestingEngr  Offline
Member
Joined: Nov 2005
Posts: 794
Chicago, Il.
My guess is that you're generating write pulses during some power downs.

Re: EEPROM errors on XC7Z010-2CLG225I chip [Re: vivitern] #218844
11/07/17 06:45 PM
11/07/17 06:45 PM
T
twh  Offline
Member
Joined: Mar 2004
Posts: 946
Regina, Sask.
How do you ensure the write operation is complete before the power is turned off?


Featured:

2017 Master Electrician Exam Preparation Combos
2017 NEC Electrician
Exam Prep Combos:
Master / Journeyman

 

Member Spotlight
lil suzi
lil suzi
Midwest
Posts: 57
Joined: August 2003
Show All Member Profiles 
Top Posters(30 Days)
Admin 5
Popular Topics(Views)
248,161 Are you busy
185,637 Re: Forum
175,005 Need opinion
Powered by UBB.threads™ PHP Forum Software 7.6.1
(Release build 20180101)
Page Time: 0.015s Queries: 15 (0.004s) Memory: 0.9548 MB (Peak: 1.0789 MB) Zlib enabled. Server Time: 2018-07-22 22:02:49 UTC