1 This is an SPI Server application for the STMicroelectronics STM32F429I-DISC1 (32F429IDISCOVERY) board.
2 The application executes commands sent from the SPI Client over the
3 SPI interface and is used to physically test compliance of the SPI driver
4 with the CMSIS SPI driver specification from version 2.0.0 upwards.
7 The SPI Server (in Slave mode) waits to receive a command over the SPI interface.
8 After command is received it is executed, and SPI Server again waits to receive
10 Command execution finishes by finishing the requested operation or by timeout.
11 All commands except XFER use fixed communication configuration, and timeout as
12 specified in the SPI_Server_Config.h configuration file.
13 Only XFER command is executed using settings configured by SET COM command,
14 after execution of the XFER command the SPI interface is configured back to
15 fixed configuration, so next command can be received.
16 The XFER command is executed until it finishes or until timeout specified in
18 If timeout is not specified in the command the last specified timeout from
19 previous XFER command is used.
20 If timeout was never specified in the XFER command then default timeout setting
23 Fixed SPI interface configuration:
24 - Mode: Slave mode with Slave Select Hardware monitored
25 - Clock / Frame Format: Clock Polarity 0, Clock Phase 0
27 - Bit Order: MSB to LSB
29 Hardware configuration of the SPI Server (peripheral SPI1 is used):
34 SS PA15 (with external pull-up to Vcc)
35 GND any ground connection on the board
37 SPI Server commands (32 bytes long (zero padding), [] means parameter is optional):
38 - GET VER <- followed by 16 bytes OUT data phase
39 - GET CAP <- followed by 32 bytes OUT data phase
40 - SET BUF RX/TX,len[,pattern] -> followed by optional 'len' bytes IN data phase
41 - GET BUF RX/TX,len <- followed by 'len' bytes OUT data phase
42 - SET COM mode,format,bit_num,bit_order,ss_mode,bus_speed
43 - XFER num[,delay_c][,delay_t][,timeout] <-> followed by 'num' items data IN/OUT transfer
44 - GET CNT <- followed by 16 bytes OUT data phase
46 SPI Server command parameters:
47 RX/TX: RX = SPI Server's receive buffer, TX = SPI Server's transmit buffer
48 len: length of content in the following IN/OUT data phase
49 pattern: value (in hex notation) to pre-fill the buffer with
50 mode: 0 = Master, 1 = Slave
51 format: 0 = Clock Polarity 0, Clock Phase 0
52 1 = Clock Polarity 0, Clock Phase 1
53 2 = Clock Polarity 1, Clock Phase 0
54 3 = Clock Polarity 1, Clock Phase 1
55 4 = Texas Instruments Frame Format
56 5 = National Semiconductor Microwire Frame Format
57 bit_num: number of bits (1 .. 32)
58 bit_order: 0 = MSB to LSB, 1 = LSB to MSB
59 ss_mode: 0 = unused, 1 = Master driven / Slave monitored
60 bus_speed: bus speed (in bps)
61 num: number of items (according CMSIS SPI driver specification)
62 delay_c: delay before Control function is called, in milliseconds
63 delay_t: delay after Control function is called but before Transfer function is called, in milliseconds
64 timeout: total transfer timeout including delay_c and delay_t delays, in milliseconds
66 SPI Server responses to commands:
67 - GET VER: 16 bytes containing string representation in form:
69 - GET CAP: 32 bytes containing values representing masks (bit value 1 means supported) or values as follows:
70 "mode_mask,format_mask,data_bit_mask,bit_order_mask,min_bus_speed_in_kbps,max_bus_speed_in_kbps"
71 - mode_mask (2 digits in hex): specifies mask of supported modes
74 - format_mask (2 digits in hex): specifies mask of supported clock/frame formats
75 - bit 0.: Clock Polarity 0, Clock Phase 0
76 - bit 1.: Clock Polarity 0, Clock Phase 1
77 - bit 2.: Clock Polarity 1, Clock Phase 0
78 - bit 3.: Clock Polarity 1, Clock Phase 1
79 - bit 4.: Texas Instruments Frame Format
80 - bit 5.: National Semiconductor Microwire Frame Format
81 - data_bit_mask (8 digits in hex): specifies mask of supported data bits
84 - bit 31.: Data Bits 32
85 - bit_order_mask (1 byte in hex): specifies mask of supported bit orders
88 - min_bus_speed_in_kbps (dec): minimum supported bus speed (in kbps)
89 - max_bus_speed_in_kbps (dec): maximum supported bus speed (in kbps)
90 - GET BUF: 'len' bytes from respective buffer, in binary format
91 - GET CNT: 16 bytes containing value in decimal notation
93 The SPI Server for the STMicroelectronics STM32F429I-DISC1 (32F429IDISCOVERY) board is available for different targets:
94 - Release: target with high optimization and no User Interface
95 - Debug: target with low optimization and User Interface (GLCD, LED)
99 -> GET VER <- 16 bytes (for example "1.1.0")
101 -> GET CAP <- 32 bytes (for example "03,1F,00008080,03,1000,10000")
102 Set Tx buffer to 'S':
104 Set Rx buffer to '?':
106 Get 16 bytes of Rx buffer content:
107 -> GET BUF RX,16 <- 16 bytes (for example "????????????????")
108 Set communication mode to slave, clock phase 0, clock polarity 0,
109 8 data bits, MSB first, slave select hardware monitored, 2MBps:
110 -> SET COM 1,0,8,0,1,2000000
111 Transfer 16 bytes in both directions:
112 -> XFER 16,10,0,100 <-> 16 bytes
114 -> GET CNT <- 16 bytes (for example "16")