Flaky CF card - Page 1
Forum section: electronics / repair

author: kfitch42
author_rank: Frequent Contributor
timestamp: April 03, 2015, 04:08:31 am
content: In many ways this is a bit off-topic, but hopefully not too much...I recently took my Kiddos to Disney. We brought along our old DSLR, which uses CF cards. I bought a new 16GB card for the trip so I wouldn't have to empty the camera each night. Anyway, halfway through epcot the camera stops working and reports "ERR CF". After we got home I tried other CF cards in the camera, and they work just fine. i.e. I think the camera is working.When I plug the card into a USB CF card reader it doesn't get detected properly. If I use my linux box I see that it normally reports (along with tons of error messages) " 2177891984 512-byte logical blocks: (1.11 TB/1.01 TiB)". With enough reinserting, pluging, unplugging, replugging... I will occasionally see it detected as 16GB (with 30408336 512 byte sectors). When this happens I can't mount the filesystem, but I can dump (via dd) the raw device. I have gotten 3 of these dumps so far. The fun part is that they are each different from each other. After a bit of python-foo I discovered that they only differences are in the high bit of odd numbered bytes. Looking at the CF card spec I see that among the 50 pins it has D0-D15. So I suspect that D15 is flaky.I cracked open my cf card and cf card reader and buzzed all 50 pins, and to my limited abilities they all seem fine. Of course if it is a bad solder joint, then the pressure of the multimeter probe might be enough to make the connection.Note that the number of sectors in 'bad' mode is 2177891984=0x81cffe90 and when it sort-of works we have 30408336=0x1cffe90. Again it looks like a high bit got set (possibly D15 ?)The odd part is that we almost always get the bad bit in the size, but the bad bits in the data are much more rare. we seem to get a bunch then none for a few megs, then a bunch more....Also, if I open the dumps in a hex editor I can find things that look like JPG images, including things like the camera model name in the EXIF data (occasionally with every other character garbled).QUESTIONS/THOUGHTS:1) The CF spec says that the cards can operate in an 8-bit mode, where D8-D15 are unused. That sounds like it might work (albeit slowly), but how can I do that? Are there magic Linux commands to do this? Is there a particularly flexible card reader out-there that can do this? I guess I could use an Arduino (or other dev-kit) to do it by hand... but that sound EXCRUCIATINGLY slow... puling 16GB via an Arduino might take a lifetime or three2) The CF card has what appears to be a BGA controller chip ( PHISON PS3016-P9-R ). Should I try to borrow a hot-air station and try to reflow it, and the connector?3) There are four flash chips on the CF card. I guess the extreme solution would be to desolder them and get a flash chip reader. Of course reassembling the filesystem from what is on the four chips might not be trivial, depending on how fancy that controller is.

author: amyk
author_rank: Super Contributor
timestamp: April 03, 2015, 04:42:30 am
content: I wouldn't try to reflow the controller but perhaps gentle pressure could help. Make sure the connector's pin is making contact, of course.

author: sleemanj
author_rank: Super Contributor
timestamp: April 03, 2015, 04:57:13 am
content: https://www.google.co.nz/search?q=compact+flash+8+bit+modeIn particularhttp://www.waveguide.se/?article=8-bit-compact-flash-interfacehttp://www.retroleum.co.uk/electronics-articles/an-8-bit-ide-interface/Also thishttp://www.sparkfun.com/datasheets/BreakoutBoards/c0201mspdf.pdf

author: kfitch42
author_rank: Frequent Contributor
timestamp: April 03, 2015, 01:35:24 pm
content: Quote from: amyk on April 03, 2015, 04:42:30 amTo the best of my abilities putting pressure on the controller chip doesn't seem to help. AFAICT the pins are making contact. I am pondering taking a dremel to the plastic shroud to get access to the actual connection so I can try to make it (at least pin 31, aka D15) a little tighter.

author: kfitch42
author_rank: Frequent Contributor
timestamp: April 03, 2015, 01:58:09 pm
content: sleemanj,Oh, great, now I just need to find an IBM XT.I might try to build up one of those adapters and try to drive it from my raspberry pi. I was just hoping I could find a shortcut around having to write code to drive the 8-bit interface. Although I might be able to shortcut some of the work (in particular getting/soldering the SMT CF connector) with something like this:http://www.monoprice.com/Category?c_id=104&cp_id=10407&cs_id=1040705

author: abyrvalg
author_rank: Frequent Contributor
timestamp: April 04, 2015, 08:32:35 am
content: You can try cracking your cardreader's case too and soldering a wire bridge directly from CF's PCB to reader's PCB on D15.Reading the chips will be almost useless - the data is scrambled (neighbour cells disturb prevention pattern). But moving the chips into same model working CF should work.

