Some success with writeCID

Why do you want to write the CID?

normally the CID is used for identification & protection of apps on SDcard IIRC?

I need to copy protect my application + impress my friends. I don't think its a difficult task. Unfortunately information is not readily available for a DIYer like me.

CMD26 is reserved. If your card allows CMD26, it may not work properly.

CMD26 should not be supported in SPI mode.

From the SD association:

CMD26 PROGRAM_CID

Programming of the card identification register. This command shall be issued only once. The card contains hardware to prevent this operation after the first programming. Normally this command is reserved for the manufacturer.

Hi,

I know the docs say CMD26 is reserved and it will not work on SPI mode etc... Obviously some SD manufacturers are not bothered. I don't think it is illegal to write to CID or to exploit the cheaper SD card features provided against the spec.

If no one has used CMD26, then anyone know how to use CMD27? I think CMD26 will also work the same way with required data size.

Thanks, Harshana

Guys...,

Can someone help me on this ?

Thanks, Harshana

When you use CMD27 you must only change the writable part of the CSD. The other data must match the read only part in the CSD.

You must use the correct value for the CRC field in the register.

These are the three bits you can change but only TMP_WRITE_PROTECT can changed back.

• COPY Defines whether the contents is original (=0) or has been copied (=1). Setting this bit to 1 indicates that the card content is a copy. The COPY bit is a one time programmable bit except ROM card. • PERM_WRITE_PROTECT Permanently protects the entire card content against overwriting or erasing (all write and erase commands for this card are permanently disabled). The default value is 0, i.e. not permanently write protected. • TMP_WRITE_PROTECT Temporarily protects the entire card content from being overwritten or erased (all write and erase commands for this card are temporarily disabled). This bit can be set and reset. The default value is 0, i.e. not write protected.

Thanks fat16lib for the reply.

OK I understand that I need to be careful when writing to CSD as PERM_WRITE_PROTECT will make my SD unusable (unless I have anything useful for reading). My query is how do I use CMD27.

I can use SD2Card cardCommand(27, 0) and get the response. How do I write the data that goes into the register?

if (ret = cardCommand(27, 0)) { Serial.print("CMD27 failed :"); Serial.println(ret, HEX); return false; } else Serial.println("CMD27 worked");

spiSend(data1); // send 1st byte spiSend(data2); // send 2nd byte spiSend(data3); ... spiSend(datan);

Will this work ? Doesn't want to try this and ruin the card.

Thanks again Harshana

Hi fat16lib, looks like you are my only hope.

Any improvement on modyfing SD CID registers?

Hi all,

There’s been inquiries on what happened on this project. This is to update all of you who are still searching for a solution.

I was not able to continue on this project after the roadblock I came across. I would love to hear from anyone who got it working. As per SD cards, go for cheap / unbranded SD cards, they will most probably support CID to be written.

Thanks,
Harshana

Hi all. Ok, I want to take a chance. I need some informations, though. Somebody wrote about cheap MMC or SD cards. I guess they could even be counterfeit or fake cards but which they allow CMD26. So, someone could tell what cards (brand and model or manufacturer) surely accept CMD26? Honestly I tried to find them but no joy. Where have you found them? That said it would be possible go ahead otherwise we are stuck no way out and without any possibility, hence it's game over. Another thing which could be important and useful to know is the way you need to send CMD26. I wonder if you need to send it in SPI mode or MMC mode. I guess the correct way is through SPI mode. This is because I know Arduino generally manages SD/MMC in that way and here in the beginning of the thread someone wrote about modified SD2Card library in order to change/rewrite CID. Though I could be wrong on this. Any answers based on your experience will be welcome. Thanks in advance!

AR

Hey you had any further progress changing the CID?

Hi Bucky101, sadly no, no progress. I'm pretty sure I'd be able to do the job but unluckily I can't find the right SD/MMC. I have contacted many manufacturer but nobody gave me even only one single piece. They ask to buy a lot of pieces, only few pieces are out of business on their point of view so they don't sold few pieces. All this stuck me. That is. But I don't give up!

AR

After few months of research and development I finally figured out how get this working. hranmuthu, I was able to send CMD26 via SPI and got permanent result (New CID) But it's more complex then just sending the command I was able to succeed with 2 major manufacturers out of 4 and each controller needs different methods. It is possible but very time consuming since you will need to come up with different ways for different controllers. Also Creating something (Universal) that will work with every controller is almost impossible.

Can you explain how to? Please?

legno75: Can you explain how to? Please?

As i mentioned on my post, I did a lot of experiment and reverse engineering on manufacturers firmwares It's not just sending CMD26 on SPI mode. You need to knock SD or MicroSD Card into firmware mode. Once done, They do accept CMD26 and Permanently accept new CID Values.

Hi DavidLE,
glad to read that you succeeded!
Please, could you tell exactly with which cards you were able to do that successfully?
You wrote 2 major manufacturers out of 4, but what exactly?
Were MMC or SD? (I guess SD and uSD)
What model exactly?
An interesting thing would be if you could provide original CID and CSD of the cards that you have been able to change, is it possible?
Knowing it would be possible to understand their manufacturer date and other useful parameters.
I know I asked for a lot of informations and I hope you will answer.
(Even if I’m pretty sure that your statements are based on something like this old document here

so actually your answer has to be interpreted academically rather than like a possible solution to the problem, being in the facts that in real life the things are far from being as you have described them.
Hence there will be no any reply.)
Anyway, you wrote that each controller needs different methods, I guess you mean working on different cards produced by different manufacturer’s brands.
Once you can reach the target with a certain type of cards produced by a specific manufacturer, then surely you can repeat the job on others cards which are the same as model, brand and manufacturer.
You wrote that it is possible but very time consuming do the job since you will need to come up with different ways for different controllers and also creating something (Universal) that will work with every controller is almost impossible.
I partially agree.
I don’t know what do you mean about the different ways for different controllers you wrote, but in my opinion I think with the right cards isn’t too hard to achieve the goal.
I’m pretty sure I’d be able to do the job but unluckily I can’t find the right SD/MMC.
So please, explain exactly with what kind of cards you were able to do the job possibly specifying their manufacturer, brand, type CSD and original CID (in order to know their manufacturer date).
Thanks in advance.

You also wrote that it’s not just sending CMD26 on SPI mode and it’s need to knock SD or MicroSD card into firmware mode, then once done, they do accept CMD26 and permanently accept new CID values.
That would not be a problem always working on the same type of cards.
Anyway I think it isn’t so complex, the real trick is to have the right cards, IMHO

AR

Somebody has news about change of CID? I found that CMD60 on SiliconMotion controlers transfers SD to the mode when the card doesn't respond to CMD26 to Error.

Hi Alexel, sadly no new news for now. Anyway, what do you mean by writing that you have found that CMD60 on SiliconMotion controlers transfers SD to the mode when the card doesn't respond to CMD26 to Error? Thanks.

AR

Seems like you guys are on right path :) I can share limited info thru PM

Thanks