How to set the w_disable pin manual on i.mx8QM-MEK

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to set the w_disable pin manual on i.mx8QM-MEK

1,942 次查看
ChChang
Contributor II

Hi All

I now need to manually control the w_disable2 pin of the M2 slot on i.mx8QM-MEK for BT control.
I want to use the "gpioset" command directly in the console or control it within  my code. However, I am unsure about its correct GPIO number. How can I find out?

Regards,

CH

0 项奖励
回复
8 回复数

1,659 次查看
ChChang
Contributor II

Hi 
I can directly set GPIO374 to 1 or 0 now. And confirm the result by cat /sys/class/gpio/gpio374/value 

However, after bringing up the NXP 9098 combo module and successfully executing hciattach,Bluetooth functionality works fine.
At this point, when I set GPIO374 to 1 or 0, I didn't see the 9098 module being reset. Is this behavior normal?

Regards,
CH

0 项奖励
回复

1,551 次查看
ChChang
Contributor II

Hi 
I can directly set GPIO374 to 1 or 0 now. And confirm the result by cat /sys/class/gpio/gpio374/value as below picture,
No matter whether I set GPIO347 to high or low, when I measure pin 54 of the M.2 slot, the result is always high. Can you provide some suggestions?

163756.jpg

0 项奖励
回复

1,868 次查看
ChChang
Contributor II

Hi Chavira

I could see below code on imx8qm-mek.dts,

pinctrl_modem_reset: modemresetgrp {
fsl,pins = <
IMX8QM_QSPI1A_DQS_LSIO_GPIO4_IO22 0x06000021
>;
};

but when I execute $gpioset 4 22=1 , then $gpioget 4 22 , 
the result always is 0, not 1

Do I need to do more modificaton?

Regards,
CH

0 项奖励
回复

1,809 次查看
dtony
Contributor III
If you don't remove the pin and gpio, the pin and gpio belongs to "gpio-reset" device/driver.
You could not control it from usespace(/sysfs/)
 
modem_reset: modem-reset {
compatible = "gpio-reset";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&pinctrl_modem_reset>;
pinctrl-1 = <&pinctrl_modem_reset_sleep>;
reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
reset-delay-u
s = <2000>;
reset-post-delay-ms = <40>;
#reset-cells = <0>;
};
 
fsl-imx8qm-mek-man-qpio4-22.dts(rel_imx_4.14.98_2.0.0_ga) attached is device tree.
 
make freescale/fsl-imx8qm-mek-man-qpio4-22.dtb to generate the device tree blob.
 
Here is the test. gpio-374(gpio4 bit 22)

 

 

 

 

 gpio-374 (                    |sysfs               ) out hi
 gpio-374 (                    |sysfs               ) out lo

 

 

 

 

 

 

 

 

 

cat /sys/kernel/debug/gpio
gpiochip7: GPIOs 256-287, parent: platform/5d0f0000.gpio, 5d0f0000.gpio:

gpiochip6: GPIOs 288-319, parent: platform/5d0e0000.gpio, 5d0e0000.gpio:

gpiochip5: GPIOs 320-351, parent: platform/5d0d0000.gpio, 5d0d0000.gpio:
 gpio-341 (                    |wp                  ) in  hi
 gpio-342 (                    |cd                  ) in  hi IRQ

gpiochip4: GPIOs 352-383, parent: platform/5d0c0000.gpio, 5d0c0000.gpio:
 gpio-358 (                    |ss-sel              ) out lo
 gpio-359 (                    |sw-3p3-sd1          ) out lo
 gpio-371 (                    |reset               ) out hi
 gpio-374 (                    |sysfs               ) in  hi
 gpio-379 (                    |SATA CLKREQ         ) out lo
 
 
 echo 374  >  /sys/class/gpio/export
 
 echo out > /sys/class/gpio/gpio374/direction
 
 
 echo 1 >  /sys/class/gpio/gpio374/value
 echo 0 >  /sys/class/gpio/gpio374/value
 
 
 
root@imx8qmmek:~# echo 374  >  /sys/class/gpio/export
root@imx8qmmek:~# echo out > /sys/class/gpio/gpio374/direction

root@imx8qmmek:~# echo 1 >  /sys/class/gpio/gpio374/value

root@imx8qmmek:~# cat /sys/kernel/debug/gpio
gpiochip7: GPIOs 256-287, parent: platform/5d0f0000.gpio, 5d0f0000.gpio:

gpiochip6: GPIOs 288-319, parent: platform/5d0e0000.gpio, 5d0e0000.gpio:

gpiochip5: GPIOs 320-351, parent: platform/5d0d0000.gpio, 5d0d0000.gpio:
 gpio-341 (                    |wp                  ) in  hi
 gpio-342 (                    |cd                  ) in  hi IRQ

