-
Notifications
You must be signed in to change notification settings - Fork 2
/
SDNOTES.TXT
55 lines (40 loc) · 1.82 KB
/
SDNOTES.TXT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FINDINGS ON THE sd CARD.
This was a 2gig SD with fat32. I was able to read and write data to the SD card. It is still experimental.
The are 3 basic inits used on these card. See:
elm-chan.org/docs/mmc/mmc_e.html
for other init sequences. This is excelent information on SD cards.
Much of this was borrowed from JeeLabs Forth code on githib. It was mercrisp Forth that I modified to
eforth.I found his code incorrect for the SPI init. I wrote mine from the STM apnote so should work
with your STM32f103.
I've not done much with it yet. I may create a large blank file on the PC and teat it as a number of block files.
Maybe someone else will expand it to file access.
It has 80H blocks for each cluster
2000H is the boot
The first FAT is at 2006H the second copy is at 20F3
The first file is at 2200H FAT=2 BASE 2100
21E0 HAS THE DIR
EACH DISK SECTOR IS 5 SD SECTORS LONG
EACH NIC SECTOR IS 5000H BITS LONG. THIS IS 0A00 BYTES
THIS IS 5 SD SECTORS. THE NIC DISK IS 77 TRACKS WITH 2 SECTORS PER
TRACK OR 9AH NIC SECTORS. 302H OR 770d SD SECTORS.
THIS IS 394240 BYTES
lOOKS LIKE 0DH CLUSTERS WITH 32k BYTES PER CLUSTER
DO THE MATH AGAIN
1kX20 IS 5000H BITS
5000 8 / . 0A00H BYTES PER NIC SECTOR
THAT IS 5 SD SECTORS OF 512 BYTES 400H
WITH 32K BYTES PER CLUSTER OR 32D SECTORS
AN ENTIRE NIC DISK IS BETWEEN 0C AND 0D CLUSTERS
0 1 2 3 4 5 6 7 8 9 A B C
TIMES THE FIRST CLUSTER
NOW, HOW MUCH PER CLUSTER
IF I PUT 0C NIC SECTOR PER CLUSTER
40H SD SECTORS PER CLUSTER
40H 5 / IS 0C NIC80 SECTORS PER CLUSTER WITH 4 SD SECTOR LEFT
9A 5 / 0c REM 0A
GET FIRST SECTOR NUMBER
MULTIPLY BY 40 TO GET FIRST SECTOR NUMBER
TO THIS WE ADD NIC SECTOR OFFSET IN SD SECTORS
NIC SECTOR * 5 ADD IT TO THE FIRST SECTOR ON THE SD
NEEDS 8 BYTE PORT WITH READ AND WRITE MAYBE A SERIAL CHIP IS
EASIER TO DEAL WITH.