MTK Android Driver: UART, mtkandroid

Source: Internet
Author: User

MTK Android Driver: UART, mtkandroid
Reprinted please indicate the source: http://blog.csdn.net/cbk861110/article/details/42583469
1. uart port configuration: Set uart log and meta configuration ports to other ports. The empty uart1 is used for communication debugging. Note: Only the uart1 port on the hardware board can be debugged by flying lines. Modification Method: Refer to [FAQ07420] how to set a version earlier than JB5.MP for the uart port for puting uart log: alps/medaitek/custom/[$ project]/preloader/inc/EK # define pai_uart_log (UART4) // (UART1) # define pai_uart_meta (UART4) // (UART1) versions later than JB5.MP: alps \ mediatek \ custom \ $ project \ preloader \ cust_bldr.mak1__uart_log: = UART4 # uart11__uart_meta: = UART4 # UART1
2. improve the permission of the UART port. Take UART1 as an example: alps/medaitek/config/[$ project]/init. project. in rc, add: chmod 0666/dev/ttyMT0chown system/dev/ttyMT0
The correspondence between the uart physical port and the system device name: uart1 --/dev/ttyMT0uart2 --/dev/ttyMT1uart3 --/dev/ttyMT2uart4 --/dev/ttyMT3
3. platform-related serialport api code: Upper-layer api: alps \ frameworks \ base \ core \ java \ android \ hardware \ SerialPort. javaJNI definition: alps \ frameworks \ base \ core \ jni \ android_hardware_SerialPort.cpp system demo apk: alps \ frameworks \ base \ tests \ SerialChat remarks 1: This api is not verified yet, ongoing validation;
NOTE 2: Verify can debug OK api mechanism can refer to: android_serialport_api, this framework is hosted in: https://code.google.com/p/android-serialport-api/ Google code library, helpless domestic can not download https://github.com/cepr/android-serialport-api GITHUB address

4. Test method: 1.) check whether the serial port number, baud rate, verification method, stop bit, and other required settings are correct.

2) transient TX and RX check whether self-reception can be performed

3) If you are connecting to a computer and debugging through the serial port debugging tool/Super Terminal, check whether the serial port line can receive and send data normally. It can be transient to see if it can be self-received.


5. Hardware solder wires three tx rx gnd wires are connected to peripheral communication devices for communication debugging.
6. serial Port log printing method: 1) After the UART line is inserted, the computer will automatically install the corresponding driver, my computer-right-click-Device Manager-Port: USB-to-Serial Comm Port (COM14), where you can find the computer Port number corresponding to UART; 2) Serial Port printing tool. super Terminal on your computer: Use: "Start" menu-all programs-accessories-communication-Super Terminal-enter the name & port number in the pop-up box to automatically generate an application pop-up interface, it can be used to display UART serial port information; B) "Serial Port tool": download online c) SecureCRT: download from the Internet; usage: connet-> right-click-> properties to set properties: set the communication type to Serial Port: Protocol: Serial set Port configuration: Serial :( the following configuration data is for reference only) Port: COM14 baud rate: 9600 check: none stop bit: 1 Data bit: 8 traffic control: NULL
7. the analysis of the andori uart log eng version cannot be spit out. The ENG version automatically closes the UART Log after it is started to Launcher, this allows almost all tests to get the same test results on the eng and user versions. There are two ways to temporarily open the UART log in the eng version (it becomes invalid after restart): press any key on the keyboard in the Super Terminal window to let the UART log continue to vomit. This method requires that the TX and RX of UART be connected. By modifying proc parameters: adb shell echo 1>/proc/mtprintk, you can enable UART Log permanently on the eng version (which will continue to work after restart ): by modifying the Property: adb shell setprop persist. uartconsole. enable 1 (through getprop persist. uartconsole. enable can query attribute values) refer to: [FAQ11402] After JB9/KK1 is started, the UART log stops output. [FAQ10087] Why does the UART Log not vomit after entering the Launcher interface?
8. for details about how to enable andori uart log user version, refer to [FAQ02495] How to enable UART log in Android user version [FAQ03891] How to enable serial port (Uart) in User version and capture the upper layer Log, enable input console
9. android serial communication type: There are four methods to communicate with Android and serial devices: the first is to directly use the SDK's javasthsocket class for Bluetooth communication, and the external devices use Bluetooth to serial port for control. This method has a high latency, And the bluetooth module needs power supply and low bandwidth. The second method is USB to RS232 (using the kernel driver and Android driver). This method does not require hardware changes or additional power supply, low latency and high bandwidth. However, Android devices require hardware support for USB Host interfaces (generally supported by Android tablets, but not Android phones ), in addition, you may need root to change the/dev/ttyUSB0 File Permission to load a kernel module. Android_serialport_api is required for development. The third method is the easiest way to connect directly using a serial port. However, this method is not compatible and only supports a few devices, moreover, the serial port does not support throttling (determined by the USB Host API provided by Android ). Android_serialport_api is also used for use. The fourth is to use Android as a USB slave, and the external device as a USB host to communicate with it. This method is compatible with almost all Android devices (generally with a USB slave port), without the need for root, low latency and high bandwidth.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.