AnsweredAssumed Answered

IMX8QXP,How to set gpio by register

Question asked by shalan yang on May 7, 2018
Latest reply on May 8, 2018 by shalan yang

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)

Outcomes