[Reverse engineering] USB - Micro SD-kaart lezer / schrijver

INTRO
Voor een projectje was ik op zoek naar een IC'tje waarmee je een SD-Card kunt uitlezen via USB. Na wat zoekwerk op diverse sites ben ik een leuk geprijsd IC'tje tegen gekomen : GL827L. Deze is in vele behuizingen beschikbaar volgens de fabrikant. Vervolgens ben ik op zoek gegaan naar een schema en / of een datasheet voor dit IC. Dat bleek een stuk moeilijker te zijn. De fabrikant (Genesys Logic Inc) heeft wel wat informatie op de site staan, maar geen datasheet. Wederom veel zoeken leverde 2 datasheets op. De ene is vrij beknopt (20 pagina's), de ander is vrij uitvoerig (47 pagina's) en zijn bijgesloten in dit topic. Echter, in beide datasheets ontbreekt een schema voor het aansluiten op een SD-Card.

Tsja, dus ik zat met een probleempje. De volgende stap is dan om een kant-en-klare "stick" te bestellen via eBay, met het doel om het te reverse-engineeren.

http://www.uploadarchief.net/files/download/gl827l_img.jpg

Zoals je kunt zien zit de SSOP28-versie op de print. Eergisteren kwam het binnen en vervolgens ben ik druk bezig geweest om het schema in Eagle over te tekenen. Ik kom dan uit op het volgende schema :

http://www.uploadarchief.net/files/download/gl827ls.jpg
(Aanklikbaar voor grotere afbeelding)

Op zich lijkt er niets loos, totdat ik uit voorzorg de datasheets ging napluizen om bepaalde zaken te verifieeren.

De standaard SSOP-28 behuizing in Eagle blijkt groter te zijn dan het werkelijke IC'tje. Ik heb het IC'tje (SSOP-28) daarom nogmaals in een Eagle library nagetekend volgens de uitgebreide datasheet (zie pagina 46). Daarna dook ik in de gegevens van de pin-aansluitingen (pagina 18). En juist daar kwam ik zaken tegen, waardoor ik begon te twijfelen.

Hieronder de pin-aansluitingen :

code:


  GPio1 - pin 1     pin 28 - GPio0
  PMOSO - pin 2     pin 27 - GPio3
   DVDD - pin 3     pin 26 - MS_INS
     X1 - pin 4     pin 25 - D2
     X2 - pin 5     pin 24 - D3
    GND - pin 6     pin 23 - D4
   AVDD - pin 7     pin 22 - SD_CMD
     DP - pin 8     pin 21 - D5
     DM - pin 9     pin 20 - SD_CLK
   RREF - pin 10    pin 19 - D6
   DVDD - pin 11    pin 18 - D7
    VP5 - pin 12    pin 17 - D0
EXTRSTZ - pin 13    pin 16 - D1
SD_WPZ  - pin 14    pin 15 - SD_CDZ

VRAGEN
Op zich is het getekende schema best logisch, ook volgens de datasheet. Er zijn echter een paar kleine puntjes waardoor ik ben gaan twijfelen. Dat komt met name door pagina 20, de 3e data-kolom in de datasheet. Die gaat tenslotte over de SSOP28-pinnen. Ik wordt in de war gebracht door de beschrijvingen van een paar pinnen. Vandaar dat ik mijn vragen hier op CO stel.

Pin 13 (EXTRSTZ)
Pin 13 is met een 10K Pull-up aan 3V3, en het signaal is ontstoord met een 100nF naar GND.
In de datasheet lees ik : External reset.
De pin is Active Low, maar is via een 10K pull-up aangesloten. Moet ik dit zien zoals bij een AVR, die je op identieke wijze laat resetten ? Dus alleen als je het even naar GND trekt, dan pas reset de chip zich ?

