8,367
edits
Changes
→40 pin I2C test
<li><p>As can be seen from the table below, the available i2c for Orange Pi 5 Plus is i2c2, i2c4, i2c5 and i2c8, a total of four sets of i2c buses.</p>
<p>[[File:media/image304.png|575x137px]]</p></li>
<li><p>4组I2C总线在40pin中对应的引脚如下表所示。I2C2_M0和I2C2_M4同一时间只The corresponding pins of the 4 groups of I2C buses in 40pin are shown in the table below. I2C2_M0 and I2C2_M4 can only use one of them at the same time, and they cannot be used at the same time. They are all the same I2C2, but they are connected to different pins. Please don’t think that they are two different sets of I2C2 buses.</p></li></ol>
{| class="wikitable" style="width:800px;"
|-
| style="text-align: left;"| '''I2C bus'''
| style="text-align: left;"| '''i2c8-m2'''
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>In the linux system, the I2C bus in the 40 pin is closed by default, and it needs to be opened manually before it can be used. The detailed steps are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First run '''orangepi-config''', normal users remember to add > '''sudo''' permission</p>
{| class="wikitable" style="width:800px;" |-|<p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:media/image234.png|382x176px]]</p></li>
</li>
<li><p>After starting the linux system, first confirm that there is a device node corresponding to i2c under '''/dev'''</p>
{| class="wikitable" style="width:800px;" |-|<p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p>|}</li>
<li><p>Then connect an i2c device to the i2c pin of the 40 pin connector, here we take the ds1307 RTC module as an example</p>
<p>[[File:media/image335.png|124x106px]]</p></li>
<li><p>Then use the '''i2cdetect -y''' command, if the address of the connected i2c device can be detected, it means that i2c can be recognized normally.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo i2cdetect -y 2''' #i2c2 command</p>
<p>orangepi@orangepi:~$ '''sudo i2cdetect -y 4''' #i2c4 command</p>
<p>orangepi@orangepi:~$ '''sudo i2cdetect -y 5''' #i2c5 command</p>
<p>orangepi@orangepi:~$ '''sudo i2cdetect -y 8''' #i2c8 command</p>|}</li>
<li><p>Then you can run the '''ds1307.py''' test program in the '''wiringOP-Python/examples''' file to read the time of RTC</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''/dev/i2c-x needs to be replaced with the serial number of the specific i2c device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
<p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device "/dev/i2c-x"'''</p>
<p>Thu 2023-01-05 14:57:57</p>
<p>^C</p>
<p>exit</p>|}</li></ol>
<span id="pin-uart-test-1"></span>
=== 40 pin UART test ===