Hardware
https://www.az-delivery.de/products/digispark-board
Firmware
https://github.com/harbaum/I2C-Tiny-USB/blob/master/digispark
Zum Firmware-Upload brauchst du dieses Programm:
https://github.com/micronucleus/micronucleus/releases
Das Ding wird vom Linux Kernel unterstützt, du kannst deinen Testautomat daher in jeder beliebigen Programmiersprache schrieben, gerne auch als Bash Script.
Ich habe mir dazu folgende Notizen gemacht:
The following commands must be executed as root.
Upload firmware:
1 |
micronucleus --run --dump-progress --type intel-hex main.hex
|
Install I2C Tools and load the kernel driver:
1 |
apt install i2c-tools
|
2 |
modprobe i2c-dev
|
Scan for I2C busses:
1 |
root@stefanspc:~# i2cdetect -l
|
2 |
i2c-0 smbus SMBus I801 adapter at 5040 SMBus adapter
|
3 |
i2c-1 i2c nvkm-0000:01:00.0-bus-0000 I2C adapter
|
4 |
i2c-2 i2c nvkm-0000:01:00.0-bus-0001 I2C adapter
|
5 |
i2c-3 i2c nvkm-0000:01:00.0-bus-0002 I2C adapter
|
6 |
i2c-4 i2c nvkm-0000:01:00.0-bus-0005 I2C adapter
|
7 |
i2c-5 i2c nvkm-0000:01:00.0-bus-0006 I2C adapter
|
8 |
i2c-6 i2c nvkm-0000:01:00.0-bus-0007 I2C adapter
|
9 |
i2c-7 i2c nvkm-0000:01:00.0-bus-0008 I2C adapter
|
10 |
i2c-8 i2c nvkm-0000:01:00.0-bus-0009 I2C adapter
|
11 |
i2c-9 i2c nvkm-0000:01:00.0-aux-000a I2C adapter
|
12 |
i2c-10 i2c nvkm-0000:01:00.0-aux-000b I2C adapter
|
13 |
i2c-11 i2c nvkm-0000:01:00.0-aux-000c I2C adapter
|
14 |
i2c-12 i2c nvkm-0000:01:00.0-aux-000d I2C adapter
|
15 |
i2c-13 i2c i915 gmbus dpc I2C adapter
|
16 |
i2c-14 i2c i915 gmbus dpb I2C adapter
|
17 |
i2c-15 i2c i915 gmbus dpd I2C adapter
|
18 |
i2c-16 i2c AUX A/DDI A/PHY A I2C adapter
|
19 |
i2c-17 i2c i2c-tiny-usb at bus 001 device 109 I2C adapter
|
Check capabilities of the I²C adapter:
1 |
root@stefanspc:~# i2cdetect -F 17
|
2 |
|
3 |
Functionalities implemented by /dev/i2c-17:
|
4 |
I2C yes
|
5 |
SMBus Quick Command yes
|
6 |
SMBus Send Byte yes
|
7 |
SMBus Receive Byte yes
|
8 |
SMBus Write Byte yes
|
9 |
SMBus Read Byte yes
|
10 |
SMBus Write Word yes
|
11 |
SMBus Read Word yes
|
12 |
SMBus Process Call yes
|
13 |
SMBus Block Write yes
|
14 |
SMBus Block Read no
|
15 |
SMBus Block Process Call no
|
16 |
SMBus PEC no
|
17 |
I2C Block Write yes
|
18 |
I2C Block Read yes
|
Scan the I2C bus:
1 |
root@stefanspc:~# i2cdetect 17
|
2 |
|
3 |
WARNING! This program can confuse your I2C bus, cause data loss and worse!
|
4 |
I will probe file /dev/i2c-17.
|
5 |
I will probe address range 0x08-0x77.
|
6 |
Continue? [Y/n] Y
|
7 |
|
8 |
0 1 2 3 4 5 6 7 8 9 a b c d e f
|
9 |
00: -- -- -- -- -- -- -- --
|
10 |
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
11 |
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
12 |
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
13 |
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
14 |
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
15 |
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
16 |
70: -- -- -- -- -- -- -- --
|
Send data:
This example sends the value 1 to address 0x12 on slave 0x20 at bus 17.
Receive data:
1 |
i2cget 17 0x20 0x12 i 5
|
This example receives 5 bytes from address 0x12 on slave 0x20 at bus 17.