5616 views|1 replies

298

Posts

1

Resources
The OP
 

Freescale-iMX6 Development Board-GPIO Read and Write Configuration Document_V1.0《1》 [Copy link]

This document mainly introduces the read and write configuration of the gpio pins of the iMX6 board. For information about device registration in platform files, please refer to

Refer to the "iTOP-iMX6-Platform File Register Device" document. The registered device name is "gpio_ctl".

Hardware environment: iMX6 development board: core board v_1.2, baseboard v_2.2 (and v_2.1 baseboard).

Software environment: Ubuntu 12.04.

1.1 Configuration file overview

To configure gpio, you need to study three files, namely "arch/arm/plat-mxc/include/mach/iomux-

mx6q.h", "arch/arm/mach-mx6/board-mx6q_topeet.h", "arch/arm/mach-

mx6/board-mx6q_topeet.c".

The "arch/arm/plat-mxc/include/mach/iomux-mx6q.h" file is all the IOs of IMX6 and its

The definition set of all functions of each IO. Users can query the definition of a certain IO function through this file.

The "arch/arm/mach-mx6/board-mx6q_topeet.h" file is used to define the initialization of IMX6 corresponding to the needs

The function of the IO port used. Initialize the gpio in this file.

The "arch/arm/mach-mx6/board-mx6q_topeet.c" file is the board-level initialization file of IMX6.

This file can set the gpio pins.

1.2 Hardware Introduction

1.2.1 Bottom plate

Check the iMX6 baseboard schematics v_2.2. We take the following 5 pins as an example and perform the following operations.

(, downloads: 0)

The picture below is the schematic diagram of the baseboard of version v_2.1.

(, downloads: 0)

Search for each network label "EIM_D17", "EIM_D18", "EIM_D20",

"KEY_ROW5", "EIM_D19". You can see that they are all connected to the board-to-board connector. That is, they are all connected to the core

Next, look at the core board schematic.

1.2.2 Core board part

Search the network number above to see where it is connected to the core board, as shown below.

(, downloads: 0)
(, downloads: 0)

As can be seen from the figure above, the five pins are connected to the core's "EIM_D17", "EIM_D18", "EIM_D20",

"GPIO_1", "EIM_D19" pins. Next, in "arch/arm/plat-mxc/include/mach/iomux-

mx6q.h" to view the function definition of each IO port.

1.3 Software Configuration

1.3.1 iomux-mx6q.h file

The main function of the iomux-mx6q.h file is to query the definition of a certain IO function.

Enter the iMX6 kernel source directory and use "vi arch/arm/plat-mxc/include/mach/iomux-

mx6q.h" command to open the iomux-mx6q.h file. As shown below.

(, downloads: 0)

Search for the five pin names seen above.

Take pin 1 as an example. Use "/EIM_D17" to search for the following information. See the figure below.

(, downloads: 0)

From the above figure, we can see that the expansion bus "EIM_D17" is defined as 8 functions.

Note that no matter initialization or definition of functions, there should be no conflicts to avoid the functions you are using being occupied by other functions.

When EIM_D17 is configured as a GPIO function, the definition used is: _MX6Q_PAD_EIM_D17__GPIO_3_17.

Where _MX6Q_PAD_EIM_D17__GPIO_3_17 is defined as:

#define _MX6Q_PAD_EIM_D17__GPIO_3_17 \

IOMUX_PAD(0x03A8, 0x0094, 5, 0x0000, 0, 0)

This macro is critical, and its prototype is:

#define IOMUX_PAD(_pad_ctrl_ofs,_mux_ctrl_ofs,_mux_mode,_sel_input_ofs,_sel_input,_pad_ctrl)

The IOMUX_PAD macro has 6 parameters, each of which means:

(, downloads: 0)

The definitions of pins 2, 3, and 12 are similar to those of pin 1. I will not go into detail here. Search for the definition of pin 10.

"/GPIO_1" command, and the following information is displayed. (Note that GPIO is the GPIO after MX6Q_PAD)

(, downloads: 0)

As can be seen from the figure above, the definition used when GPIO_1 is configured as a GPIO function is:

_MX6Q_PAD_GPIO_1__GPIO_1_1.

Now we can temporarily summarize the information we have obtained. As shown in the figure below.

(, downloads: 0)

1.3.2 board-mx6q_topeet.h file

The board-mx6q_topeet.h file is used to define the functions of the IO ports that need to be used to initialize IMX6.

In the board-mx6q_topeet.h file, search for the used IO to see if it is not defined as other functions. If so,

You need to comment it out and then add your own initialization definition.

Enter the command "vi arch/arm/mach-mx6/board-mx6q_topeet.h" in the kernel source directory to open

board-mx6q_topeet.h file. As shown below.

(, downloads: 0)

Let’s take the configuration of EIM_D17 as an example. Use “/MX6Q_PAD_EIM_D17” to search for the initialization signal.

Check the information and find that the function has been initialized. Comment out the initialization, as shown in the figure below.

(, downloads: 0)

Searching again did not find other related definitions. Other pins are similar. Make sure they are not defined by other functions.

(Definition in the iomux-mx6q.h file). There is one more place that needs to be commented out, as shown below.

(, downloads: 0)

Now add initialization to the above pins. See the figure below.

(, downloads: 0)

Note that it is added to mx6q_topeet_pads[].

1.3.3 board-mx6q_topeet.c file

The board-mx6q_topeet.c file can set the gpio pins.

In the board-mx6q_topeet.c file, the gpio pins we are going to use may be occupied by other functions.

We are asked to comment out other functions or set them to NULL.

In the iMX6 kernel source directory, use the command "vi arch/arm/mach-mx6/board-mx6q_topeet.c"

Open the board-mx6q_topeet.c file, as shown below.

(, downloads: 0)

Use the command "/IMX_GPIO_NR(3, 17)" to find the configuration corresponding to EIM_D17. (Note that 17 and the previous

There is a space between the commas in the text box, otherwise it will not be searched). Change the searched configuration to NULL. As shown below.

(, downloads: 0)

The other pins are similar. All modifications are as shown below.

(, downloads: 0)
(, downloads: 0)
(, downloads: 0)

At this point, our configuration is complete. Note: There are two IMX_GPIO_NR(1, 1).

Compile the kernel according to the kernel compilation steps in the "iTOP-i.MX6 Development Board Full Version User Manual".

Burn it to the development board and proceed to the next step of testing.

This content is originally created by EEWORLD forum user Shawu's joke . If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source

This post is from Embedded System

Latest reply

I learned a lot, thanks for sharing the content   Details Published on 2019-11-5 15:55
Personal signature更多开发板详情了解哦

1.https://arm-board.taobao.com
2.www.topeetboard.com
Q: 2551456065

20

Posts

0

Resources
2
 

I learned a lot, thanks for sharing the content

This post is from Embedded System
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list