MTK6260M串口2调GPS驱动求助
05-08
直接用串口接线出来能在电脑上打印出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
}
#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芯片,智能手表,多窗口平台怎么调试
相关文章:
- 求购mtk6260M完整开发环境一套(05-08)
- MTK6260M的LCD并口屏(05-08)
- MTK 6572省26M方案 得校准GPS 但是看BOM还是有26M晶体呀,为什么?怎么区分呀?谢谢!(05-08)
- 承接MTK6260 串口,usb应用,dtmf,gps ,gprs, 短信等传输协议软件定制开发(05-08)
- 谁有MTK的带GPS导航的方案啊!(05-08)
- 60D平台,根据两个点的GPS经纬度,测算距离的问题(05-08)
射频专业培训教程推荐