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.
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
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- STM32F767 ADC self-calibration problem
- Electronic Technology Basics Analog Part
- EEWORLD University ---- Digi-Key: Accelerated Application of Graph Algorithms in Deep Learning
- Echo Cancellation - How to solve the serious problem of sound swallowing during dual talk in WebRTC AEC algorithm
- [TI millimeter wave radar evaluation]_2_1243Problems encountered in BOOST debugging
- FPGA Timing Constraints Practice: Sorting Out the Clock Tree
- A constant and adjustable output power electronic cigarette power supply solution based on TPS61022
- Sales of new energy vehicles have skyrocketed, how should we deal with used batteries?
- E-ON China Online Cloud Sharing Laboratory——"Microcomputer Principles and Applications"
- Improving Power Supply Network Efficiency Using Fixed Ratio Converters