… or how to equip your DIY project with MIPS or light ARM with a quick micro SD card.
Kind time of day to all dear community. I would like to continue my story about the box-device, namely about how she managed to get a micro SD card connected to the USB2 port.
The root of the whole problem was that USB 2, and not even one, has its processor module, and QSPI (QuadSPI) or card interface – alas, no. How does this sad fact relate to SD cards? Very simply, any SD-card in the physical basis of its connection has an SPI (SerialPeripheral) interface. The classic SPI for transmission and reception of serial data uses one physical line. Simply and economically, both in terms of money, and milliamps. However, shortcomings, as is known, are a continuation of merits, and for SPI it was primarily a relatively low data exchange rate. To solve this problem, a four-bit data exchange mode with an SD card was invented, which is a close relative of the QSPI protocol. When using this mode, the host controller and card first negotiate the parameters of the exchange in one-bit mode, and then switch to 4-bit mode, when not one line is used for reception and transmission, but four for everything about everything (plus one for indicating the command).
What to do if the hardware does not directly support the four-bit protocol, and fast exchange is still needed? The obvious answer is to provide the project with a "fast interface" bridge – a "four-bit SD card."
To solve this problem, a couple of USB-SD adapters were purchased and prepared (Vivisection was not used – we are not monsters ). Before heating the soldering iron and hair dryer, a very important check was carried out – whether Debian sees the processor module offered by the whistle-adapter. The test was a great success, welcome to the operating room. The bought whistle looks like this:
After the case was dismantled, it became possible to discern the printed circuit board (from all its two sides).
The scheme is simple, the basis of it is the IM GL823F – a microcontroller with the command system 8051 and with mask memory, equipped with a hardware interface unit USB 2, apparently not of very high quality (why I say so – I do not see the exact bias resistor of the analog part and the quartz oscillator, which means the frequency recovery from the received signal on the basis of morning calibrated generator). It will work, but not HiFi, no. All the rest – minimal body kit: blocking capacitors, pull-up and current-limiting resistors, LED and connectors, that's all the engineering.
Blow off the components with a hairdryer and look at the printed circuit board. By many features, the board is double-sided with the metallization of the holes. After a short examination of the board in a microscope, drawing the connection diagram and comparing it with the data-clock to the related IMS of GL, we restore the circuit diagram.
Here we begin to see one small quote. What is it exactly? Our box is powered by a guaranteed voltage of 3.3V, and the circuit on the GL823 requires 5 volts. Well, as required – she is so used to, because that's what she gives USB. The micro-SD itself is powered by 3.3V, so the built-in LDO stabilizer is added to the GL823. Hence the question – and if the circuit is powered by 3.3V, can it work? If the LDO can not drop a lot of tension, it can, but not all LDOs are equally useful. A small hint is given by the datasheet – the output that feeds the SD card is called PMOS. This abbreviation can not but rejoice – we can assume that the HighSide PMOS scheme is used, in which the voltage drop on the regulating element can be very small. However, all this is reasoning, and the only decisive argument is experience, he is also the son of difficult mistakes.
So, what kind of experience will we put? Let's try to feed the IMS with two switchable voltages – from 5V USB or from 3.3V, obtained by a separate stabilizer. Now we have enough knowledge to draw a schematic diagram.
The numbering of the components on the scheme is somewhat strange, because a multi-preparation with several more test circuits was ordered at the manufacturing plant of printed circuit boards, and all of them had end-to-end numbering. When preparing the article, I brought the schematic diagram into line with the photograph, and it turned out what happened.
What do we see on the diagram? It is clear that the core is GL823F. It is obviously connected to the micro-SD connector. The only thing that should be noted is pin 9 at the connector – it is a sliding contact of the presence of the card in the slot, when the card is in place, it is closed to the ground. С7-С10 – blocking capacitors on power circuits. If you want to improve the noise immunity a little, conclusions 2 and 16 DD1 can be connected through a ferrite choke. R4 limits the current through HL1, R5 pulls the GPIO line to one in the absence of a card in the socket. DA2, C11 and C12 form a linear voltage regulator of 3.3V.
Since at the time the diagram was being drawn, on the one hand, it was not clear how much it would consume, and on the other hand there was an unpleasant experience of using some USB-flash drives (will not show with a finger) consuming when writing to 400mA, it was decided to add R6. In general, this is a standard technique – with a noticeable consumption in the linear LDO scheme (the keywords here are LowDropout) to put in the input a low-resistance resistor of increased power and some heat dissipate on it, rather than on the stabilizer. Experience, however, has shown that there is no need for R6, and you will see it below in the photo of the board.
The XS4 is just for the experience – switching power supply DD1 between 5 and 3.3 Volts. XS2 is a standard USBB connector so that you can put it in front of you, rather than climb to free USB ports under the table to the PC.
Here's what happened after tracing, manufacturing PP and mounting:
As you can see, the underside of the board is completely uncomplicated, and the upper one is not much more complicated.
I'm not going to delay the denouement of the plot, I will immediately say that Experience has shown – to feed the GL823F from a 3.3V source is possible without problems, switching XS4 to anything other than the power consumption (not current) does not affect.
So Make sure that the board is working properly, you measured the recording speed and the current consumed for the three different micro SD cards. Photo contestants-in the studio!
Estimation of the current consumed (by measuring what was being done, my language can not be called) was produced with the help of such a combined current-voltage-quantity meter batteries. It was a surprise for me, I'll say frankly, that he also transmits USB data.
Only the indication of the consumed current was used, the price of division for this, if I may say so, Device – 0,01A, plus at least sampling error 1 unit of low order – another 0.01A. Therefore, only the ranges of readings are shown in the table, between which the current consumption figure was jumping. I hope, however, that those who are interested in applying the GL823 in their solutions will still be able to estimate the top consumption bar.
In addition to testing the board, a couple of control measurements were made with the help of another SD- kart. Here is this:
This sample was not prepared, I borrowed it for 5 minutes from my daughter, and if I gutted it, I would immediately gut it. One can say with certainty that the chip in it does not belong to the GL823 family, whose members can work as much with the SD standard, they can not have the multistandard.
The read-write speeds were measured in the simplest way: the same file size 1058268 Kb was written to and read from the test card. The control experiment (in another reading room) was conducted only in order to exclude system errors by one or two decimal order, the data on it were not processed, I was only convinced that approximately times and currents of consumption beat with those obtained at the previous stage.
If you want to apply the described circuit in your design, then when estimating the consumption, make a correction to the fact that the power supply current came from a USB voltage of 5 Volts, but the GL823 was powered by 3.3 V, and the difference of 5 -3.3 = 1.7 (and this is 50% of 3.3) was simply lost on DA2. With power from a centralized (and, I hope, impulse) 3.3 Volt source, a decent saving will result.