MT2503 USB comport 设定及使用方法

关键字 :MTK2503
目前使用USB 抓取catcher log或者发送AT cmd的需求越来越多,在产品没有工模或者屏幕的情况下,如何来进行相关的设定会变得越来越重要。该博文旨在提供USB相关的设定方法。

[SOLUTION]
1、目前平台支持USB multi com port,即USB 连接到PC后会枚举出两个com
port:application port 和debug port,这两个port跟代码中的对应关系如下:
application port : 4 ,主要用于AT cmd,也可以用于catcher log
debug port : 5 , 只用于catcher log,无法发送at cmd
支持该功能的前期是[porject name].mak中
USB_MULTIPLE_COMPORT_ENABLE = TRUE
如果USB_MULTIPLE_COMPORT_ENABLE 为false,表明此project只支持single com port,即只有
application port(4)。

2、相关概念解释:
UART setting下面有3项设定,分别为:
TST-ps port
PS port
TST-L1 port
(1)TST-ps port和TST-L1 port是设置抓catcher log时使用哪个port.
如果您想用uart1来抓取catcher log,可以将这两项都设置为uart1,baudrate设置为一样,此时PS
port就不能设置为uart1了,否则会提示冲突!
同样,如果您想使用usb来抓取log,这两项也可以设置为USB port或者usb port 2(同样此时ps
port就不能设置相同的port),使用usb port或者usb port 2来抓取log时不需要设置baudrate.
(2)PS port 是设置发at时使用哪个port.
如果您想使用uart1来发送at command,可以设置ps port为uart1,并设置好baudrate,如果设置
baudrate为0表示使用自动波特率;(此时TST-ps 和TST-L1 port就不能设置为UART1了)
如果您想使用usb port或者使用usb port 2来发送at command,则此项可以设置usb port或者usb
port 2.

2、 使用USB 抓catcher log或者发送at cmd有两种设定方法
首先要了解下面这个enum设定:
dcl_uart.h
从上面的enum定义我们可以得到:
如果要设置为uart1,则对应的值是0;
uart2对应1;
uart3对应2;
usb port 对应uart_port_usb,即为4;
usb port 2 对应uart_port_usb2,即为5;
注意:这里的enum值要仔细核对,因为不同平台可能值会有偏差,所以在设置时要仔细。

在代码中直接修改:
nvram_data_item.c
static port_setting_struct const NVRAM_EF_PORT_SETTING_DEFAULT[]= {
{
#if defined (WISDOM_MMI) || defined(NEPTUNE_MMI)
0, /* tst-ps uses uart_port2(value is 1) */
1, /* APP uses uart_port1 (value is 0) */
#elif defined(__DUAL_TALK_MODEM_SUPPORT__)
0, /* tst-ps uses uart_port1 */
4, /* APP uses uart_port_usb */
#elif defined(__USB_MULTIPLE_COMPORT_SUPPORT__) && defined(__L4_INIT_MULTIUSB_COM__)
0, /* TST-PS uses uart_port1 */
4, /* ATCI uses uart_port_usb2*/
#else
0, /* tst-ps uses uart_port1 */
4, /* APP uses uart_port_usb */
#endif
#if defined(EMPTY_MMI)

921600, /* tst default baud rate for project without MMI */
#elif defined (WISDOM_MMI)
/* under construction !*/
#elif defined(__USB_MULTIPLE_COMPORT_SUPPORT__) && defined(__L4_INIT_MULTIUSB_COM__)
921600, /* TST-PS baud uses 921600 */
#else
921600, /* tst default baud rate base = 115200 = 0x0001C200 */
#endif
#if defined (__PS_SERVICE__)
115200, /* ps default baud rate base = 115200 = 0x0001C200 */
#else
57600, /* ps default baud rate base = 57600 = 0x0000E100 */
#endif
KAL_FALSE, /* High SpeedSIM */
0, /* SWDBG */
#if defined(__ONLY_ONE_UART__)
1, /* uart power setting (0x03) */
#else
3,
#endif
99, /* CTI uart port: uart_null (value is 0x63 (99) */
0, /* CTI baud rate: auto*/
#if defined (WISDOM_MMI) || defined(NEPTUNE_MMI)
0,
#elif defined(__DUAL_TALK_MODEM_SUPPORT__)
0,
#elif defined(__USB_MULTIPLE_COMPORT_SUPPORT__) && defined(__L4_INIT_MULTIUSB_COM__)
0, /* TST-L1 baud uses uart_port2 */
#else
0, /* tst-l1 uart port, same as tst-ps*/
#endif
#if defined(EMPTY_MMI)
921600, /* tst default baud rate for project without MMI */
#elif defined (WISDOM_MMI)
/* under construction !*/
#elif defined(__USB_MULTIPLE_COMPORT_SUPPORT__) && defined(__L4_INIT_MULTIUSB_COM__)
921600, /* TST-L1 baud uses 921600 */
#else
921600, /* tst default baud rate base = 115200 = 0x0001C200 */
#endif
0, /* tst output mode*/
#if !defined( __UL1_STANDALONE__ )
0, /* USB logging mode */
#else
#if defined(__MODEM_3G_LOGGING__) && defined(_DSPIRDBG__)
/* under construction !*/
#else
1,
#endif /* defined(__MODEM_3G_LOGGING__) && defined(_DSPIRDBG__) */ #endif /*
__UL1_STANDALONE__ */
99, //TST-DSP
921600, //TST-DSP baudrate
0 // USB CD-ROM config, 0:CD-ROM , 1: COM
},
};
#endif /* !defined(__CUSTOMIZED_PORT_SETTING__) */​
注:如果设置ps port为uart口是,需要设置baudrate,设置的地方就是上面紫红部分。

★博文内容均由个人提供,与平台无关,如有违法或侵权,请与网站管理员联系。

★文明上网,请理性发言。内容一周内被举报5次,发文人进小黑屋喔~

评论