Pin 14 (SD_WPZ)
Deze pin is rechtstreeks verbonden naar GND (0). Het zou gaan om een write-protect detectie, volgens de datasheet. Verder staat er aanvullende informatie : Bij gebruik van een SM of SD-kaartje, is de pin "pull-up" en active low.
Hmm,. is mij onduidelijk, maar klopt het dat indien een SD-kaart wordt gebruikt, dat deze pin dan naar GND getrokken moet worden ?
Met andere woorden, bij gebruik van SD-kaartjes, wordt deze pin niet gebruikt voor write-protectie ?

Pin 15 (SD_CDZ)
Deze pin is floating. Zodra een SD-kaart aanwezig is, wordt deze naar GND (0) verbonden, volgens het schema.
De datasheet zegt : SD-kaart detectie. Normaal is ie high (3V3 ?) en Active Low. Deze pin is echter floating, en alleen indien een SD kaartje aanwezig is, wordt het naar GND getrokken. Tsja, ik zie dat het werkt, maar is het wel correct aangesloten in het schema ?

Pin 28 (GPio0)
Deze pin is verbonden met een LED. Zodra een kaart aanwezig is, brand de LED. Ik zie in de datasheets niets vermeld over het aansluiten van een LED op deze pin. Het enige waar ik iets tegenkom over een LED is GPio3. Of is dit een pin die een LED kan aansturen, wanneer 5V van de USB-poort aangesloten is ?

TOT SLOT
Goed, van een kant kan ik zeggen : het ding werkt, dus gebruik het schema zoals ge-reverse engineered. Van de andere kant, stel dat het geen origineel IC is, dat ik hier heb liggen ? Juist dan is het goed om dit te ontdekken middels de datasheet (en jullie hulp). Kortom, komt het uitgevogelde schema overeen met de gegevens uit d datasheet(s) en dan met name de gevraagde pinnen ?

Van de andere kant, CO heeft een primeur : een interessant schema van een USB naar micro SD-card reader/writer (GL827L) incl. afbeeldingen en datasheets.

Van elk bezoek aan CO leer ik weer meer...

Uit de datasheet:

Embedded 8051 micro-controller
- Embedded 48K Byte mask ROM and internal 256 byte SRAM

GPIO is "general purpose IO", en kan worden aangestuurd vanuit de ingebouwde microcontroller. Het hangt er dus een beetje van af hoe deze is geprogrammeerd. Het kan zomaar zijn dat de fabrikant van deze USB cardreaders zelf firmware heeft aangeleverd wat in de mask ROM is gezet bij de fabricage van de chip.

