- OS: ubuntu 20.04 Server 64bits LTS
- Board: Raspberry pi 4b
- Compile device tree
dtc -@ -I dts -O dtb -o sht20-i2c.dtbo sht20-i2c.dti
- Move device tree binary code to /boot/firmware/overlays/
- Add line on /boot/firmware/config.txt
+ dtoverlay=sht20-i2c
- reboot
- Compile driver
make
- Load module
sudo insmod sht20_i2c_drv.ko
- Compile test program
make test
- Give permission
sudo chmod 666 /dev/sht20
- Excute test
./test
0xa 0xb 0xc 0xb
Temperature(°C) = 0xa0b / 100
Humidity(RH %) = 0xc0b / 100