微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > MTK6260M串口2调GPS驱动求助

MTK6260M串口2调GPS驱动求助

时间:10-02 整理:3721RD 点击:
直接用串口接线出来能在电脑上打印出GPS发送的数据,但是通过程序无法收到接收消息,下面是我写的uart2初始化设置函数,每个分支都试过了,都不行(trace打印系统不会调用我的myapp_gps_uart_rx_cb),求大神帮看下:
#define GPS_UART_PORT        uart_port2
#define GPS_UART_OWNERID ((module_type)(MOD_UART1_HISR + GPS_UART_PORT))
static void myapp_gps_uart_init(void)
{
        myapp_trace("myapp_gps_uart_init");
#if 0
        UART_DriverInit(GPS_UART_PORT, 0);
        UART_PDN_Disable(GPS_UART_PORT); //串口休眠控制
        //U_SetBaudRate(GPS_UART_PORT, UART_BAUD_9600, (module_type)(MOD_UART1_HISR + GPS_UART_PORT));
        U_Register_RX_cb( GPS_UART_PORT, (module_type)(MOD_UART1_HISR + GPS_UART_PORT), myapp_gps_uart_rx_cb);
        U_Register_TX_cb( GPS_UART_PORT, (module_type)(MOD_UART1_HISR + GPS_UART_PORT), myapp_gps_uart_tx_cb);
        U_ClrRxBuffer(GPS_UART_PORT, UARTPort[GPS_UART_PORT].ownerid);  /*clear sw RX buffer*/
        U_ClrTxBuffer(GPS_UART_PORT, UARTPort[GPS_UART_PORT].ownerid);  /*clear sw TX buffer*/
        U_Purge(GPS_UART_PORT, RX_BUF, UARTPort[GPS_UART_PORT].ownerid);/*clear sw RX FIFO*/
        U_Purge(GPS_UART_PORT, TX_BUF, UARTPort[GPS_UART_PORT].ownerid);/*clear sw TX FIFO*/
#else
        #if 0
        U_SetOwner(GPS_UART_PORT, (module_type)(MOD_UART1_HISR + GPS_UART_PORT));
        UART_PDN_Disable(GPS_UART_PORT);
       U_SetBaudRate(GPS_UART_PORT, UART_BAUD_9600, (module_type)(MOD_UART1_HISR + GPS_UART_PORT));
        mmi_frm_set_protocol_event_handler(MSG_ID_UART_READY_TO_READ_IND, cl_ready_read_ind, MMI_TRUE);
        U_Register_RX_cb( GPS_UART_PORT, (module_type)(MOD_UART1_HISR + GPS_UART_PORT), myapp_gps_uart_rx_cb);
        U_Register_TX_cb( GPS_UART_PORT, (module_type)(MOD_UART1_HISR + GPS_UART_PORT), myapp_gps_uart_tx_cb);
        UART_TurnOnPower(GPS_UART_PORT, KAL_TRUE);
        if (U_Open(GPS_UART_PORT, (module_type)(MOD_UART1_HISR + GPS_UART_PORT)))
                myapp_trace("uart2 open success");
        else
                myapp_trace("uart2 open fail");
        //U_Open(GPS_UART_PORT, (module_type)(MOD_UART1_HISR + GPS_UART_PORT));
        U_ClrRxBuffer(GPS_UART_PORT, UARTPort[GPS_UART_PORT].ownerid);  /*clear sw RX buffer*/
        U_ClrTxBuffer(GPS_UART_PORT, UARTPort[GPS_UART_PORT].ownerid);  /*clear sw TX buffer*/
        U_Purge(GPS_UART_PORT, RX_BUF, UARTPort[GPS_UART_PORT].ownerid);/*clear sw RX FIFO*/
        U_Purge(GPS_UART_PORT, TX_BUF, UARTPort[GPS_UART_PORT].ownerid);/*clear sw TX FIFO*/
        #else
        UART_TurnOnPower(GPS_UART_PORT, KAL_TRUE);
        if (U_Open(GPS_UART_PORT, GPS_UART_OWNERID))
                myapp_trace("uart2 open success");
        else
                myapp_trace("uart2 open fail");
        myapp_gps_uart_configure(9600, GPS_UART_PORT, GPS_UART_OWNERID);
        U_ClrRxBuffer(GPS_UART_PORT, GPS_UART_OWNERID);
        U_Register_RX_cb( GPS_UART_PORT, GPS_UART_OWNERID, myapp_gps_uart_rx_cb);
        U_Register_TX_cb( GPS_UART_PORT, GPS_UART_OWNERID, myapp_gps_uart_tx_cb);
        mmi_frm_set_protocol_event_handler(MSG_ID_UART_READY_TO_READ_IND, myapp_ready_read_ind, MMI_TRUE);
        #endif
#endif
}

这个要配置的吗?在drv tool里面配置吗

呃,日出日落

我做过类似的项目,11A版本,你留Q我联系你

串口的IO配置对了吗

这个要配置的吗?在drv tool里面配置吗

学习了,谢谢!

嗯,要配置的

亲 你这个搞定了么?什么原因呢? 我现在也遇到同样的问题了

遇到和小编一样的问题,不知道你遇到的问题是什么原因?能否告诉我一下。

MTK芯片,智能手表,多窗口平台怎么调试

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top