This is the documentation for the latest (main) development branch. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

SDH_SPI

Overview

This application is a comprehensive example of using WM_IoT_SDK for SDH_SPI SPI communication. It demonstrates how to use the wm_drv_sdh_spi driver API in WM_IoT_SDK to perform write operations on SPI devices, including both synchronous and asynchronous transfers.

Requirements

SDH_SPI only uses the SPI mode of SDIO to achieve high-speed SPI data transmission. Since there is only one data buffer, it can only achieve half-duplex SPI communication(CPOL=0,CPHA=0). For example, the wm_drv_sdh_spi driver interface can be used to drive a TFT screen to achieve a higher screen refresh rate.

Building and Flashing

Example Location: examples\peripheral\sdh_spi

For compilation, flashing, and other operations, please refer to: Quick Start Guide

Running Result

The following log is displayed after successful operation

D/dt              [0.000] add device iflash
D/ptb             [0.002] partition table base 0xe000
D/ft              [0.002] ft_0 base 0, ft_1 base 1000
D/ft              [0.002] ft init too
D/ft              [0.004] ft init 1
D/main            [0.004] boot reason 0
D/main            [0.004] heap size 273376(266.97KB)
D/main            [0.004] flash size 0x200000(2MB)
I/example         [0.006] SPI demo start.
I/example         [0.006] Initializing sdspi device...
D/dt              [0.006] add device sdspi
D/HEX sync tx data: 0000-001F: 00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F  10 11 12 13 14 15 16 17  18 19 1A 1B 1C 1D 1E 1F    ................................
D/HEX sync tx data: 0020-003F: 20 21 22 23 24 25 26 27  28 29 2A 2B 2C 2D 2E 2F  30 31 32 33 34 35 36 37  38 39 3A 3B 3C 3D 3E 3F     !"#$%&'()*+,-./0123456789:;<=>?
D/HEX sync tx data: 0040-005F: 40 41 42 43 44 45 46 47  48 49 4A 4B 4C 4D 4E 4F  50 51 52 53 54 55 56 57  58 59 5A 5B 5C 5D 5E 5F    @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
D/HEX sync tx data: 0060-007F: 60 61 62 63 64 65 66 67  68 69 6A 6B 6C 6D 6E 6F  70 71 72 73 74 75 76 77  78 79 7A 7B 7C 7D 7E 7F    `abcdefghijklmnopqrstuvwxyz{|}~.
D/HEX sync tx data: 0080-009F: 80 81 82 83 84 85 86 87  88 89 8A 8B 8C 8D 8E 8F  90 91 92 93 94 95 96 97  98 99 9A 9B 9C 9D 9E 9F    ................................
D/HEX sync tx data: 00A0-00BF: A0 A1 A2 A3 A4 A5 A6 A7  A8 A9 AA AB AC AD AE AF  B0 B1 B2 B3 B4 B5 B6 B7  B8 B9 BA BB BC BD BE BF    ................................
D/HEX sync tx data: 00C0-00DF: C0 C1 C2 C3 C4 C5 C6 C7  C8 C9 CA CB CC CD CE CF  D0 D1 D2 D3 D4 D5 D6 D7  D8 D9 DA DB DC DD DE DF    ................................
D/HEX sync tx data: 00E0-00FF: E0 E1 E2 E3 E4 E5 E6 E7  E8 E9 EA EB EC ED EE EF  F0 F1 F2 F3 F4 F5 F6 F7  F8 F9 FA FB FC FD FE FF    ................................
D/HEX sync tx data: 0100-011F: 00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F  10 11 12 13 14 15 16 17  18 19 1A 1B 1C 1D 1E 1F    ................................
D/HEX sync tx data: 0120-013F: 20 21 22 23 24 25 26 27  28 29 2A 2B 2C 2D 2E 2F  30 31 32 33 34 35 36 37  38 39 3A 3B 3C 3D 3E 3F     !"#$%&'()*+,-./0123456789:;<=>?
D/HEX sync tx data: 0140-015F: 40 41 42 43 44 45 46 47  48 49 4A 4B 4C 4D 4E 4F  50 51 52 53 54 55 56 57  58 59 5A 5B 5C 5D 5E 5F    @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
D/HEX sync tx data: 0160-017F: 60 61 62 63 64 65 66 67  68 69 6A 6B 6C 6D 6E 6F  70 71 72 73 74 75 76 77  78 79 7A 7B 7C 7D 7E 7F    `abcdefghijklmnopqrstuvwxyz{|}~.
D/HEX sync tx data: 0180-019F: 80 81 82 83 84 85 86 87  88 89 8A 8B 8C 8D 8E 8F  90 91 92 93 94 95 96 97  98 99 9A 9B 9C 9D 9E 9F    ................................
D/HEX sync tx data: 01A0-01BF: A0 A1 A2 A3 A4 A5 A6 A7  A8 A9 AA AB AC AD AE AF  B0 B1 B2 B3 B4 B5 B6 B7  B8 B9 BA BB BC BD BE BF    ................................
D/HEX sync tx data: 01C0-01DF: C0 C1 C2 C3 C4 C5 C6 C7  C8 C9 CA CB CC CD CE CF  D0 D1 D2 D3 D4 D5 D6 D7  D8 D9 DA DB DC DD DE DF    ................................
D/HEX sync tx data: 01E0-01FF: E0 E1 E2 E3 E4 E5 E6 E7  E8 E9 EA EB EC ED EE EF  F0 F1 F2 F3 F4 F5 F6 F7  F8 F9 FA FB FC FD FE FF    ................................
D/HEX sync tx data: 0200-021F: 00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F  10 11 12 13 14 15 16 17  18 19 1A 1B 1C 1D 1E 1F    ................................
D/HEX sync tx data: 0220-023F: 20 21 22 23 24 25 26 27  28 29 2A 2B 2C 2D 2E 2F  30 31 32 33 34 35 36 37  38 39 3A 3B 3C 3D 3E 3F     !"#$%&'()*+,-./0123456789:;<=>?
D/HEX sync tx data: 0240-025F: 40 41 42 43 44 45 46 47  48 49 4A 4B 4C 4D 4E 4F  50 51 52 53 54 55 56 57  58 59 5A 5B 5C 5D 5E 5F    @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
D/HEX sync tx data: 0260-027F: 60 61 62 63 64 65 66 67  68 69 6A 6B 6C 6D 6E 6F  70 71 72 73 74 75 76 77  78 79 7A 7B 7C 7D 7E 7F    `abcdefghijklmnopqrstuvwxyz{|}~.
D/HEX sync tx data: 0280-029F: 80 81 82 83 84 85 86 87  88 89 8A 8B 8C 8D 8E 8F  90 91 92 93 94 95 96 97  98 99 9A 9B 9C 9D 9E 9F    ................................
D/HEX sync tx data: 02A0-02BF: A0 A1 A2 A3 A4 A5 A6 A7  A8 A9 AA AB AC AD AE AF  B0 B1 B2 B3 B4 B5 B6 B7  B8 B9 BA BB BC BD BE BF    ................................
D/HEX sync tx data: 02C0-02DF: C0 C1 C2 C3 C4 C5 C6 C7  C8 C9 CA CB CC CD CE CF  D0 D1 D2 D3 D4 D5 D6 D7  D8 D9 DA DB DC DD DE DF    ................................
D/HEX sync tx data: 02E0-02FF: E0 E1 E2 E3 E4 E5 E6 E7  E8 E9 EA EB EC ED EE EF  F0 F1 F2 F3 F4 F5 F6 F7  F8 F9 FA FB FC FD FE FF    ................................
D/HEX sync tx data: 0300-031F: 00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F  10 11 12 13 14 15 16 17  18 19 1A 1B 1C 1D 1E 1F    ................................
D/HEX sync tx data: 0320-033F: 20 21 22 23 24 25 26 27  28 29 2A 2B 2C 2D 2E 2F  30 31 32 33 34 35 36 37  38 39 3A 3B 3C 3D 3E 3F     !"#$%&'()*+,-./0123456789:;<=>?
D/HEX sync tx data: 0340-035F: 40 41 42 43 44 45 46 47  48 49 4A 4B 4C 4D 4E 4F  50 51 52 53 54 55 56 57  58 59 5A 5B 5C 5D 5E 5F    @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
D/HEX sync tx data: 0360-037F: 60 61 62 63 64 65 66 67  68 69 6A 6B 6C 6D 6E 6F  70 71 72 73 74 75 76 77  78 79 7A 7B 7C 7D 7E 7F    `abcdefghijklmnopqrstuvwxyz{|}~.
D/HEX sync tx data: 0380-039F: 80 81 82 83 84 85 86 87  88 89 8A 8B 8C 8D 8E 8F  90 91 92 93 94 95 96 97  98 99 9A 9B 9C 9D 9E 9F    ................................
D/HEX sync tx data: 03A0-03BF: A0 A1 A2 A3 A4 A5 A6 A7  A8 A9 AA AB AC AD AE AF  B0 B1 B2 B3 B4 B5 B6 B7  B8 B9 BA BB BC BD BE BF    ................................
D/HEX sync tx data: 03C0-03DF: C0 C1 C2 C3 C4 C5 C6 C7  C8 C9 CA CB CC CD CE CF  D0 D1 D2 D3 D4 D5 D6 D7  D8 D9 DA DB DC DD DE DF    ................................
D/HEX sync tx data: 03E0-03FF: E0 E1 E2 E3 E4 E5 E6 E7  E8 E9 EA EB EC ED EE EF  F0 F1 F2 F3 F4 F5 F6 F7  F8 F9 FA FB FC FD FE FF    ................................
I/example         [0.434] SPI sync transmission successful
D/HEX async tx data: 0000-001F: 00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F  10 11 12 13 14 15 16 17  18 19 1A 1B 1C 1D 1E 1F    ................................
D/HEX async tx data: 0020-003F: 20 21 22 23 24 25 26 27  28 29 2A 2B 2C 2D 2E 2F  30 31 32 33 34 35 36 37  38 39 3A 3B 3C 3D 3E 3F     !"#$%&'()*+,-./0123456789:;<=>?
D/HEX async tx data: 0040-005F: 40 41 42 43 44 45 46 47  48 49 4A 4B 4C 4D 4E 4F  50 51 52 53 54 55 56 57  58 59 5A 5B 5C 5D 5E 5F    @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
D/HEX async tx data: 0060-007F: 60 61 62 63 64 65 66 67  68 69 6A 6B 6C 6D 6E 6F  70 71 72 73 74 75 76 77  78 79 7A 7B 7C 7D 7E 7F    `abcdefghijklmnopqrstuvwxyz{|}~.
D/HEX async tx data: 0080-009F: 80 81 82 83 84 85 86 87  88 89 8A 8B 8C 8D 8E 8F  90 91 92 93 94 95 96 97  98 99 9A 9B 9C 9D 9E 9F    ................................
D/HEX async tx data: 00A0-00BF: A0 A1 A2 A3 A4 A5 A6 A7  A8 A9 AA AB AC AD AE AF  B0 B1 B2 B3 B4 B5 B6 B7  B8 B9 BA BB BC BD BE BF    ................................
D/HEX async tx data: 00C0-00DF: C0 C1 C2 C3 C4 C5 C6 C7  C8 C9 CA CB CC CD CE CF  D0 D1 D2 D3 D4 D5 D6 D7  D8 D9 DA DB DC DD DE DF    ................................
D/HEX async tx data: 00E0-00FF: E0 E1 E2 E3 E4 E5 E6 E7  E8 E9 EA EB EC ED EE EF  F0 F1 F2 F3 F4 F5 F6 F7  F8 F9 FA FB FC FD FE FF    ................................
D/HEX async tx data: 0100-011F: 00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F  10 11 12 13 14 15 16 17  18 19 1A 1B 1C 1D 1E 1F    ................................
D/HEX async tx data: 0120-013F: 20 21 22 23 24 25 26 27  28 29 2A 2B 2C 2D 2E 2F  30 31 32 33 34 35 36 37  38 39 3A 3B 3C 3D 3E 3F     !"#$%&'()*+,-./0123456789:;<=>?
D/HEX async tx data: 0140-015F: 40 41 42 43 44 45 46 47  48 49 4A 4B 4C 4D 4E 4F  50 51 52 53 54 55 56 57  58 59 5A 5B 5C 5D 5E 5F    @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
D/HEX async tx data: 0160-017F: 60 61 62 63 64 65 66 67  68 69 6A 6B 6C 6D 6E 6F  70 71 72 73 74 75 76 77  78 79 7A 7B 7C 7D 7E 7F    `abcdefghijklmnopqrstuvwxyz{|}~.
D/HEX async tx data: 0180-019F: 80 81 82 83 84 85 86 87  88 89 8A 8B 8C 8D 8E 8F  90 91 92 93 94 95 96 97  98 99 9A 9B 9C 9D 9E 9F    ................................
D/HEX async tx data: 01A0-01BF: A0 A1 A2 A3 A4 A5 A6 A7  A8 A9 AA AB AC AD AE AF  B0 B1 B2 B3 B4 B5 B6 B7  B8 B9 BA BB BC BD BE BF    ................................
D/HEX async tx data: 01C0-01DF: C0 C1 C2 C3 C4 C5 C6 C7  C8 C9 CA CB CC CD CE CF  D0 D1 D2 D3 D4 D5 D6 D7  D8 D9 DA DB DC DD DE DF    ................................
D/HEX async tx data: 01E0-01FF: E0 E1 E2 E3 E4 E5 E6 E7  E8 E9 EA EB EC ED EE EF  F0 F1 F2 F3 F4 F5 F6 F7  F8 F9 FA FB FC FD FE FF    ................................
D/HEX async tx data: 0200-021F: 00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F  10 11 12 13 14 15 16 17  18 19 1A 1B 1C 1D 1E 1F    ................................
D/HEX async tx data: 0220-023F: 20 21 22 23 24 25 26 27  28 29 2A 2B 2C 2D 2E 2F  30 31 32 33 34 35 36 37  38 39 3A 3B 3C 3D 3E 3F     !"#$%&'()*+,-./0123456789:;<=>?
D/HEX async tx data: 0240-025F: 40 41 42 43 44 45 46 47  48 49 4A 4B 4C 4D 4E 4F  50 51 52 53 54 55 56 57  58 59 5A 5B 5C 5D 5E 5F    @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
D/HEX async tx data: 0260-027F: 60 61 62 63 64 65 66 67  68 69 6A 6B 6C 6D 6E 6F  70 71 72 73 74 75 76 77  78 79 7A 7B 7C 7D 7E 7F    `abcdefghijklmnopqrstuvwxyz{|}~.
D/HEX async tx data: 0280-029F: 80 81 82 83 84 85 86 87  88 89 8A 8B 8C 8D 8E 8F  90 91 92 93 94 95 96 97  98 99 9A 9B 9C 9D 9E 9F    ................................
D/HEX async tx data: 02A0-02BF: A0 A1 A2 A3 A4 A5 A6 A7  A8 A9 AA AB AC AD AE AF  B0 B1 B2 B3 B4 B5 B6 B7  B8 B9 BA BB BC BD BE BF    ................................
D/HEX async tx data: 02C0-02DF: C0 C1 C2 C3 C4 C5 C6 C7  C8 C9 CA CB CC CD CE CF  D0 D1 D2 D3 D4 D5 D6 D7  D8 D9 DA DB DC DD DE DF    ................................
D/HEX async tx data: 02E0-02FF: E0 E1 E2 E3 E4 E5 E6 E7  E8 E9 EA EB EC ED EE EF  F0 F1 F2 F3 F4 F5 F6 F7  F8 F9 FA FB FC FD FE FF    ................................
D/HEX async tx data: 0300-031F: 00 01 02 03 04 05 06 07  08 09 0A 0B 0C 0D 0E 0F  10 11 12 13 14 15 16 17  18 19 1A 1B 1C 1D 1E 1F    ................................
D/HEX async tx data: 0320-033F: 20 21 22 23 24 25 26 27  28 29 2A 2B 2C 2D 2E 2F  30 31 32 33 34 35 36 37  38 39 3A 3B 3C 3D 3E 3F     !"#$%&'()*+,-./0123456789:;<=>?
D/HEX async tx data: 0340-035F: 40 41 42 43 44 45 46 47  48 49 4A 4B 4C 4D 4E 4F  50 51 52 53 54 55 56 57  58 59 5A 5B 5C 5D 5E 5F    @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
D/HEX async tx data: 0360-037F: 60 61 62 63 64 65 66 67  68 69 6A 6B 6C 6D 6E 6F  70 71 72 73 74 75 76 77  78 79 7A 7B 7C 7D 7E 7F    `abcdefghijklmnopqrstuvwxyz{|}~.
D/HEX async tx data: 0380-039F: 80 81 82 83 84 85 86 87  88 89 8A 8B 8C 8D 8E 8F  90 91 92 93 94 95 96 97  98 99 9A 9B 9C 9D 9E 9F    ................................
D/HEX async tx data: 03A0-03BF: A0 A1 A2 A3 A4 A5 A6 A7  A8 A9 AA AB AC AD AE AF  B0 B1 B2 B3 B4 B5 B6 B7  B8 B9 BA BB BC BD BE BF    ................................
D/HEX async tx data: 03C0-03DF: C0 C1 C2 C3 C4 C5 C6 C7  C8 C9 CA CB CC CD CE CF  D0 D1 D2 D3 D4 D5 D6 D7  D8 D9 DA DB DC DD DE DF    ................................
D/HEX async tx data: 03E0-03FF: E0 E1 E2 E3 E4 E5 E6 E7  E8 E9 EA EB EC ED EE EF  F0 F1 F2 F3 F4 F5 F6 F7  F8 F9 FA FB FC FD FE FF    ................................
I/example         [0.904] SPI async transmission successful
I/example         [0.924] This example succeeds in running.