This shows you the differences between two versions of the page.
lkd:laboratoare:04 [2024/07/11 15:49] daniel.baluta |
lkd:laboratoare:04 [2024/07/11 16:42] (current) daniel.baluta [Presentation] |
||
---|---|---|---|
Line 4: | Line 4: | ||
==== Presentation ==== | ==== Presentation ==== | ||
- | * follow slides at {{:lkd:laboratoare:lkd_slides_03.pptx| Session 3}} | + | * no slides, all practical |
==== Practical lab ==== | ==== Practical lab ==== | ||
Line 16: | Line 15: | ||
Enable I2C proximity sensor [[https://www.optimusdigital.ro/en/index.php?controller=attachment&id_attachment=4892 | vl53l]]. | Enable I2C proximity sensor [[https://www.optimusdigital.ro/en/index.php?controller=attachment&id_attachment=4892 | vl53l]]. | ||
- | Identify GND, VCC, I2C_SCL and I2C_SDA data lines on expansion header and connect the sensor accordingly. | + | Connect GND, VCC(3V), I2C3_SCL_3V3 and I2C3_SDA_3V3 data lines on expansion header and connect the sensor accordingly. |
{{:lkd:laboratoare:expansion_1.png}}. | {{:lkd:laboratoare:expansion_1.png}}. | ||
Line 49: | Line 48: | ||
XX - is the address of the I2C device. There are two ways of finding this. You can dig inside the [[https://www.optimusdigital.ro/en/index.php?controller=attachment&id_attachment=4892 | datasheet ]] and confirm the address by scanning for devices on i2c3 node on the hardware. Use ''i2cdetect -y 2''. | XX - is the address of the I2C device. There are two ways of finding this. You can dig inside the [[https://www.optimusdigital.ro/en/index.php?controller=attachment&id_attachment=4892 | datasheet ]] and confirm the address by scanning for devices on i2c3 node on the hardware. Use ''i2cdetect -y 2''. | ||
- | == Step 4 Load the driver & read the distance measured by sensor == | + | The datasheet states that the I2C address is as shown as below, but you need to look closer and also understand the output of i2c scan command ''i2cdetect -y 2''. |
+ | |||
+ | {{:lkd:laboratoare:i2caddr.png}} | ||
+ | |||
+ | == Step 4 - Load the driver & read the distance measured by sensor == | ||
Once the device tree is ready, recompile the kernel and boot the board. On the board, use ''modprobe <driver-name>'' to load the driver. If everything goes well the driver will be correctly loaded and you will be able to read data. | Once the device tree is ready, recompile the kernel and boot the board. On the board, use ''modprobe <driver-name>'' to load the driver. If everything goes well the driver will be correctly loaded and you will be able to read data. | ||
Line 72: | Line 75: | ||
</code> | </code> | ||
+ | |||
+ | === Exercise 2 === | ||
+ | |||
+ | Control a motor using GPIOs. Use the following {{:lkd:laboratoare:motorcontrolsetup.pdf| Guide }} | ||
+ | |||
+ | {{:lkd:laboratoare:motor1.jpeg?500}} | ||