求助:有关MTK META工具开发的疑问
时间:10-02
整理:3721RD
点击:
各位大侠,
小弟刚开始接触开发校准程序,近几天在用MTK meta函数开发校准程序时出现找到手机句柄,但始终同步不了手机,也进不了META模式。各位高手,下面是俺的代码,麻烦看一下哪块是否有问题。谢谢啦!
int meta_handle,cycle;
METAAPP_RESULT metaapp_result,connect;
META_Connect_Req META_connect_req;
META_Connect_Report p_report;
META_COMM_BAUDRATE rate;
BOOT_RESULT boot;
BBCHIP_TYPE type;
STATUS_E status;
unsigned int meta_ver_required_by_target;
int bootstop;
char message[20];
unsigned int ms_scan_timeout = 1000;
unsigned short com_port;
int p_scanstop = 1;
unsigned char m_msp_err_code;
metaapp_result = METAAPP_GetAvailableHandle(&meta_handle); // get META handle
metaapp_result = METAAPP_Init(meta_handle);
metaapp_result = METAAPP_NVRAM_Init(meta_handle,"D:\\TestSys\\database\\BPLGUInfoCustom");
//---------------------Connect with target ----------------------------------
META_connect_req.com_port = 3;
META_connect_req.boot_meta_arg.m_bbchip_type = AUTO_DETECT_BBCHIP;
META_connect_req.boot_meta_arg.m_ext_clock = AUTO_DETECT_EXT_CLOCK;
META_connect_req.baudrate[0] = META_BAUD115200;
META_connect_req.baudrate[1] = META_BAUD230400;
META_connect_req.baudrate[2] = META_BAUD460800;
META_connect_req.baudrate[3] = META_BAUD921600;
META_connect_req.baudrate[4] = META_BAUD_END;
META_connect_req.flowctrl = META_SW_FLOWCTRL;
META_connect_req.ms_connect_timeout = 30000;
META_connect_req.boot_meta_arg.m_ms_boot_timeout = 10000;
bootstop = 0;
bootstop = 0;
cycle=0;
do
{
cycle++;
ibwrt (deviceP,"OUT1", strlen("OUT1"));
ibwrt (deviceP,"VSET 4", strlen("VSET 4"));
Delay(1);
connect = METAAPP_DisconnectWithTarget( meta_handle );
connect =METAAPP_ConnectWithTarget(meta_handle, &META_connect_req, &bootstop,&p_report);
status = p_report.boot_meta_ret;
boot = p_report.boot_result;
type =boot.m_bbchip_type;
m_msp_err_code = boot.m_msp_err_code;
meta_ver_required_by_target=p_report.meta_ver_required_by_target;
rate = p_report.final_baudrate;
ibwrt (deviceP,"OUT0", strlen("OUT1"));
Delay(1);
} while(connect&&cycle<3);
connect =METAAPP_BOOT_FAIL
status =INVAILID STATUS_E:1
type=UNKOWN_BBCHIP_TYPE
m_msp_err_code=0;
meta_ver_required_by_target=0;
小弟刚开始接触开发校准程序,近几天在用MTK meta函数开发校准程序时出现找到手机句柄,但始终同步不了手机,也进不了META模式。各位高手,下面是俺的代码,麻烦看一下哪块是否有问题。谢谢啦!
int meta_handle,cycle;
METAAPP_RESULT metaapp_result,connect;
META_Connect_Req META_connect_req;
META_Connect_Report p_report;
META_COMM_BAUDRATE rate;
BOOT_RESULT boot;
BBCHIP_TYPE type;
STATUS_E status;
unsigned int meta_ver_required_by_target;
int bootstop;
char message[20];
unsigned int ms_scan_timeout = 1000;
unsigned short com_port;
int p_scanstop = 1;
unsigned char m_msp_err_code;
metaapp_result = METAAPP_GetAvailableHandle(&meta_handle); // get META handle
metaapp_result = METAAPP_Init(meta_handle);
metaapp_result = METAAPP_NVRAM_Init(meta_handle,"D:\\TestSys\\database\\BPLGUInfoCustom");
//---------------------Connect with target ----------------------------------
META_connect_req.com_port = 3;
META_connect_req.boot_meta_arg.m_bbchip_type = AUTO_DETECT_BBCHIP;
META_connect_req.boot_meta_arg.m_ext_clock = AUTO_DETECT_EXT_CLOCK;
META_connect_req.baudrate[0] = META_BAUD115200;
META_connect_req.baudrate[1] = META_BAUD230400;
META_connect_req.baudrate[2] = META_BAUD460800;
META_connect_req.baudrate[3] = META_BAUD921600;
META_connect_req.baudrate[4] = META_BAUD_END;
META_connect_req.flowctrl = META_SW_FLOWCTRL;
META_connect_req.ms_connect_timeout = 30000;
META_connect_req.boot_meta_arg.m_ms_boot_timeout = 10000;
bootstop = 0;
bootstop = 0;
cycle=0;
do
{
cycle++;
ibwrt (deviceP,"OUT1", strlen("OUT1"));
ibwrt (deviceP,"VSET 4", strlen("VSET 4"));
Delay(1);
connect = METAAPP_DisconnectWithTarget( meta_handle );
connect =METAAPP_ConnectWithTarget(meta_handle, &META_connect_req, &bootstop,&p_report);
status = p_report.boot_meta_ret;
boot = p_report.boot_result;
type =boot.m_bbchip_type;
m_msp_err_code = boot.m_msp_err_code;
meta_ver_required_by_target=p_report.meta_ver_required_by_target;
rate = p_report.final_baudrate;
ibwrt (deviceP,"OUT0", strlen("OUT1"));
Delay(1);
} while(connect&&cycle<3);
connect =METAAPP_BOOT_FAIL
status =INVAILID STATUS_E:1
type=UNKOWN_BBCHIP_TYPE
m_msp_err_code=0;
meta_ver_required_by_target=0;
实际测测进META时的电流时多少?不要以为给电压就OK了。
在你的while里能否加上:如果进入失败,关掉电源重新再来。
而且每次之间要有“足够”的延迟。
点点滴滴点点滴滴点点滴滴点点滴滴地对地导弹地对地导弹地对地导弹点点滴滴
这个偶就不懂了。
前期配置条件貌似不全吧!
小编去其他工具上copy一个连接META程序算了!感觉你现在这个太乱了!
AT命令不太了解,请各位指点下!
你缺少了两行,加上就应该可以了
Brom_DebugOn();
META_DebugOn();
楼上的大牛,那两个API如果调用了,只是让程序具有自动记录log的功能(C盘根目录下),当然也有助于分析问题,但不能解决问题
看到LZ调用了ibwrt这个函数,个人还是不太喜欢操作串口采用跟控制仪器同样的方式,我曾经发现在有些电脑上用viOpen就是打不开串口,另一方面,用NI Spy等工具分析时,仪器的指令跟串口的指令混在一起,看了都头大
你这个问题,我怀疑是跟你的开机时机有关,是开机早了。你在METAAPP_ConnectWithTarget之前有Delay(1),如果你跟断点,则本事很难控制开机时间,如果你是直接运行,你的工具界面可能也没有一个准确的提醒开机的提示
不太懂,学习下
学习下,呵呵