The Apalis i. MX6D/Q module can support up to 5 UART serial port outputs. Compatible with high-speed TIA/EIA-232F (up to 5Mbit/s). Supports 7, 8 or 9 (for RS485) bits of data, 1 or 2 stop bits. UART1 is a full-featured serial port, and the rest of the serial ports can also support RTS and CTS signals.
In Linux systems, a serial port is usually reserved for application debugging and development and system upgrades. Although functions such as SSH can also be used for remote network access and system debugging, for embedded products, the information when the system starts, especially the Uboot startup information, can help with function debugging and problem location. However, this information can only be output from the serial port. When updating the Linux BSP of the Toradex module, it is also necessary to do so in Uboot.
The remaining 4 serial ports of the Apalis i.MX6Q/D module can not only use TTL level to directly control the corresponding peripherals, but also be expanded to RS232/RS485/RS422 commonly used industrial control ports. For the demand for more serial ports, there are currently multiple solutions to achieve serial port expansion, such as through USB, SPI, Memory Bus, I2C and PCIe buses. Memory Bus and PCIe have higher real-time performance than other buses, and more serial ports can be expanded on the same interface. For applications with high serial port quantity and data real-time performance, these two expansion solutions can be preferred. At the same time, Memory Bus and PCIe are high-speed signal buses, which require some special considerations in PCB wiring. Toradex also provides free PCB design guidance for this purpose. Next, we will introduce how to use EXAR's XR17V358 solution based on the PCIe bus to expand 8 serial ports.
1). XR17V358 solution introduction and driver download
The 8 extended serial ports of XR17V358 all support RTS/CTS or DTR/DSR flow control functions. Each serial port has a 256-byte FIFO, independent clock output, supports half-duplex RS485, and has a maximum transmission speed of 25 Mbps. XR17V358 uses PCIe 2.0 Gen 1 to connect to Apalis i.MX6Q/D to ensure high-speed real-time data transmission. EXAR currently provides Windows and Linux drivers for XR17V358. Here we use its latest Linux driver and port it to the Apalis i.MX6 platform. Driver source code download address http://www.exar.com/common/content/document.ashx?id=20121
2). Configure the compilation environment
Before compiling, you also need to download the Linux kernel and cross-compilation tools for Apalis i.MX6.
a). Download the Linux kernel for Apalis i.MX6
$ git clone -b toradex_imx_3.14.28_1.0.0_ga-next git://git.toradex.com/linux-toradex.git
b). Download cross-compilation tools
$ wget http://releases.linaro.org/14.11/components/toolchain/binaries/arm-linux-gnueabihf/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz
$ tar xvf gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz
$ ln -s gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf gcc-linaro
$ export ARCH=arm
$ export PATH=~/gcc-linaro/bin/:$PATH
$ export CROSS_COMPILE=arm-linux-gnueabihf-
Note: The above path needs to correspond to the directory where the cross-compilation tool is actually unpacked.
c). Compile the Linux kernel and provide the necessary configuration files for XR17V358.
$ make apalis_imx6_defconfig
$ make -j4 uImage LOADADDR=10008000
d). Compile XR17V358 driver
// Edit the Makefile file and point KERNEL_SRC to the directory where the Linux kernel is located
KERNEL_SRC = /home/ban/Toradex/oe-core-tegra/LinuxKernel/v2.5/mx6/toradex_imx_3.14.28_1.0.0_ga-next/linux-toradex
// Save and run the make command to compile, making sure the ARCH, PATH, and CROSS_COMPILE parameters mentioned above are still valid.
$ make
// After successful compilation, the kernel module file xr17v35x.ko for the ARM processor will be generated
$ file xr17v35x.ko
xr17v35x.ko: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), BuildID[sha1]=399121b7862105b185e24b45
e). Install the driver
Copy xr17v35x.ko to the Apalis i.MX6 module and install
root@apalis-imx6:~# insmod xr17v35x.ko
[ 151.156648] Exar PCIe (XR17V35x) serial driver Revision: 2.0
root@apalis-imx6:~# lspci
00:00.0 PCI bridge: Device 16c3:abcd (rev 01)
01:00.0 PCI bridge: PLX Technology, Inc. PEX 8605 PCI Express 4-port Gen2 Switch (rev aa)
02:01.0 PCI bridge: PLX Technology, Inc. PEX 8605 PCI Express 4-port Gen2 Switch (rev aa)
02:02.0 PCI bridge: PLX Technology, Inc. PEX 8605 PCI Express 4-port Gen2 Switch (rev aa)
02:03.0 PCI bridge: PLX Technology, Inc. PEX 8605 PCI Express 4-port Gen2 Switch (rev aa)
03:00.0 Serial controller: Exar Corp. Device 0358 (rev 03)
The corresponding serial port device files ttyXR0 to ttyXR7 appear in the /dev directory.
root@apalis-imx6:/dev# ls
autofs network_latency tty18 tty60
block network_throughput tty19 tty61
bus null tty2 tty62
char port tty20 tty63
console ppp tty21 tty7
cpu_dma_latency ptmx tty22 tty8
cuse ptp0 tty23 tty9
disk pts tty24 ttyXR0
dri ram0 tty25 ttyXR1
fb ram1 tty26 ttyXR2
fb0 ram10 tty27 ttyXR3
fb1 ram11 tty28 ttyXR4
fb2 ram12 tty29 ttyXR5
fb3 ram13 tty3 ttyXR6
fd ram14 tty30 ttyXR7
f). Set the baud rate
root@apalis-imx6:~# stty -F /dev/ttyXR0 115200
After the driver is loaded, it can be used normally in Linux like other serial ports.
Previous article:ARM Embedded Linux Device Tree Introduction and Application Examples
Next article:Limitations of ARM processor instruction immediate addressing
Recommended ReadingLatest update time:2024-11-16 08:47
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 【LAUNCHXL-CC2650】Pressure gasket pressure test
- Selection of diodes for analog circuits
- A Brief Analysis of High-Speed Laser Marking Control System Based on DSP
- About USB2.0 plug-in and switch
- [Atria AT32WB415 Series Bluetooth BLE 5.0 MCU] + Bluetooth communication
- xilinx vivado xdc constraint syntax
- Design and Implementation of Digital Video Conversion Interface Based on FPGA
- [AT-START-F403A Evaluation] VI. FreeRTOS system based on IAR security library (sLib) secondary development mode practice
- About the 2021 E-Sports Championship
- FPGA Advanced Timing Synthesis Tutorial