   ____________________________
  | \                          \              elementhw.com
  |  |                          |             ilnx.cz  
  |  |--------------------------| 
  |  |  CheckSD           v1.0  |__
  |  |==========================|  \
  |  |                          |   |
  |  |  programmed by Lanex     |   |
  |  |  2026-01                 |   |
  |  |              ___________/    |
  | /         _    /                |
   ----------´ ---´    m i c r o    |
      |  |                   S D    |
      |  |             ____________/
      | /        _    /  
       ---------´ ---´


The CheckSD application checks the integrity of SD cards,
whether they are formatted or not. Supported card types
include SDHC and SDXC (i.e. all cards larger than 2 GB).
SDSC cards are not supported because they are obsolete.

After starting, the program checks whether cards are inserted
in both slots. On the home screen, it displays "Detected" or
"Insert SD card" for each SD slot. Here, you can now change
SD cards as you wish (plug-and-play). 

Once the card is recognized, its parameters are displayed:
- manufacturer ID (Man.ID)
- OEM name and product name (OEM/NM)
- hardware revision (Rev.)
- serial number (S.N.)
- date of manufacture (P.Date)
- card capacity (Size)


Controls
--------------------------------------------------------------

Press the "1" or "6" key to start the card test. The program
checks sector by sector and does not address the file system
in any way (the tested SD card can have any "filesystem").
During the test, several types of errors are detected:
communication errors, card controller errors, sector errors
and other errors.

Controls during testing are:

 - "R" key           reset graph
 - "1" to "5" keys   graph speed
 - "6" to "0" keys   text refresh speed

It is not recommended to remove the card during testing.


Parameters on the test screen
--------------------------------------------------------------

"R1 Time" is the time taken by the card to receive the
command in microseconds. This time is usually between 2 and
4 microseconds, so it is very short. If the card misses or
ignores the command, the program will try to repeat it 5
times. Each time, a counter called "R1 repeated" is
incremented. After the fifth attempt, it reports an error,
which is counted in "R1 timeout." Then another sector is
tested.

"Token time" is the duration of data exposure by the card.
During this time, the card searches for the location of the
sector in the chips and performs the subsequent copying of
data to internal memory. If everything is okay, the card
responds that it is ready to send data and begins sending
this "token data". If DToken does not arrive after a longer
period of time, it will attempt to repeat the request 5
times. The attempts are counted in "DToken repeated". After
the 5th unsuccessful attempt, the value of "DToken timeOut"
is increased and the next sector is selected.


Data "migration"
--------------------------------------------------------------

The data exposure time lasts between 100 and 200 microseconds.
However, sometimes the card needs to "move" the data, which
for some cards can take up to 200 milliseconds, i.e. 1000
times longer than usual. This time varies between different
manufacturers. Currently, SanDisk performs best in this
respect.

"Moving" means that the card moves the data to a new block.
It then modifies the entry in its internal table to indicate
that the LBA (logical block addressing) with this number is
now located elsewhere. The card cannot simply take the data
and write it back because the memory block on the card has
a very limited number of writes. However, it cannot restore
them by simply reading them, as DRAM does. Therefore, the
card moves the data to a new, fresh block, ensuring even
wear on all blocks.


SD card errors
--------------------------------------------------------------

R1 TimeOut and DToken TimeOut are SD card communication
errors. However, the card may also respond with its own
error, namely:

 - Error         - general, unspecified card error
 - CC Error      - SD card controller error, the controller
                    is not working
 - ECC Error     - incorrect sector/block checksum
 - Out of Range  - the requested sector does not exist 
                    on the card


ECC error
--------------------------------------------------------------

This error indicates that the SD card is no longer able to
store data. This also happens with cards that are in good
working order. In such cases, the controller restores the data
and then "moves" it to another block. It marks the original
block as free and tries to use it as late as possible.

The user will not notice the "migration"; it is a normal
function of SD cards. The charge in the block discharges and
needs to be refreshed from time to time in this way. When the
card returns an ECC error, it is no longer able to refresh the
data, and the block and its data die. The charge discharges
over many years, but beware: even reading is enough to cause
this. If a nearby block is read, the surrounding charge is
affected and degraded. 

Sectors on an SD card are not stored in a straightforward
manner, as is common with hard drives. A sector has its own
LBA address, but this can actually point to any block in the
SD card's chips. What's more, such a card LBA address moves as
needed. Today it is here, in a week it will be somewhere else.
This is taken care of by the card controller, thus extending
the life of the card. 


Colours errors
--------------------------------------------------------------

When an error occurs, the sector is marked in color on the map
and graph:

  - green  - OK
  - purple - R1 TimeOut
  - yellow - DToken TimeOut
  - red    - error reported by SD card


Frequently asked questions
--------------------------------------------------------------

The card is not detected after insertion into the SD slot.

* Check the card type; older SDSC cards with a capacity in
the order of megabytes (but also, for example, 1 GB) are not
supported.
* Use a different microSD to SD adapter; older adapters may
not support SDHC cards.
* Check that you do not have cards inserted in both the
large SD and small microSD slots at the same time.
* If you are using an adapter with an extension cable, make
sure that it is inserted sufficiently and accurately into the
SD slot.


 ________
|        \
| End     |
| Of      |  
| File    |
|         | 
|_________|   

