• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

src/29-Dec-2025-146

CMakeLists.txtD29-Dec-2025226 96

README.rstD29-Dec-20252.6 KiB7962

prj.confD29-Dec-2025205 1210

sample.yamlD29-Dec-2025298 1716

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