author: Orange
author_rank: Frequent Contributor
timestamp: April 04, 2015, 11:13:59 am
content: Is the CF card a Kingston, as in the picture below ?http://chyvack.livejournal.com/32439.htmlJust curious which brand to avoid

author: McBryce
author_rank: Super Contributor
timestamp: April 09, 2015, 01:50:11 pm
content: I'd try reading it with ZAR (Zero Assumption Recovery) first. It may be just corrupted data. The Freeware version should be enough to get the files back off it.McBryce.

author: Grapsus
author_rank: Regular Contributor
timestamp: April 09, 2015, 03:22:59 pm
content: Try gently flexing the PCB in different directions or maybe freezing the BGA chip with an air duster upside down. You can make a simple shell script that waits for the device to be recognized with the right size (use blockdev --getsize64) and images the block device (use dd). In that way you could use your both hands to make the CF card work and as soon as it makes contact, the computer would grab the data.

author: McBryce
author_rank: Super Contributor
timestamp: April 09, 2015, 07:43:16 pm
content: There's no reason to believe it's definitely a hardware problem just yet. I'd avoid flexing a PCB with a BGA chip on it until I'm sure that the hardware really is faulty. You might just create a new problem.McBryce.

author: wraper
author_rank: Unknown
timestamp: April 09, 2015, 07:52:52 pm
content: Do you have any other CF card of such size? It could be that your camera and card reader just do not support it properly. And IMO reflowing wont make any change except destroying it.

author: mikerj
author_rank: Super Contributor
timestamp: April 09, 2015, 08:49:07 pm
content: In the top picture, is the solder bridge between connector pins 15 and 16 (counting from the left) supposed to be there?

author: McBryce
author_rank: Super Contributor
timestamp: April 09, 2015, 09:12:16 pm
content: I don't think that's a solder bridge, it's just a spec of dirt or plastic from the casing.McBryce.

author: kfitch42
author_rank: Frequent Contributor
timestamp: April 11, 2015, 02:01:04 am
content: Yes, it was a Kingston card.The apparent solder bridge was just a speck of dust.I ordered a couple of CF to IDE adapters, and plugged the card directly into the motherboard. The BIOS would at least partially recognize the card (printing out the model number during boot), but the OS (linux) wouldn't recognize it at all. It didn't/wouldn't create the /dev entry. A working card in the adapter worked just fine. I wrote a quick/dirty program to read the card using old-school port I/O, just like in the old DOS days (ports 0x1F0-0x1F7 and 0x3F6) . I turned off interrupts and put the card in 8-bit mode. At which point I could read the entire card just fine. It wasn't fast, and it chewed the CPU, but several hours later I had a disk image that I could extract JPGs from (using a program called photorec), I probably could have mounted the disk image, but never tried.So in the end it all worked out. But, I also built up about half of the adapter to connect the CF card to the GPIO pins on my Raspberry Pi. I have to say I love the movement from parallel buses to serial buses. 40-pin IDE, 50 pin CF... they make my wiring look like a spaghetti dinner

author: Grapsus
author_rank: Regular Contributor
timestamp: April 11, 2015, 02:14:10 am
content: Wow, you have all my respect ! Congrats on getting your data back. Luckily the bad line was a one that's not required in 8 bit mode.I'd be interested in the code if you can post it. The linux IDE drivers support various PIO modes, you can set it for a particular drive with "hdparm -p". I wonder if you can read your card in that way.

author: amyk
author_rank: Super Contributor
timestamp: April 11, 2015, 01:34:49 pm
content: Quote from: kfitch42 on April 11, 2015, 02:01:04 amBut at least parallel buses are usually lower frequency and easier to interface to (provided you have enough I/O)... you wouldn't be able to connect SATA without a bridge IC. No minimum clock rate for IDE also helps.

author: kfitch42
author_rank: Frequent Contributor
timestamp: April 14, 2015, 03:43:12 pm
content: Quote from: Grapsus on April 11, 2015, 02:14:10 amMaybe I am not smart enough, but I couldn't find a way to tell hdparm to tell the linux IDE drivers to use 8-bit transfers.I attached the code. It is seriously quick/dirty/hacky.

author: kfitch42
author_rank: Frequent Contributor
timestamp: April 14, 2015, 03:44:38 pm
content: Quote from: amyk on April 11, 2015, 01:34:49 pmYes, you are quite right. I was just ranting/grumbling

author: Grapsus
author_rank: Regular Contributor
timestamp: April 15, 2015, 10:26:22 am
content: Quote from: kfitch42 on April 14, 2015, 03:43:12 pmHey,Thanks for the code, I don't find it dirty, it's straight to the point. What is the output of your program for your card ? In particular the PIO field. I'll try reading a CF card with your program and then with the linux driver after some hdparm tweaking. Just out of interest, since you already got your data back.