-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modifier et tester commandes SPI sur carte NUCLEO-8S208RB
- Loading branch information
Showing
13 changed files
with
1,105 additions
and
1,028 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
NEW | ||
1 SPI.EEPROM | ||
4 ' test SPI with 25LC640 EEPROM | ||
10 SPI.EN 1,2 ' Fspi=Fmstr/8 | ||
14 SPI.SEL 1:SPI.WR 6:SPI.SEL 0 'enable WEL bit in EEPROM | ||
18 SPI.SEL 1:SPI.WR 5: IF (SPI.RD AND 2) :GOTO 26 | ||
22 GOTO 200 | ||
26 SPI.SEL 0 | ||
30 ? "writing 16 random values to EEPROM\n{" | ||
34 SPI.SEL 1:SPI.WR 2,0,0 | ||
38 FOR I =0 TO 15 | ||
42 LET D=RND(256):?D;:SPI.WR D:NEXT I:?"}" | ||
46 SPI.SEL 0 | ||
50 GOSUB 100' wait for write completed | ||
54 SPI.SEL 1:SPI.WR 3,0,0 | ||
58 ? "\nreading back EEPROM\n{" | ||
62 FOR I =0 TO 15:PRINT SPI.RD; :NEXT I:?"}" | ||
66 SPI.SEL 0: | ||
70 SPI.EN 0 | ||
74 END | ||
98 ' wait for write completed | ||
100 SPI.SEL 1:SPI.WR 5:LET S =SPI.RD :SPI.SEL 0 | ||
110 IF S AND 1 :GOTO 100 | ||
120 RETURN | ||
200 PRINT "failed to enable WEL bit in EEPROM "; A | ||
210 SPI.SEL 0 ' deselect EEPROM | ||
220 SPI.EN 0 ' disable SPI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
NEW | ||
1 SPI.TEST | ||
2 REM RAM 23LC1024 write,read test | ||
3 REM This is a 128KB SPI-RAM | ||
4 REM Vdd=5.0 RAM Fck max is 16Mhz | ||
6 CONST RD=3,WR=2,D.OFS=4 | ||
20 SPI.EN 1 | ||
30 REM write 16 random number at address 0 | ||
40 SPI.SEL 1 | ||
44 INPUT "ADDRESS "A | ||
48 REM write command and address | ||
50 SPI.WR WR,RSHIFT(A,16),RSHIFT(A,8) AND 255,A AND 255 | ||
84 ? "writing 16 bytes in 23LC1024 at address: "; A ;?"\n{"; | ||
90 FOR I=1 TO 16 | ||
100 LET D=RND(256):SPI.WR D: ? D; | ||
110 NEXT I : SPI.SEL 0 | ||
120 ? "}" | ||
130 ? "reading back 23LC1024\n{" | ||
140 SPI.SEL 1 | ||
150 SPI.WR RD,RSHIFT(A,16),RSHIFT(A,8) AND 255,A AND 255 | ||
160 FOR I=1 TO 16 | ||
170 ? SPI.RD; | ||
180 NEXT I : ? "}" | ||
190 SPI.SEL 0 | ||
200 SPI.EN 0 | ||
300 END | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.