Xunwei iTOP-4418/6818 development board-driver-implement GPIO expansion

Publisher:心愿实现Latest update time:2022-01-18 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

To implement GPIO expansion, first clarify the concept of "multiplexing", remove the configuration of the driver that calls these GPIOs,
recompile , and add it to your own driver, then you can implement the input and output of the extended GPIO.


In addition, you must first read the document "Xunwei iTOP-4418 Development Board and 6818 Development Board-Driver-GPIO Input and Output and Examples_V1.X".


1 The GPIO expansion core is configured
on the baseboard, and the extended ports are J6 (camera port) and J38 (GPIO/CAN/485). In addition, if you make
the baseboard yourself and do not use WIFI and other modules, you can also expand the IO ports of WIFI and other modules into GPIO.


Here we only introduce the IO ports on J6 and J38 that are convenient for expansion.


As shown in the figure below, it is the camera interface. The two pins with "SDA" and "SCL" are bus pins, and
it is not recommended to change them to GPIO interfaces. The red words such as "MCU_TSI1_D5" are keywords.

If you want to determine whether the pin can be reused as a GPIO interface, search for this keyword in the core board schematic
"topeet_s5p4418_coreborad_v1_2.pdf" and you will get two results. One is the board-
to-board connector, and the other is the pin on the MCU. As shown in the figure below

On the MCU, users can see other functions corresponding to the pin. In the red box, it can be found that the pin can
be reused as GPIO, numbered GPIOE1, and the macro definition is (PAD_GPIO_C+13). Users can query the corresponding numbers of other pins in turn according to this method.


If this GPIO is called by other drivers, the driver configuration needs to be removed. As shown in the figure below, the camera
driver removed so that these interfaces can be used as GPIO.


Device Drivers --->
Multimedia support --->
Video capture adapters (remove)
You need to remove both OV5640 and TVP5150. The drivers for these two cameras are in Video capture

adapters.

As shown in the figure below, remove the RS485 and Relay drivers, and you can also expand some GPIO ports.
Device Drivers --->
Character devices --->

2 GPIO reuse statistics
In order to facilitate everyone's expansion, the author has counted the network labels, pin numbers, etc. to facilitate everyone's expansion.

With the GPIO numbers corresponding to the interfaces, you can write programs to call these GPIOs.


3 Driver

Users can modify the driver routines in "iTOP-4418 and 6818-Driver-GPIO Output Driver and
GPIO Extension_V1.X" according to their actual needs.


If you want to replace the code
#define GPIOIN (PAD_GPIO_B + 18) with operating multiple GPIOs, you can define it as an array, for example: static int gpiostest[] = { PAD_GPIO_C+13,PAD_GPIO_C+5,PAD_GPIO_C+4,PAD_GPIO_E+1,PAD_GPIO_E+3, PAD_GPIO_E+2,PAD_GPIO_E+0,PAD_GPIO_D+31,PAD_GPIO_D+30,PAD_GPIO_D+29,PAD_GPIO_E+4,PAD_GPIO_D +28,PAD_GPIO_E+6,PAD_GPIO_E+5,PAD_GPIO_B+16, PAD_GPIO_C+10,PAD_GPIO_C+11,PAD_GPIO_C+12,PAD_GPIO_C+9, }; Use gpio_request/free function to apply for and release GPIO; Use gpio_direction_input/gpio_direction_output function to set to input and output mode; Use gpio_get_value/gpio_set_value function to get GPIO value and set GPIO output, etc. You only need to do a loop . For example, the gpio_request function applies for GPIO. The code is as follows: for(i=0; i

















The other operations are similar.
So far, the GPIO expansion and GPIO input and output of the 4418 and 6818 development boards have been fully introduced.


Reference address:Xunwei iTOP-4418/6818 development board-driver-implement GPIO expansion

Previous article:Xunwei 4418 development board - driver - watchdog and Linux-c test tutorial
Next article:iTOP-4412 development board - TF card cannot be recognized after partitioning using PartitionManager

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号