gpiochip4: GPIOs 352-383, parent: platform/5d0c0000.gpio, 5d0c0000.gpio:
 gpio-358 (                    |ss-sel              ) out lo
 gpio-359 (                    |sw-3p3-sd1          ) out lo
 gpio-371 (                    |reset               ) out hi
 gpio-374 (                    |sysfs               ) out hi
 gpio-379 (                    |SATA CLKREQ         ) out lo

gpiochip3: GPIOs 384-415, parent: platform/5d0b0000.gpio, 5d0b0000.gpio:

gpiochip2: GPIOs 416-447, parent: platform/5d0a0000.gpio, 5d0a0000.gpio:

gpiochip1: GPIOs 448-479, parent: platform/5d090000.gpio, 5d090000.gpio:
 gpio-461 (                    |epdev_on            ) out hi

gpiochip0: GPIOs 480-511, parent: platform/5d080000.gpio, 5d080000.gpio:
 gpio-511 (                    |headphone detect    ) in  lo IRQ
 
root@imx8qmmek:~#  echo 0 >  /sys/class/gpio/gpio374/value

root@imx8qmmek:~# cat /sys/kernel/debug/gpio
gpiochip7: GPIOs 256-287, parent: platform/5d0f0000.gpio, 5d0f0000.gpio:

gpiochip6: GPIOs 288-319, parent: platform/5d0e0000.gpio, 5d0e0000.gpio:

gpiochip5: GPIOs 320-351, parent: platform/5d0d0000.gpio, 5d0d0000.gpio:
 gpio-341 (                    |wp                  ) in  hi
 gpio-342 (                    |cd                  ) in  hi IRQ

gpiochip4: GPIOs 352-383, parent: platform/5d0c0000.gpio, 5d0c0000.gpio:
 gpio-358 (                    |ss-sel              ) out lo
 gpio-359 (                    |sw-3p3-sd1          ) out lo
 gpio-371 (                    |reset               ) out hi
 gpio-374 (                    |sysfs               ) out lo
 gpio-379 (                    |SATA CLKREQ         ) out lo

gpiochip3: GPIOs 384-415, parent: platform/5d0b0000.gpio, 5d0b0000.gpio:

gpiochip2: GPIOs 416-447, parent: platform/5d0a0000.gpio, 5d0a0000.gpio:

gpiochip1: GPIOs 448-479, parent: platform/5d090000.gpio, 5d090000.gpio:
 gpio-461 (                    |epdev_on            ) out hi

gpiochip0: GPIOs 480-511, parent: platform/5d080000.gpio, 5d080000.gpio:
 gpio-511 (                    |headphone detect    ) in  lo IRQ
root@imx8qmmek:~#

 

 

 

 

 

 

 
0 项奖励
回复

1,747 次查看
ChChang
Contributor II

Hi dTony

After referencing your DTS file and making modifications to the imx8qm-mek.dts,
I am now able to read and write to GPIO 4 22 (gpio374) as per your testing steps.
I greatly appreciate your assistance!


Regards,

CH

1,797 次查看
dtony
Contributor III
If you don't remove the pin and gpio from modem_reset, the pin and gpio belongs to "gpio-reset" device/driver.
You could not control it from usespace(/sysfs/)
 
modem_reset: modem-reset {
compatible = "gpio-reset";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&pinctrl_modem_reset>;
pinctrl-1 = <&pinctrl_modem_reset_sleep>;
reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
reset-delay-us = <2000>;
reset-post-delay-ms = <40>;
#reset-cells = <0>;
};
 
fsl-imx8qm-mek-man-qpio4-22.dts(rel_imx_4.14.98_2.0.0_ga) attached is device tree.
 
Here is the test. gpio-374(gpio4 bit 22)
 

 

cat /sys/kernel/debug/gpio
gpiochip7: GPIOs 256-287, parent: platform/5d0f0000.gpio, 5d0f0000.gpio:

gpiochip6: GPIOs 288-319, parent: platform/5d0e0000.gpio, 5d0e0000.gpio:

gpiochip5: GPIOs 320-351, parent: platform/5d0d0000.gpio, 5d0d0000.gpio:
 gpio-341 (                    |wp                  ) in  hi
 gpio-342 (                    |cd                  ) in  hi IRQ

gpiochip4: GPIOs 352-383, parent: platform/5d0c0000.gpio, 5d0c0000.gpio:
 gpio-358 (                    |ss-sel              ) out lo
 gpio-359 (                    |sw-3p3-sd1          ) out lo
 gpio-371 (                    |reset               ) out hi
 gpio-374 (                    |sysfs               ) in  hi
 gpio-379 (                    |SATA CLKREQ         ) out lo
 
 
 echo 374  >  /sys/class/gpio/export
 
 echo out > /sys/class/gpio/gpio374/direction
 
 
 echo 1 >  /sys/class/gpio/gpio374/value
 echo 0 >  /sys/class/gpio/gpio374/value
 
 
 
