IMX8QXP,How to set gpio by register

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX8QXP,How to set gpio by register

19,243 Views
shalanyang
Contributor II

HI ALL, 

            IMX8QXP, How to set by register,for example GPIO1_20.

            by datasheet:

            7.2.2.3.2 GPIO Write Mode
The programming sequence for driving output signals should be as follows:
1. Configure IOMUX to select GPIO mode (Via IOMUXC), also enable SION if need
to read loopback pad value through PSR
2. Configure GPIO direction register to output (GPIO_GDIR[GDIR] set to 1b).
3. Write value to data register (GPIO_DR).
A pseudocode description to drive 4'b0101 on [output3:output0] is as follows:
// SET PADS TO GPIO MODE VIA IOMUX. 
i.MX 8DualXPlus/8QuadXPlus Applications Processor Reference Manual, Rev. A, 6/2017

 

write sw_mux_ctl_pad_<output[0-3]>.mux_mode, <GPIO_MUX_MODE>
// Enable loopback so we can capture pad value into PSR in output mode 
write sw_mux_ctl_pad_<output[0-3]>.sion, 1
// SET GDIR=1 TO OUTPUT BITS. 
write GDIR[31:4,output3_bit,output2_bit, output1_bit, output0_bit,] 32'hxxxxxxxF
// WRITE OUTPUT VALUE=4’b0101 TO DR. 
write DR, 32'hxxxxxxx5
// READ OUTPUT VALUE FROM PSR ONLY. 
read_cmp PSR, 32'hxxxxxxx5
General Purpose Input/Output (GPIO)

 

I want to configure SC_P_FLEXCAN2_TX to GPIO,  now ,I found how to config GPIO_DR GPIO_GDIR GPIO_PSR, 

as follow code:

 

base: 0x5D09_0000

GPIO_DR addr:0x5D090000 value:0x5C16600D

GPIO_GDIR addr:0x5D090004 value:0x1C156000

GPIO_PSR addr:0x5D090008 value:0x5C16600D

 

but I can not find the IOMUXC control register address? could you help me ?

 

by the IMX8DQXPRM_Rev_A.pdf datasheet ,I try to access the iomux base , but have these error

135|@nutshell:/ # ./var/memtool -r 0x33F80000 0x0
[ 2384.218394] Unhandled fault: synchronous external abort (0x92000210) at 0x0000ffff9e21c000
Bus error 

 

why? who can tell me ? (my BSP version:L4.9.51_8qm-beta2/8qxp-beta)

Labels (1)
0 Kudos
5 Replies

16,567 Views
igorpadykov
NXP Employee
NXP Employee

Hi shalan

as MX8QXP is not publicly released yet, there is no regular support for its software and

on below link memtool has not MX8 files:

memtool\test - imx-test - i.MX Driver Test Application Software 

General way to set gpio - is to use api, please check sources on

pad\svc\sc\imx\soc\drivers - linux-imx - i.MX Linux kernel 

use function sc_pad_set_mux(), config as SC_PAD_CONFIG_NORMAL

api.h\pad\svc\sc\imx8\soc\include - linux-imx - i.MX Linux kernel 

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

0 Kudos

16,567 Views
shalanyang
Contributor II

Hi ,igorpadykov,

        first, thanks for you answer, we have a program with imx8qxp for meter, Iwe hope uboot startup very fast an fast,

but when power on before the console show logo, it is spend about 236 ms,so I want to know why  the first stage in uboot spend so much time, so I want to configure gpio1_20 by register ,then I can test the time by  Oscilloscope ,the logo is follow:

power ON:

[ 0.236] U-Boot 2017.03-00644-ge2936712ab-dirty (May 08 2018 - 11:30:38 +0800)

[ 0.243] CPU: Freescale i.MX8QXP revA A35 at 1200 MHz at 41C
[ 0.274] Model: Freescale i.MX8QXP LPDDR4 ARM2
[ 0.278] Board: iMX8QXP LPDDR4 ARM2
[ 0.282] Boot: MMC0
[ 0.284] DRAM: 3 GiB
board_gpio_init====================TEST
[ 0.374] MMC: Actual rate for SDHC_0 is 333333333
[ 0.382] FSL_SDHC: 0
[ 0.385] Using default environment

[ 0.388] In: serial@5a060000
[ 0.391] Out: serial@5a060000
[ 0.394] Err: serial@5a060000
[ 0.398]
[ 0.399] BuildInfo:
[ 0.401] - SCFW 9f3fa3da, IMX-MKIMAGE e2936712, ATF
[ 0.407] - U-Boot 2017.03-00644-ge2936712ab-dirty

