[solved] Change value of GPIO quickly - imx6

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

[solved] Change value of GPIO quickly - imx6

ソリューションへジャンプ
4,990件の閲覧回数
mauriciokarrei
Contributor II

Hi,

I'm developping a software with serial communication for a imx6 board. The software is based in three steps: 1) Up the pin (signal to start the write command) 2) Write the command on serial port 3) Down the pin (signal to finish the write command).  After it, I need to wait a response of the command given from another device connected on my serial channel (the pin need be down to capture the response).

The problem is: when I have many commands in sequence (between delays around 100ms), my osciloscope shown that my pin is slowly very much. Consequently when the device will respond my command the pin is "UP", and I can not get the response.

I'm using Qt to develop the application, and calling "system("echo 0 > /sys/class/gpio/gpioXX/value")" and "system("echo 1 > /sys/class/gpio/gpioXX/value")" to control my pin. I'm thinking use another way to "UP" and "DOWN" the pin (like a write directly on register), but I don't know if it is possible. I tried too use the Qprocess class, but without success.

I can't change this standard, because my device use this format of communication.

Any idea to solve my problem?

Thank's

best regards

1 解決策
2,768件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Mauricio

one can try to write to gpio registers directly using memtool,

included in imx-test package

Index of /buildsources/i/imx-test/imx-test-3.14.28-1.0.0

example of usage can be found in p.30 document

http://cache.freescale.com/files/32bit/doc/app_note/AN4576.pdf

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

7 返答(返信)
2,769件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Mauricio

one can try to write to gpio registers directly using memtool,

included in imx-test package

Index of /buildsources/i/imx-test/imx-test-3.14.28-1.0.0

example of usage can be found in p.30 document

http://cache.freescale.com/files/32bit/doc/app_note/AN4576.pdf

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

2,768件の閲覧回数
mauriciokarrei
Contributor II

Hi Igor,

     Ok, I installed the imx-tests module enabling the access to /unit_tests/memtool. But I'm with a another problem. How Can I know what is the registry address of my GPIO (Phisical address)? and How Can I know what is the complete value that I need assign to register?

     I'm using a Congatec Qmx6 board with a Freescale imx6. I'm using the /sys/class/gpio/gpio122 GPIO. Maybe Can I found another way to solve my problem (With priority of proccess, ...)?

Thank you so much

Regards

0 件の賞賛
返信
2,767件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Mauricio

one can know of gpio addresses and values for writing from

Table 2-1. System memory map, Chapter 28

General Purpose Input/Output (GPIO)

i.MX6DQ Reference Manual (rev.2  7/2014)

http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6DQRM.pdf

Best regards

igor

0 件の賞賛
返信
2,767件の閲覧回数
mauriciokarrei
Contributor II

Hi Igor,

   I installed the imx-tests package (Using Yocto Project) and was enabled the directory /unit_tests/memtool . I tried insert some commands on terminal like: /unit_tests/memtool  0x020e0620=9E3F8000 but the output from terminal  of the all commands is:

root@cgtqmx6:~# /unit_tests/memtool  0x020e0620=9E3F8000

-sh: /unit_tests/memtool: No such file or directory

Any idea?

Thank's

Regards

0 件の賞賛
返信
2,767件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Mauricio

I think directory name should be :

imx-test-3.14.28-1.0.0/test/memtool/

"unit_tests" is nickname of imx-test package.

Best regards

igor

0 件の賞賛
返信
2,767件の閲覧回数
mauriciokarrei
Contributor II

Hi Igor,

Thank you so much for your attention. I studied somethings about it and I built the imx-tests from your link. Its is ok.

I have another question about the way to write on register address. I saw that I need write on register 0x20A800 (GPIO 2 of Qmx6), but the bit to turn on/off is the 26 in this register. I think that if I write in all 32 bits of this register, I will alter the states from others GPIO's. How can I write in a specific bit in this register?

Thank you so much

Regars

0 件の賞賛
返信
2,767件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Mauricio

it is not possible to write in just one bit

Best regards

igor

0 件の賞賛
返信