Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
1,950 Views

Changing the I2C frequency "permanently"

Jump to solution

Hello

I have been trying to change the frequency of I2C to standard to be able to use with the CO2 sensor mentioned in this article (https://software.intel.com/en-us/articles/exploring-air-quality-monitoring-using-intel-edison IoT - Exploring Air Quality Monitoring Using Intel® Edison | Intel® Developer Zone). Actually, I followed the instructions explained in the article as well as the one mentioned in this post ( ) , which are the same, and I was able to change the frequency via PuTTY. The problem, however, is that every time I disconnect Edison from power, the frequency goes to the fast mode! And my question is: Is there a way to make the frequency change permanent so that there is no need to manually adjust every time Edison is reconnected?

Thanks,


Accepted Solutions
Highlighted
Employee
24 Views

Hello aafm32,

You can do it with a system service that changes it every time the Edison boots making the effect that the speed has been set "permanently" to std. In that case you will need two files, I'll call them I2C_speed_chg.sh and I2C_speed_chg.service. I2C_speed_chg.sh will be stored in /home/root/ and I2C_speed_chg.service will be stored in /lib/systemd/system.

I2C_speed_chg.sh will look like this:

# !/bin/sh

echo std > /sys/devices/pci0000:00/0000:00:09.1/i2c_dw_sysnode/mode

Once you have created this file give it executable rights with chmod +x I2C_speed_chg.sh.

I2C_speed_chg.service will look like the following:

# !/bin/sh

[Unit]

Description=Change Edison's I2C speed

[Service]

ExecStart=/home/root/I2C_speed_chg.sh

[Install]

WantedBy=basic.target

Once you have created I2C_speed_chg.service type the command systemctl enable I2C_speed_chg.service and now your Edison's I2C speed should be set "permanently" to std.

Peter.

View solution in original post

6 Replies
Highlighted
Honored Contributor II
24 Views

aafm32,

It seems like your inquiry is related to Intel® Edison platform. In order for you to get your answer in a timely manner, we are now transferring your thread tho the respective forum.

0 Kudos
Highlighted
Employee
25 Views

Hello aafm32,

You can do it with a system service that changes it every time the Edison boots making the effect that the speed has been set "permanently" to std. In that case you will need two files, I'll call them I2C_speed_chg.sh and I2C_speed_chg.service. I2C_speed_chg.sh will be stored in /home/root/ and I2C_speed_chg.service will be stored in /lib/systemd/system.

I2C_speed_chg.sh will look like this:

# !/bin/sh

echo std > /sys/devices/pci0000:00/0000:00:09.1/i2c_dw_sysnode/mode

Once you have created this file give it executable rights with chmod +x I2C_speed_chg.sh.

I2C_speed_chg.service will look like the following:

# !/bin/sh

[Unit]

Description=Change Edison's I2C speed

[Service]

ExecStart=/home/root/I2C_speed_chg.sh

[Install]

WantedBy=basic.target

Once you have created I2C_speed_chg.service type the command systemctl enable I2C_speed_chg.service and now your Edison's I2C speed should be set "permanently" to std.

Peter.

View solution in original post

Highlighted
Novice
24 Views

Thank you Peter

I am supposing that I can browse /home/root/ and /lib/systemd/system via the Edison drive in windows. However, when I tried to browse I found that the Edison drive is empty! Would you tell me please how can access the folders where I have to store the files?

I am sorry for asking in too many details but I have just moved from UNO to Edison and I am trying how to adapt to it.

Ahmad

0 Kudos
Highlighted
Employee
24 Views

No, those files are found on Edison's Linux file system. You can access it by following this guide: https://software.intel.com/en-us/get-started-edison-windows-step3 Set up a serial terminal. To create the files you can use vi, I'll leave you http://ss64.com/vi.html vi's reference guide in case you need more information about vi.

Let me know if you any other issue.

Peter.

0 Kudos
Highlighted
Novice
24 Views

Hello Peter,

It worked:)

I managed to copy the files in Edison using WinSCP and now the frequency changes automatically every time I reconnect it to power.

Firstly, I followed the procedure written here to access Edison: http://rexstjohn.com/use-win-scp-to-copy-files-to-intel-edison/ http://rexstjohn.com/use-win-scp-to-copy-files-to-intel-edison/

Secondly, I copied the two files in the designated folders

Finally, I wrote the two commands in PuTTy.

Thank you very much for your help

Ahmad

0 Kudos
Highlighted
Employee
24 Views

I'm glad to be of help .

Peter.

0 Kudos