root@imx8qmmek:~# echo 374  >  /sys/class/gpio/export
root@imx8qmmek:~# echo out > /sys/class/gpio/gpio374/direction

root@imx8qmmek:~# echo 1 >  /sys/class/gpio/gpio374/value

root@imx8qmmek:~# cat /sys/kernel/debug/gpio
gpiochip7: GPIOs 256-287, parent: platform/5d0f0000.gpio, 5d0f0000.gpio:

gpiochip6: GPIOs 288-319, parent: platform/5d0e0000.gpio, 5d0e0000.gpio:

gpiochip5: GPIOs 320-351, parent: platform/5d0d0000.gpio, 5d0d0000.gpio:
 gpio-341 (                    |wp                  ) in  hi
 gpio-342 (                    |cd                  ) in  hi IRQ

gpiochip4: GPIOs 352-383, parent: platform/5d0c0000.gpio, 5d0c0000.gpio:
 gpio-358 (                    |ss-sel              ) out lo
 gpio-359 (                    |sw-3p3-sd1          ) out lo
 gpio-371 (                    |reset               ) out hi
 gpio-374 (                    |sysfs               ) out hi
 gpio-379 (                    |SATA CLKREQ         ) out lo

gpiochip3: GPIOs 384-415, parent: platform/5d0b0000.gpio, 5d0b0000.gpio:

gpiochip2: GPIOs 416-447, parent: platform/5d0a0000.gpio, 5d0a0000.gpio:

gpiochip1: GPIOs 448-479, parent: platform/5d090000.gpio, 5d090000.gpio:
 gpio-461 (                    |epdev_on            ) out hi

gpiochip0: GPIOs 480-511, parent: platform/5d080000.gpio, 5d080000.gpio:
 gpio-511 (                    |headphone detect    ) in  lo IRQ
 
root@imx8qmmek:~#  echo 0 >  /sys/class/gpio/gpio374/value

root@imx8qmmek:~# cat /sys/kernel/debug/gpio
gpiochip7: GPIOs 256-287, parent: platform/5d0f0000.gpio, 5d0f0000.gpio:

gpiochip6: GPIOs 288-319, parent: platform/5d0e0000.gpio, 5d0e0000.gpio:

gpiochip5: GPIOs 320-351, parent: platform/5d0d0000.gpio, 5d0d0000.gpio:
 gpio-341 (                    |wp                  ) in  hi
 gpio-342 (                    |cd                  ) in  hi IRQ

gpiochip4: GPIOs 352-383, parent: platform/5d0c0000.gpio, 5d0c0000.gpio:
 gpio-358 (                    |ss-sel              ) out lo
 gpio-359 (                    |sw-3p3-sd1          ) out lo
 gpio-371 (                    |reset               ) out hi
 gpio-374 (                    |sysfs               ) out lo
 gpio-379 (                    |SATA CLKREQ         ) out lo

gpiochip3: GPIOs 384-415, parent: platform/5d0b0000.gpio, 5d0b0000.gpio:

gpiochip2: GPIOs 416-447, parent: platform/5d0a0000.gpio, 5d0a0000.gpio:

gpiochip1: GPIOs 448-479, parent: platform/5d090000.gpio, 5d090000.gpio:
 gpio-461 (                    |epdev_on            ) out hi

gpiochip0: GPIOs 480-511, parent: platform/5d080000.gpio, 5d080000.gpio:
 gpio-511 (                    |headphone detect    ) in  lo IRQ
root@imx8qmmek:~#

 

 

0 项奖励
回复

1,843 次查看
Chavira
NXP TechSupport
NXP TechSupport

Hi @ChChang!

You have to configure the GPIO in the device tree first.

If you want to power off/wake the Bluetooth function using our Bluetooth/Wifi devices you can do with the commands described in the Linux User guide.

If you have another Bluetooth card please refer to the drivers and commands available for your device.

Best Regards!

Chavira

0 项奖励
回复

1,906 次查看
Chavira
NXP TechSupport
NXP TechSupport

Hi @ChChang!

Thank you for contacting NXP Support!

According to the schematic of the board, the pin ball is called "QSPI1A_DQS" and by searching in the Reference Manual (page 782) you can mux the pin to GPIO4 IO22.

You can download the documentation by following the links:

https://www.nxp.com/products/processors-and-microcontrollers/arm-processors/i-mx-applications-proces...

https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/i-mx-8quadmax-m...

Chavira_2-1691695299530.pngChavira_3-1691695321125.png

 

Best Regards!

Chavira

 

0 项奖励
回复