[ 0.412] Normal Boot
[ 0.558] kernle sImageHeader.imageheadinfo.ih_size=0x7aa400
[ 0.563] uieMMC_KernelAddr=0x100000, uiKernelSize=0xa47a40
[ 0.569] eMMC_kernel_block=0x800, eMMC_kernel_cnt=0x523e
[ 0.574] uieMMC_DTBAddr=0xb47a40
[ 0.579] uieMMC_DTBAddr%IAUTO_MMC_BLKSIZE=0x40
[ 0.583] DTB sImageHeader.imageheadinfo.ih_size=0xae20000
[ 0.589] uiDTBSize=0xe24a
[ 0.592] uiDTBLoadAddr = 0x82ffffc0
[ 0.595] uiDTBLoadAddr = 0x82ffff80
[ 0.600] kernle sImageHeader.imageheadinfo.ih_size=0x64732b00
[ 0.606] Hit any key to stop autoboot: 0
switch to partitions #0, OK
[ 0.729] mmc0(part 0) is current device
[ 0.733]
[ 0.734] MMC read: dev # 0, block # 2048, count 21054 ... 21054 blocks read: OK
[ 0.783]
[ 0.784] ## Checking Image at 8027ffc0 ...
[ 0.788] Legacy image found
[ 0.791] Image Name: imx8x-poc 20180508-113157
[ 0.796] Image Type: AArch64 Linux Kernel Image (uncompressed)
[ 0.803] Data Size: 10779136 Bytes = 10.3 MiB
[ 0.808] Load Address: 8027ffc0
[ 0.811] Entry Point: 80280000
[ 0.815] Verifying Checksum ... OK
[ 0.896]
[ 0.897] MMC read: dev # 0, block # 43008, count 5562 ... 5562 blocks read: OK
[ 0.917]
[ 0.918] MMC read: dev # 0, block # 23101, count 114 ... 114 blocks read: OK
[ 0.928]
[ 0.929] ## Checking Image at 82ffffc0 ...
[ 0.934] Legacy image found
[ 0.937] Image Name: imx8x-poc 20180508-113157
[ 0.942] Image Type: AArch64 Linux Kernel Image (uncompressed)
[ 0.948] Data Size: 57866 Bytes = 56.5 KiB
[ 0.953] Load Address: 00000000
[ 0.956] Entry Point: 00000000
[ 0.960] Verifying Checksum ... OK
[ 0.963] ## Loading init Ramdisk from Legacy Image at 84000000 ...
[ 0.970] Image Name: imx_imx8x 20180508-113539
[ 0.975] Image Type: AArch64 Linux RAMDisk Image (gzip compressed)
[ 0.981] Data Size: 2847588 Bytes = 2.7 MiB
[ 0.986] Load Address: 00000000
[ 0.990] Entry Point: 00000000
[ 0.993] Verifying Checksum2222 ... OK
[ 1.017] ## Flattened Device Tree blob at 83000000
[ 1.022] Booting using the fdt blob at 0x83000000
[ 1.027] Using Device Tree in place at 0000000083000000, end 0000000083011209
[ 1.090]
[ 1.091] Starting kernel ...

.....

there is any way to access the GPIO1_20 ? could you help me ?

0 Kudos

16,567 Views
igorpadykov
NXP Employee
NXP Employee

in uboot you can look at gpio example in enet_device_phy_reset() in

uboot/board/freescale/imx8qxp_mek/imx8qxp_mek.c

imx8qxp_mek.c\imx8qxp_mek\freescale\board - uboot-imx - i.MX U-Boot 

Best regards
igor

0 Kudos

16,567 Views
shalanyang
Contributor II

or like this https://mp.weixin.qq.com/s/bXbBvRTq27OmXVSZw90N8Q ,but IMX8QXP I do not know how to configure the gpio

0 Kudos

16,567 Views
shalanyang
Contributor II

Yes, I know this way?

        but before applay this sc_pad_set()  fuction to set gpio1_20 ,uboot startup had spend more than 200ms, so I want to know how to configure it in start.s when power on  and I want to know why spend so much time before ,so I want to configure it by register the same as IMX51+WINCE6.0基于SD_MMC启动—XLDR(3)之xldr.s | 学步园 

thanks!

0 Kudos