- 浏览: 302448 次
- 性别:
- 来自: 南京
文章分类
最新评论
-
ggwang:
谢谢分享!
如何释放Ubuntu多余的空间?如何给Ubuntu扩容(install inside windows)? -
allenshao:
只有放枪咯~~~~~
Google Group Android Developers 无法打开的问题 -
malong26:
也打不开~~~
Google Group Android Developers 无法打开的问题 -
songshuang:
一直喂它会一直吃是不?
用你的鼠标逗逗它 -
allenshao:
现在基本上用免费的VPN,缺点是限流量。
如何访问appspot网站?
OMAP UART PM Debugging/Test Techniques
The onboard UART-controller can usually be tested via a loop-back connection using a cable. However, when testing the behavior during suspend/resume this is not feasible and an external platform having a UART device is needed as a test stub.
The following describes such a setup and how it can be used for testing UART HW flow control and wake-up.
Specifically this test setup was created to test the omap-serial UART driver which was introduced in the kernel to enable some OMAP specific features as eg. DMA and Power Management without cluttering the previously used 8250 UART driver.
As of writing, the omap-serial driver configures the OMAP UART CTS pins as wakeup-enabled.
HW Test setup
Refer to Figure 1 . The board on the left is a Zoom2, and the board on the right is a Zoom1. The Zoom2 is the device we want to test. The Zoom1 is merely acting as a test device and could in principle be replaced with any other platform on which it is possible to control the UARTs RX/TX and RTS/CTS pins (eg. a PC). Going forward, this guide will assume a Zoom1 is used.
An expansion card is plugged into the 200-pin expansion connector on each of the 2 boards (see Figure 2 - the Zoom2 has been flipped upside-down). The reason for this is to expose UART1 on the boards, which is otherwise not easily accessible. The expansion boards are modified modem test boards, which have the 200-pin connector's UART1 RX/TX and RTS/CTS lines routed through an RS232 driver and level converter. This exposes the UART1 as any normal RS-232 interface.
Note
. Make sure to remove any modem inserted in either zoom board before testing. They also use UART1.
A null-modem cable (female-female, RX/TX and RTS/CTS lines crossed) is used to interconnect the 2 expansion cards.
So, to sum up, here's the HW required for the setup:
- 1 Zoom2
- 1 Zoom1
- 2 Modem expansion cards
- 1 RS-232 null-modem cable
Required SW
The device under test (Zoom2) needs to run the kernel with the UART driver to be tested.
The omap-serial driver has to be enabled, if not already. So run make menuconfig and enable it - also with console. The test description below does not assume that DMA is enabled, but there is not reason it could not be. On the Zoom2 kernel, also disable the 8250 serial driver.
The enabling/disabling of serial drivers can be found in menuconfig under: device drivers->Char Drivers->Serial Drivers
The following text assumes that a kernel from the p-android-omap-2.6.29 branch on the APG sync-tree: http://git.omapzoom.org/?p=kernel/omap.git;a=summary is used at commit ID not older than a0051763d5f04c0458689f0032b6f263d28a5e54 .
The test device (Zoom1) can run any kernel, as long as the driver allows
for control of the RTS line on UART1. In this setup the control is
implemented as a sys-fs entry, which toggles the RTS output line of the
zoom1.
To accommodate this, the following changes were made to drivers/serial/8250.c in the kernel:
The patch is based of Android APG kernel, commit ID 8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 , available at http://android.git.kernel.org/?p=kernel/omap.git;a=summary .
The sys-fs node is used like this:
Toggle the RTS output (using OMAP mux safe mode pull-up and pull-down):
#echo 1 > /sys/devices/platform/serial8250.0/uart1_rts_toggle
Set the RTS pin to UART mode, to be used for normal HW flow control
#echo 0 > /sys/devices/platform/serial8250.0/uart1_rts_toggle
Note
The RTS line, when used for normal HW flow control, only
enables/disables the other device's ability to send data. It is
connected to the other device's CTS input. In this context, RTS stands
for: "Request To Send to me". When asserted, the other device can send
data. When de-asserted the other device is blocked from sending data.
Thus, if the purpose of the test solely is to test the other device
during power management (the Zoom2), the RTS pin can be put into safe
mode and toggled randomly on the Zoom1 without impacting the flow of
data to the Zoom2.
As for the file systems used, the following sections Android FS on the Zoom2 and Busybox FS on the Zoom1.
To verify the operation of the RTS toggling, boot the Zoom1 and echo 1 into the sys-fs node, while scope-probing the physical RTS line shown on Figure 3 , which shows a detailed photo of the DB9 connector on the expansion card. Remember that the RS-232 driver inverts the signal, so an assertion of RTS, which is logical low on the OMAP, translates to a "high" signal on the RS-232 cable.
Test Application
The purpose of the user-space test application is two-sided: Data needs to be sent from the Zoom1 and the RTS pin needs to be toggled, and on the Zoom2 side data needs to be received. Also, when sending data, the application should be able to send sporadic burst to simulate the behavior of eg. control data from a modem. This would help test some PM aspects (eg. inactivity timeouts).
Using an existing UART test application written by TI developers in India as basis, the above requirements could be fulfilled using the same small application on both the Zoom1 and Zoom2 side. Depending on its mode of operation (send/receive), the application can be configured using command-line parameters.
The source code for the application ts_uart is available here:
Compilation
To compile for ARM and busybox file system, you need to specify the
location of your cross-compiler in the CROSS_COMPILE environment
variable. Eg., after cd'ing to the source directory:
#make CROSS_COMPILE=/usr/bin/arm-2009q1/bin/arm-none-linux-gnueabi ts_uart
To compile for use in the Google Android file system, as of writing, the google compiler is required, since Android links up against its own Bionic c libraries. To do this, copy the ts_uart source dir into /path/to/mydroid/external/
Then, to compile, cd to /path/to/mydroid and run:
#make -j2 ts_uart
Look at the output logs to see where the executable is moved.
Preparation for test
Deploy the ts_uart test application to both the Zoom1 and Zoom2 file systems - preferably in a dir that's included in the PATH variable. Connect the boards as mentioned above with a null-modem cable.
To get console control of each board, one needs to have two serial terminal emulators running on one's PC, eg. minicom. The two minicoms each need to connect to the UART or USB port of the PC, that is wired to the console UART port on each of the boards.
After boot-up, a the connection between the boards can be verified (if needed) using a terminal emulator running on each board (eg. nanocom, microcom, picocom, minicom). The source for these is available on the internet, but needs to be compiled for ARM.
In the console, just connect each terminal emulator program to /dev/ttyS0 at 115200 baud respectively. When typing something in one terminal, it should appear in the other.
Also, have test file ready for transfer in the same directory as the ts_uart directory on the Zoom1. Any file can be used, but it should be something that can easily be checked for integrity afterwards, like eg, a PDF file. Currently the application does not support any data validation upon transfer, so a manual method is needed.
Testing Without PM
The first test should be without power management on the Zoom2 (more specifically, without retention and OFF mode) enabled.
To see a help screen listing the parameters to ts_uart, just cd to its dir and run it without parameters:
#ts_uart
On the Zoom2:
Configure ts_uart for receiving data into sample.file at 115200 baud with flow control enabled:
#ts_uart ts_uart r sample.file 115200 1 0 0
The last 2 parameters are just dummies, when receiving data.
On the Zoom1:
Before the ts_uart receive on the Zoom2 times out (about 10 seconds),
configure ts_uart on Zoom1 for sending data from sample.file at 115200
baud with flow control enabled:
#ts_uart ts_uart s sample.file 115200 1 0 0
When sending, the last two parameters do take effect. In this case, no delay between bursts or random data burst size is set, so ts_uart will transmit data at maximum speed (the given baud rate).
Note: As of now, the ts_uart application always sends/receives on /dev/ttyS0.
The sample.file should transfer, and a confirmation log should be printed in the console on both sending and receiving side. Even if it the number of bytes sent and received is identical, it is sensible to check for data validity.
Since neither OFF or Retention mode has been enabled, the Zoom2 does not fall into low power states. The only power-saving feature that could kick in is the cpu idle thread after some inactivity timer expires. As of writing this, however, when DMA is disabled, this timer is reset upon each received interrupt on the RX pin. If DMA is enabled, the timer is reset after a given DMA timeout, if there is still data in the RX FIFO.
Thus, while data is being transferred continuously, the Zoom2 idle thread never kicks in.
Try changing the ts_uart parameters for the Zoom1 to the following and re-run the test:
#ts_uart ts_uart s sample.file 115200 1 6 1
The last 2 parameters now introduce a random delay between each buffer sent up to 6 seconds and also randomly changes the size of the buffer being sent between 0-4096 bytes.
If printk()s were placed in omap_uart_idle() function in the Zoom2 kernel, one would see that the idle thread kicks in between data bursts. The active state is then resumed upon receipt of RX data, and the inactivity timer is reset.
Testing with PM
Enable the OFF mode or Retention transitions during idle for the Zoom2:
#echo 1 > /sys/power/sleep_while_idle
Issue the following, or press the "OFF" button on the keypad on the Zoom2:
#echo -n "mem" > /sys/power/state
This suspends the board. It's possible to wake it up again either by pressing a keypad or by typing something in the console. Another way of waking it up is by toggling the CTS line, which is what the ts_uart test application will do.
Now then, rerun the same test as above.
On the Zoom2:
#ts_uart ts_uart r sample.file 115200 1 0 0
On the Zoom1:
#ts_uart ts_uart s sample.file 115200 1 9 1
The random delay between burst is now up to 9 seconds. Furthermore, when a delay other than 0 is set, the RTS line of the Zoom1 (that is, the CTS line of Zoom2) is toggled before each data burst is transmitted to the Zoom2. The line is toggled in ts_uart using the previously mentioned sysfs interface uart1_toggle_rts. Because the current omap-serial driver has CTS wakeups enabled, the toggling of the CTS line on the Zoom2 will wake-up the board from suspend. Thus, the Zoom2 will be in active state and ready to receive the data.
However, a problem was reported regarding the state of the RTS pin on the Zoom2. It was found that the RTS, which should be de-asserted by hardware when the device goes to retention or OFF, was not de-asserted when the board went into low power modes. This resulted in lost data, since the sending device saw an asserted Zoom2 RTS, and for HW flow control that means that the Zoom2 is ready to receive data when it is not.
A software workaround was introduced to "manually" de-assert the RTS line in the omap-serial driver, when a driver shutdown was initialized based on an active to low-power transition. This was done by putting the pin into mux SAFE mode. The pin would be returned to normal UART mode when leaving the low-power state.
The patch needed for this has been ported to the p-android-omap-2.6.29 branch:
The expected result when doing this transfer is that the delay between each burst should allow the Zoom2 to suspend, after which it will wake up when its CTS line is toggled by the Zoom1, thus enabling the Zoom1 to send data.
发表评论
-
What is the purpose of different Android partitions
2014-01-02 09:57 745-- Boot partition stores the An ... -
Android Partitions Explained: boot, system, recovery, data, cache & misc
2012-09-06 16:17 1109Unless you have been using your ... -
Linux Kernel Web
2012-08-08 16:40 0http://linux.chinaitlab.com/Spe ... -
What is trickle charge?
2012-07-02 09:47 898Trickle charge is just a very l ... -
Android IPC AudioFlinger binder实例
2012-06-20 13:32 1022一篇 android 的 IPC 机制 binder ... -
Android内核开发的几个常用命令
2012-02-23 15:29 1024在android源码的根目录下执行: . build/env ... -
UART的CTS/RTS介绍
2011-10-08 15:50 3228在RS232中RTS与CTS有明确的定义,但贺氏(HAYES) ... -
kernel/omap4函数
2011-10-08 10:58 0gpio_request: 申请一个gpio,检查该 ... -
spink_lock及其各个变种区别
2011-09-23 13:37 1279spin_lock 用于阻止在不 ... -
Linux内核中的jiffies
2011-08-25 17:03 2290硬件给内核提供一个系统定时器 用以计算和管理 ... -
[RTC] Read function in RTC Driver
2011-08-16 16:49 1066read: the standard read functi ... -
宏EXPORT_SYMBOL在内核中的作用
2011-08-15 10:47 1956Module运行在kernel space,不能直接调用应用程 ... -
Linux内核API手册
2011-08-05 13:39 1483附加说明文档: http://docs.huihoo ... -
Android boot process stub
2011-07-20 10:08 0Android's boot up process is su ... -
Android boot process stub
2011-07-20 10:07 967Android's boot up process is su ... -
Linux kernel之内核定时器
2011-03-31 21:00 3717内核定时器 (也称为动 ... -
Linux kernel coding style.
2011-03-08 21:45 1404Linux内核代码风格 这是一个简短的文档,描述了linux内 ... -
linux file descriptor错误如何捕获?
2010-12-30 14:48 2428在调用linux系统api的时候有时会出现一些错误,比如在op ... -
[Linux Device Drivers 3rd Notes] 3. How to write a complete char device driver.
2010-12-20 15:36 0scull impression: scull - Si ... -
[Linux Device Drivers 3rd Notes] 2. Modules and kernel programming concepts
2010-12-07 17:43 1155Preparation: Come up with ...
相关推荐
OMAP UART驱动程序是针对TI(Texas Instruments)OMAP处理器中的通用异步接收发送器(UART)控制器设计的。在嵌入式系统中,UART是一种常见的串行通信接口,用于设备间的通信,如调试输出、传感器连接等。该驱动程序...
OMAP UART控制器驱动程序是专为德州仪器(TI)的OMAP(Optimizing Application Processor)系列处理器设计的串行通信接口。这个驱动程序确保了OMAP处理器与外部设备之间通过UART(通用异步接收发送器)进行有效通信...
标题中的"uart.rar_OMAP uart_OMAP-L138 uart_l138 芯片 id_omap"提到了UART、OMAP以及OMAP-L138芯片ID相关的知识点,这表明我们要讨论的是关于OMAP-L138微控制器上的通用异步收发传输器(UART)的实现和测试。UART...
在本教程"STM32例程Tutorial 38 - Printf UART debugging"中,我们将深入探讨如何利用UART(通用异步收发传输器)进行printf调试,这是一种非常实用的调试技巧,可以帮助开发者实时查看程序运行状态。 UART是一种...
- **外设接口**: 包括UART、I2C、SPI、USB等多种接口 3. **软件环境搭建**:指导用户如何安装必要的开发工具,如编译器、调试器等。 4. **驱动程序开发**:介绍如何编写针对特定硬件设备的驱动程序,以充分利用OMAP...
标题中的"uart.rar_omap5910"表明这是一个与UART(通用异步接收发送器)相关的文件,特别针对OMAP5910处理器。OMAP5910是德州仪器(Texas Instruments)推出的一款高性能的微处理器,常用于嵌入式系统设计,特别是...
标题中的“GD32-UART_pm.wake("testUart")”表明这是一个关于GD32微控制器的UART(通用异步收发传输器)功能,其中涉及到电源管理(PM)的唤醒机制。在GD32F103系列芯片中,UART是一个常用的通信接口,用于设备之间...
UART(通用异步收发传输器)是一种广泛用于嵌入式系统中的串行通信接口,DW_apb_uart是其中一种基于DW(DataWire)架构的APB(Advanced Peripheral Bus)接口实现。本文档主要探讨了DW_apb_uart设计的具体细节,提供...
UART(通用异步接收发送器)是嵌入式系统中常用的一种串行通信接口,用于设备间的低速数据传输。在Xilinx的Vivado工具中,UART核可以帮助设计者在FPGA(现场可编程门阵列)上实现UART功能,从而与外部设备进行通信。...
在本文中,我们将深入探讨基于S32K144微控制器(MCU)的UART(通用异步接收发送器)自收发编程技术。S32K144是NXP公司生产的一款高性能、低功耗的微控制器,广泛应用于工业、汽车和消费类电子产品。UART是MCU中常用...
在标题"uart.rar_ISE 串口_fpga_uart_uart vivado_vivado uart"中,我们可以看到关键词"ISE"、"FPGA"、"UART"、"Vivado",这些都是与UART在FPGA设计中的实现紧密相关的元素。 首先,让我们来了解一下UART的基本原理...
在海思的Hi3531A芯片上进行UART(通用异步收发传输器)扩展是一项关键的任务,尤其对于需要更多串行通信接口的系统设计。UART是一种简单但功能强大的通信协议,常用于设备之间的串行数据传输,如嵌入式系统、微控制...
A40i调试信息打印由uart0改uart3 本文介绍了如何将全志A40i调试信息打印从uart0改为uart3。该修改涉及到Uboot版本Kernel版本A40i2014.07Linux-3.10的相关配置文件的修改。 首先,需要在sys_config.fex文件中修改...
`uart.c`则是实现文件,包含了`uart_Init()`和其他UART相关函数的具体实现,如发送数据的`uart_Transmit()`、接收数据的`uart_Receive()`等。 在`uart.h`中,可能还会定义一些关于UART状态的枚举类型,例如`UART_...
**nrf52840的UART0与UART1双串口配置与应用** 在嵌入式系统设计中,串行通信接口(UART)是一种常用的技术,用于设备间的通信。Nordic Semiconductor的nRF52840是一款强大的蓝牙低功耗(BLE)微控制器,它提供了两...
STM32F103 UART(通用异步收发传输器)是STMicroelectronics公司生产的STM32系列微控制器中的一个重要通信接口。该芯片广泛应用于嵌入式系统中,为设备提供串行通信能力。在本教程中,我们将深入探讨如何在STM32F103...
在本例程中,我们将关注的是UART4和UART5两个串口,它们在某些应用中可能比常用的UART1和UART2更有优势,比如避免引脚冲突或者利用特定的硬件资源。 UART4和UART5的配置与STM32F103中的其他UART有所不同,主要体现...
标题中的“dw-apb-uart”指的是一个基于DesignWare(DW)APB(Advanced Peripheral Bus)接口的UART(Universal Asynchronous Receiver/Transmitter)模块。UART是一种常见的串行通信接口,用于设备之间的数据传输,...
"UART16550技术文档" UART16550技术文档是关于UART16550芯片的详细说明文档,该芯片提供了串行通信能力,允许与 MODEM 或其他外部设备进行通信,使用 RS232 协议。该芯片是为了与行业标准的 National ...
在嵌入式系统设计中,UART(通用异步收发传输器)是一种常见的串行通信接口,用于设备间的数据传输。APB(先进外围总线)则是ARM处理器架构中的一个低带宽外围设备接口,它从AHB(先进高性能总线)分担了对低速外设...