README.rst
1.. zephyr:code-sample:: smbus-shell
2 :name: SMBus shell
3 :relevant-api: smbus_interface
4
5 Interact with SMBus peripherals using shell commands.
6
7Overview
8********
9
10This is a simple SMBus shell sample that allows arbitrary boards with SMBus
11driver supported exploring the SMBus communication with peripheral devices.
12
13Building and Running
14********************
15
16This sample can be found under :zephyr_file:`samples/drivers/smbus` in the
17Zephyr tree.
18The sample can be built and run as follows for the ``qemu_x86_64`` board:
19
20.. zephyr-app-commands::
21 :zephyr-app: zephyr/samples/drivers/smbus
22 :host-os: unix
23 :board: qemu_x86_64
24 :goals: run
25 :compact:
26
27Sample Output
28*************
29
30Output from console when application started:
31
32.. code-block:: console
33
34 *** Booting Zephyr OS build zephyr-v3.2.0-804-gfedd72615e82 ***
35 Start SMBUS shell sample qemu_x86_64
36 uart:~$
37
38List available SMBus shell commands with:
39
40.. code-block:: console
41
42 uart:~$ smbus
43 smbus - smbus commands
44 Subcommands:
45 quick :SMBus Quick command
46 Usage: quick <device> <addr>
47 scan :Scan SMBus peripheral devices command
48 Usage: scan <device>
49 byte_read :SMBus: byte read command
50 Usage: byte_read <device> <addr>
51 byte_write :SMBus: byte write command
52 Usage: byte_write <device> <addr> <value>
53 byte_data_read :SMBus: byte data read command
54 Usage: byte_data_read <device> <addr> <cmd>
55 byte_data_write :SMBus: byte data write command
56 Usage: byte_data_write <device> <addr> <cmd> <value>
57 word_data_read :SMBus: word data read command
58 Usage: word_data_read <device> <addr> <cmd>
59 word_data_write :SMBus: word data write command
60 Usage: word_data_write <device> <addr> <cmd> <value>
61 block_write :SMBus: Block Write command
62 Usage: block_write <device> <addr> <cmd> [<byte1>, ...]
63 block_read :SMBus: Block Read command
64 Usage: block_read <device> <addr> <cmd>
65
66Scan for available SMBus devices with command:
67
68.. code-block:: console
69
70 uart:~$ smbus scan smbus@fb00
71 0 1 2 3 4 5 6 7 8 9 a b c d e f
72 00: -- -- -- -- -- -- -- -- -- -- -- --
73 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
74 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
75 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
76 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
77 50: 50 51 52 53 54 55 56 57 -- -- -- -- -- -- -- --
78 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
79 70: -- -- -- -- -- -- -- --
80 8 devices found on smbus@fb00
81