[Bericht gewijzigd door mbbneon op dinsdag 24 mei 2016 07:11:25 (13%)

waarom niet gewoon opbouwen en uittesten?
eventueel usb chipje met het uwe eens wisselen en zien of alles nog werkt.

pin13: active low betekend volgens mij dat die reset actief is als je hem laag trekt (dus aansluiten aan massa = een reset). met pullup naar +vcc is dus de reset niet 'ingedrukt'.
met die condensator is dat volgens mij gewoon een vertraging. als de spanning erop komt, is die condensator een verbinding naar massa.
het ic kan opstarten op de spanning, de condensator wordt geladen en geeft dan de reset vrij. zo weet je zeker dat het IC telkens in dezelfde config opstart. zonder die condensator weet je niet of het ic wel goed gestart is en kan éénder waar blijven hangen

pin15 is beetje nasty gedaan, goedkope chinezen weer. misschien dat die intern op 3.3V zit en dat je enkel naar massa hoeft te trekken? er zal misschien een interne pull up in zitten

[Bericht gewijzigd door fcapri op dinsdag 24 mei 2016 08:07:30 (12%)

ik hou van werken ..., ik kan er uren naar kijken

@mbbneon:
Omdat de chip verhandeld wordt, dacht ik dat het kant-en-klaar van de fabriek kwam. Dus, kwestie van op PCB zetten en gaan. Maar wat je aangeeft over de mask-ROM is ook aannemelijk.

@fcapri:
Ik zou een ander USB-chipje erop kunnen solderen. Ik heb ze nog niet besteld, maar als ik ze bestel dan is de minimum afname 30 stuks...... Ik ga nog even nadenken, wat ik ga doen.
Verder bedankt voor wat je schreef over de andere pinnen. Ik zat ook te denken aan een interne pull-up bij pin 15. Wat betreft die pin 13 lijkt het veel op de constructie die ik ook toe pas bij een RST-pin van een ATMega.

Ik denk dat ik een batch GL827 ga bestellen en testen. Als dat goed verloopt, kan ik naar de volgende stap in het project. Komen ongetwijfeld ook weer vragen uit voort. Wordt dus vervolgd.

Van elk bezoek aan CO leer ik weer meer...
klein is fijn

Moderator

Eerste hit in Google images.

http://www.go-gddq.com/upload/2013-12/13121216441115.jpg

Daar moet je toch aardig wat uit kunnen halen.

Zoek bij Microchip naar de USB2240 USB to SD bridge er zijn nog veel meer types heel goed leverbaar !.

P.

Pin 14 heeft waarschijnlijk een externe pullup nodig. Die gaat naar het schakelaartje in het SD slotje. Zo kun je de kaart write protecten.

In het datasheet staat B/I, f => dat is volgens hun dus floating.
Ik zou zeggen dat het gewoon fout in het printje zit en dat het toeval is dat het werkt. Als het echt blijkt dat er toch een interne pullup in zit kun je de weerstand nog altijd weglaten.

Verder zou ik de write protect wel degelijk aansluiten. Het is erg handig als je de card kunt write protecten. Al is het maar om virussen te weren van de card of het perongelijk kapotschrijven te voorkomen.

Voor pin 15, daar zit een intere pulldown in (B/I,pd). Dus of de switch staat fout in je schema en moet naar de +3V3 of het is af fabriek al fout en is de card altijd gedetecteerd.

1-st law of Henri: De wet van behoud van ellende. 2-nd law of Henri: Ellende komt nooit alleen.
Arco

Special Member

Pinnen hebben al interne pull-up/down, zie tabel (pu en pd)...

Arco - "Simplicity is a prerequisite for reliability" - hard-, firm-, en software ontwikkeling: www.arcovox.com

Pin 14 dus niet! Daar staat een 'f' achter. Die text die erachter staat is waarschijnlijk in krom Engels vertaald en dekt de functionaliteit niet helemaal.

1-st law of Henri: De wet van behoud van ellende. 2-nd law of Henri: Ellende komt nooit alleen.

@KIF :
Die ben ik niet tegen gekomen in mijn zoektocht. Toch goed dat je het hebt gevonden en hier post. Wanneer ik het eens nader bekijk, zie ik dat er wat dingen overeen komen, maar in het schema is te zien dat D0 met DAT1, en D1 met DAT0 is verbonden. De pull-ups die op het printje zitten, zijn niet in het Google-schema.

@IoT :
Ja, er zijn inderdaad meerdere IC's beschikbaar, maar de GL827 is voor mijn toepassing interessant : pootjes om te solderen.

@henri62 :
Goed dat je het meldde van die pull-up ! Tussen pin 11 (DVDD) en pin 14 (SD_WPZ) meet ik 220K. Daar zal wel een interne pull-up voor verantwoordelijk zijn.

Over pin 15 en GND / pin 15 en DVDD meet ik in beide gevallen iets van 8 MOhm. Meet ik omgekeerd, dan 12 MOhm. Zodra de "stick" in de USB-poort zit, staat er 3.3V op pin 15.
Vervolgens kan ik via een diode-meting ook diverse spanningsvallen zien als ik de stick niet op de USB-poort aansluit. Ik krijg het idee dat hier iets van een soort switch zit.

Ik weet voorlopig voldoende, vooral dankzij jullie informatie. Heel erg bedankt !

Van elk bezoek aan CO leer ik weer meer...

hola estoy tratando de hacer el circuito que has publicado, pero no logro hacer que funcione, podrías ayudarme?

Google translate:
Hi, I'm trying to make the circuit you've published, but I can not make it work, could you help me?

[Bericht gewijzigd door GJ_ op vrijdag 16 november 2018 08:04:55 (0%)

Arco

Special Member

Arco - "Simplicity is a prerequisite for reliability" - hard-, firm-, en software ontwikkeling: www.arcovox.com

No problem. Here is a screenshot (PCB), designed in Eagle :

https://www.uploadarchief.net/files/download/gl827_pcb.jpg

Schematics for GL827 (clickable to get better details)
https://www.uploadarchief.net/files/download/gl827s.jpg

Van elk bezoek aan CO leer ik weer meer...

He realizado el mismo circuito de la imagen, pero no logro hacer que funcione cuando lo conecto al pc. Creo que el problema esta en el pin 13 y no logro solucionarlo.

Google translate:
I have made the same circuit of the image, but I can not make it work when I connect it to the PC. I think the problem is on pin 13 and I can not solve it.

[Bericht gewijzigd door GJ_ op vrijdag 16 november 2018 08:06:19 (48%)

Please use Google translate to convert your Spanish into English. By this, more people at this forum can understand and maybe help you.

Please check page 19 (datasheet).
For pin 13 :
External reset. It is active low. The low pulse should be 1 us width at least.

My first guess is : you maybe bridged (short cut) the 100 nF capacitor at pin 13 to Gnd or no good connection for this capacitor or the 10K pull-up resistor . Can you make a photo and share it overhere ? Just to get more details visible about your Printed CircuitBoard (PCB) ?

I've integrated this schematic for another type of board, but it works fine, whenever I connect it to USB-port.

P.S. Did you check / verify the USB-connector and cable, you use ? Just to be sure it's not a damaged cable or poorly soldered onboard USB-connector. (I have had my experiences about this issue in the past)

Van elk bezoek aan CO leer ik weer meer...

MicroSD heeft helemaal geen (fysieke) write protect zoals die bij full size SD wel er is. Bij SD kaartjes zit aan de zijkant een klein schuifje dat in het slot wel of niet een contact indrukt (net zoals de SD detect), dit is dus een puur mechanische write protect, net zoals vroeger bij diskettes.

Meep! Meep!

Wat is het doel van deze oefening eigenlijk? Ga je die microcontroller ook nog met een microcontroller lezen en schrijven, of zit hij nergens anders aan vast? Waarom neem je dan niet zo'n compleet printje als je het zelf toch nagenoeg identiek tekent in hetzelfde formaat? je

Een manager is iemand die denkt dat negen vrouwen in één maand een kind kunnen maken

Thank you very much, Oxurano, I was finally able to make it work, the problem apparently was the integrated one. Several came out defective, from the lot I bought in China.

Now I have another problem, apparently it crashes and stops working when it has been connected to the PC for a long time and it blocks my computer.

Do you know how to correct this?

I used the google translator so they can understand better

Op 16 november 2018 05:26:28 schreef oxurane:
Please use Google translate to convert your Spanish into English. By this, more people at this forum can understand and maybe help you.

Please check page 19 (datasheet).
For pin 13 :
External reset. It is active low. The low pulse should be 1 us width at least.

My first guess is : you maybe bridged (short cut) the 100 nF capacitor at pin 13 to Gnd or no good connection for this capacitor or the 10K pull-up resistor . Can you make a photo and share it overhere ? Just to get more details visible about your Printed CircuitBoard (PCB) ?

I've integrated this schematic for another type of board, but it works fine, whenever I connect it to USB-port.

P.S. Did you check / verify the USB-connector and cable, you use ? Just to be sure it's not a damaged cable or poorly soldered onboard USB-connector. (I have had my experiences about this issue in the past)

i suspect crappy replica chips from china

ik hou van werken ..., ik kan er uren naar kijken

@SparkyGSX:
Ik had het schema zo getekend om te achterhalen hoe het werkte. Zoals je kunt lezen, was ik toen aan het twijfelen vanwege diverse aansluitingen, waaronder pin 15.

Vervolgens heb ik dit ontwerp toegepast voor de bouw van een stand-alone Atmega-programmer. Ik vond het wel makkelijk om dan ook een geintegreerde USB naar Micro-SD in het apparaatje te hebben.
Ik geef grif toe, dat het een luxe-probleem is, maar verdomde handig is, als iets dergelijks in het apparaatje zelf verwerkt zit.
Misschien dat een programmeerbare microcontroller het ook wel kan aansturen, maar ik kon er geen gegevens over vinden hoe dat in z'n werk zou gaan.

@Matews20182 :
Good to see you use Google-translate !

Concerning the next problem which occurs, I fully support the suggestion by fcapri : if you noticed some ICs you bought in a batch malfunction,... don't be suprised more are not working correct.

However, how did you manufacture your PCB ? Did you create and developed it yourself, or did you design it and got it manufactured at a PCB-factory ?
If you did it all yourself, please check your PCB for miniscule short-cuts. When etching, this may occur.

Also, re-check each solder-joint at your board. It happened to me also, especially when soldering mini USB-B sockets. Pins are small, and are difficult to reach. A hint : use solderflux, added to the pins at the connector and the solderpads at the PCB. You won't be the first person who -by mistake- connected 2 adjecent pins together by a tiny solderblob. Always verify such joints by a multimeter.

Maybe, it's time to show a picture of the module you created. By this, you offer people the option to check it also for you. If you designed an alternative circuit around it, and are afraid sharing a bright idea, just take a shot at the USB to Micro-SD converter GL827L.
Trust me, we love to see pictures. Not to steal bright ideas but to improve the support for you.

Van elk bezoek aan CO leer ik weer meer...

Hello everyone, my name is Mateo and I'm from Colombia. First I tell them that I installed the circuit in my project and trusting in the work done, I sent the plates to China (PCBWAY). I did the welding process and the problems appeared (it did not work), then I installed the micro USB reader circuit on a test board and it is precisely where I am working. (photos attached). The only modification has been to add a second LED to know when the device turns on (Pin 27) and change the resistors of both LEDs to 330 ohms

What I try to do is read the data registered by arduino in a microsd, directly from the PC without having to extract the card from the project.

Moments before writing this answer, everything worked fine, but now it does not want to work (and I have not modified anything). I think the IC ended its useful life. On the other hand, I would like to know where I can acquire the original GL827L and thus avoid so much trouble in my project.

Breadboard-setups like that usually don't work rather well with the thick-pinned headers featured on break-out boards: I destroyed quite a few breadboards pushing in those thick pins. If they do work, contact isn't very reliable.

Besides that, I see that you connected a crystal and a few timing capacitors to an IC with rather long wires. Try to get both the IC's and the caps as close to the IC as possible and don't use long wires, as this could lead to problems with timing.

Possible problem number 3: I have the same test-wires and a few have had their connection between wire and pin terminated within the black 'support'. This means there is no connection while you can't see that.

http://www.m-voorloop.nl --- Ik? Welnee! Ik zit nog lang niet achter de germaniums.

Thank you very much for your comments, I also had the doubt that the problem was due to all the cables that should be used on the test board.

I can not understand the problem # 3 that you pose, what do you mean?

I mean the wires with pins attached to them to make inserting them into a breadboard easy.
Inside the black plastic cover, where the wire goes from wire to pin, the wire is soldered to the pin.
But I've had a few where the solder connection inside failed, making no contact anymore.
With the black plastic cover around it, you can't see that there's an open connection inside, so you can spent ages looking for the problem.

Check the cables with a multimeter for continuity if all else mentioned isn't the problem.

http://www.m-voorloop.nl --- Ik? Welnee! Ik zit nog lang niet achter de germaniums.

I tested the continuity of the cables and placed the 12 MHz closest to the IC. What I can see is that the Pin2 (output voltage for microsd) is 1.38 volts and not 3.3V as it should be.

I do not know what could cause this, but when I put Pin13 in GND directly in the form of a pulse (connect and disconnect), the integrated one starts working immediately.