一 概述
DO 即數(shù)字輸出(DO, Digital Output),用于輸出二進(jìn)制信號(hào),可以控制繼電器、燈光、電機(jī)啟停等。數(shù)字輸出同樣只能有兩種狀態(tài):高電平或低電平。
二 相關(guān)技術(shù)描述
遠(yuǎn)程或本地事件觸發(fā)執(zhí)行開、關(guān)、脈沖等操作
輸出狀態(tài)斷電記憶保存?
斷電記憶功能(Power-off Memory Function)是一種電子設(shè)備或系統(tǒng)在斷電后能夠保留其運(yùn)行狀態(tài)或數(shù)據(jù)的功能。這種功能通常用于計(jì)算機(jī)、服務(wù)器、工業(yè)控制設(shè)備等需要長(zhǎng)時(shí)間運(yùn)行和穩(wěn)定性的場(chǎng)合。
當(dāng)設(shè)備或系統(tǒng)斷電時(shí),內(nèi)存中的數(shù)據(jù)會(huì)被保存在臨時(shí)存儲(chǔ)器中,如RAM(隨機(jī)存取存儲(chǔ)器)。當(dāng)電源恢復(fù)后,設(shè)備或系統(tǒng)將恢復(fù)到斷電前的狀態(tài),繼續(xù)執(zhí)行未完成的操作或顯示斷電前的數(shù)據(jù)。這樣,用戶可以在斷電期間不受干擾地工作或處理數(shù)據(jù),而無需擔(dān)心數(shù)據(jù)丟失或設(shè)備損壞。
集電極開路輸出?
集電極開路輸出的結(jié)構(gòu)如圖1所示,右邊的那個(gè)三極管集電極什么都不接,所以叫做集電極開路;左邊的三極管為反相之用,使輸入為“0”時(shí),輸出也為“0”。對(duì)于圖 1,當(dāng)左端的輸入為“0”時(shí),前面的三極管截止,所以5v電源通過1k電阻加到右邊的三極管上,右邊的三極管導(dǎo)通;當(dāng)左端的輸入為“1”時(shí),前面的三極管導(dǎo)通,而后面的三極管截止。
我們將圖1簡(jiǎn)化成圖2的樣子,很明顯可以看出,當(dāng)開關(guān)閉合時(shí),輸出直接接地,所以輸出電平為0。而當(dāng)開關(guān)斷開時(shí),則輸出端懸空了,即高阻態(tài)。這時(shí)電平狀態(tài)未知,如果后面一個(gè)電阻負(fù)載到地,那么輸出端的電平就被這個(gè)負(fù)載拉到低電平了,所以這個(gè)電路是不能輸出高電平的。
圖3中那個(gè)1k的電阻即是上拉電阻。如果開關(guān)閉合,則有電流從1k電阻及開關(guān)上流過,但由于開關(guān)閉和時(shí)電阻為0(方便我們的討論,實(shí)際情況中開關(guān)電阻不為0,另外對(duì)于三極管還存在飽和壓降),所以在開關(guān)上的電壓為0,即輸出電平為0。如果開關(guān)斷開,則由于開關(guān)電阻為無窮大(同上,不考慮實(shí)際中的漏電流),所以流過的電流為0,因此在1k電阻上的壓降也為0,所以輸出端的電壓就是5v了,這樣就能輸出高電平了。
但是這個(gè)輸出的內(nèi)阻是比較大的 —— 即1k,如果接一個(gè)電阻為r的負(fù)載,通過分壓計(jì)算,就可以算得最后的輸出電壓為5*r/(r+1000)伏,所以,如果要達(dá)到一定的電壓的話,r就不能太小。如果r真的太小,而導(dǎo)致輸出電壓不夠的話,那我們只有通過減小那個(gè)1k的上拉電阻來增加驅(qū)動(dòng)能力。
但是,上拉電阻又不能取得太小,因?yàn)楫?dāng)開關(guān)閉合時(shí),將產(chǎn)生電流,由于開關(guān)能流過的電流是有限的,因此限制了上拉電阻的取值。另外還需要考慮到,當(dāng)輸出低電平時(shí),負(fù)載可能還會(huì)給提供一部分電流從開關(guān)流過,因此要綜合這些電流考慮來選擇合適的上拉電阻。
如果我們將一個(gè)讀數(shù)據(jù)用的輸入端接在輸出端,這樣就是一個(gè)IO口了,51的IO口就是這樣的結(jié)構(gòu),其中P0口內(nèi)部不帶上拉,而其它三個(gè)口帶內(nèi)部上拉。當(dāng)我們要使用輸入功能時(shí),只要將輸出口設(shè)置為1即可,這樣就相當(dāng)于那個(gè)開關(guān)斷開,而對(duì)于P0口來說,就是高阻態(tài)了。
輸出驅(qū)動(dòng)電壓=設(shè)備供電壓?
輸出驅(qū)動(dòng)電流≤500mA
三 應(yīng)用場(chǎng)景
3.1 水泵
云端通過控制DO輸出高低電平,來控制外圍電路,進(jìn)而控制水泵的啟停。
3.2 風(fēng)扇
同理,云端通過控制DO輸出高低電平,來控制外圍電路,進(jìn)而控制風(fēng)扇的啟停。
3.3 報(bào)警燈
結(jié)合DTU的DI功能,如果檢測(cè)到了DI異常信號(hào)輸入,DTU可以控制連接DO的報(bào)警燈報(bào)警。
四 DO組件的使用
1 Gitee鏈接地址
組件位于amaziot_bloom_os_sdklibrariesamxtuam_do.c
Gitee源碼地址:https://gitee.com/ning./hongdou
Github源碼地址:https://github.com/ayumid/hongdou
2 應(yīng)用層組件功能介紹
提供DO實(shí)現(xiàn)實(shí)例。
使用該組件,必須同時(shí)使用AT組件,文件組件,TCP組件,掉線組件,掉線重連組件,DI組件,DO組件,AI組件,JSON組件,CLK組件。
3 代碼講解
1 dtu_do1_report_timer_callback
DO1周期上報(bào)定時(shí)器回調(diào)函數(shù)。定時(shí)器超時(shí)后進(jìn)入本函數(shù),如果在透?jìng)髂J剑渲孟⒔Y(jié)構(gòu)體變量,發(fā)送消息給JSON主任務(wù),主任務(wù)將協(xié)議內(nèi)容發(fā)送到服務(wù)器
/** * Function : dtu_do1_report_timer_callback * Description : 主動(dòng)上報(bào)定時(shí)器超時(shí)回調(diào)函數(shù),發(fā)送消息給主任務(wù),由主任務(wù)上報(bào)信息到服務(wù)器 * Input : * * Output : * Return : * Auther : zhaoning * Others : **/ static void dtu_do1_report_timer_callback(UINT32 tmrId) { DTU_JSON_MSG_T do_send_msg = {0}; DTU_UART_PARAM_T* dtu_uart_ctx = NULL; dtu_uart_ctx = dtu_get_uart_ctx(); // printf("dtu_do1_report_timer_callbackn"); //判斷是否是在透?jìng)髂J? if(dtu_uart_ctx->uart_mode == DTU_DATA_MODE) { do_send_msg.msgId = DTU_DO_MSG_ID_DO_PROACTIVE_REPORT; do_send_msg.channel = DTU_GPIO_CHNNEL_1; do_send_msg.status = GpioGetLevel(DTU_GPIO_DO_PIN1); // printf("%s[%d] %d", __FUNCTION__, __LINE__, do_send_msg.status); //發(fā)送消息給json主任務(wù) dtu_json_task_send_msgq(&do_send_msg); } }
2 dtu_do1_report_timer_start
主動(dòng)上報(bào)定時(shí)器啟動(dòng),周期性打開定時(shí)器
/** * Function : dtu_do1_report_timer_start * Description : 主動(dòng)上報(bào)定時(shí)器啟動(dòng) * Input : * * Output : * Return : * Auther : zhaoning * Others : **/ void dtu_do1_report_timer_start(UINT32 time) { UINT32 uc_time = 0; uc_time = time; // printf("start type timer %dn", uc_time); //開啟定時(shí)器 OSATimerStart(dtu_do1_report_timer_ref, uc_time * 200, uc_time * 200, dtu_do1_report_timer_callback, 0); }
3 dtu_do1_report_timer_stop
主動(dòng)上報(bào)定時(shí)器停止
/** * Function : dtu_do1_report_timer_stop * Description : 主動(dòng)上報(bào)定時(shí)器停止 * Input : * * Output : * Return : * Auther : zhaoning * Others : **/ void dtu_do1_report_timer_stop(void) { //關(guān)閉定時(shí)器 OSATimerStop(dtu_do1_report_timer_ref); }
4 dtu_do_init_do
根據(jù)NV項(xiàng),判斷是否需要開啟do上報(bào)
/** * Function : dtu_do_init_do * Description : 根據(jù)NV項(xiàng),判斷是否需要開啟do上報(bào) * Input : * * Output : * Return : * Auther : zhaoning * Others : **/ void dtu_do_init_do(char* channel, DTU_DO* doo) { if(strcmp((const char*)channel, "DO1") == 0) { //如果主動(dòng)上報(bào) if(DTU_DO_REPORT_INITIATIVE == doo->do_type) { //啟動(dòng)主動(dòng)上報(bào)定時(shí)器 dtu_do1_report_timer_start(doo->do_interval); } else if(DTU_DO_REPORT_NONE == doo->do_type) { //關(guān)閉主動(dòng)上報(bào)定時(shí)器 OSATimerStop(dtu_do1_report_timer_ref); } } else if(strcmp((const char*)channel, "DO2") == 0) { //如果主動(dòng)上報(bào) if(DTU_DO_REPORT_INITIATIVE == doo->do_type) { //啟動(dòng)主動(dòng)上報(bào)定時(shí)器 dtu_do2_report_timer_start(doo->do_interval); } else if(DTU_DO_REPORT_NONE == doo->do_type) { //關(guān)閉主動(dòng)上報(bào)定時(shí)器 OSATimerStop(dtu_do2_report_timer_ref); } } else if(strcmp((const char*)channel, "DO3") == 0) { //如果主動(dòng)上報(bào) if(DTU_DO_REPORT_INITIATIVE == doo->do_type) { //啟動(dòng)主動(dòng)上報(bào)定時(shí)器 dtu_do3_report_timer_start(doo->do_interval); } else if(DTU_DO_REPORT_NONE == doo->do_type) { //關(guān)閉主動(dòng)上報(bào)定時(shí)器 OSATimerStop(dtu_do3_report_timer_ref); } } else if(strcmp((const char*)channel, "DO4") == 0) { //如果主動(dòng)上報(bào) if(DTU_DO_REPORT_INITIATIVE == doo->do_type) { //啟動(dòng)主動(dòng)上報(bào)定時(shí)器 dtu_do4_report_timer_start(doo->do_interval); } else if(DTU_DO_REPORT_NONE == doo->do_type) { //關(guān)閉主動(dòng)上報(bào)定時(shí)器 OSATimerStop(dtu_do4_report_timer_ref); } } else if(strcmp((const char*)channel, "DO5") == 0) { //如果主動(dòng)上報(bào) if(DTU_DO_REPORT_INITIATIVE == doo->do_type) { //啟動(dòng)主動(dòng)上報(bào)定時(shí)器 dtu_do5_report_timer_start(doo->do_interval); } else if(DTU_DO_REPORT_NONE == doo->do_type) { //關(guān)閉主動(dòng)上報(bào)定時(shí)器 OSATimerStop(dtu_do5_report_timer_ref); } } // if(0 == doo->do_time) // { // if(strcmp((const char*)channel, "DO1") == 0) // { // //關(guān)閉輸出保持定時(shí)器 // OSATimerStop(dtu_do1_timer_ref); // } // if(strcmp((const char*)channel, "DO2") == 0) // { // //關(guān)閉輸出保持定時(shí)器 // OSATimerStop(dtu_do2_timer_ref); // } // if(strcmp((const char*)channel, "DO3") == 0) // { // //關(guān)閉輸出保持定時(shí)器 // OSATimerStop(dtu_do3_timer_ref); // } // if(strcmp((const char*)channel, "DO4") == 0) // { // //關(guān)閉輸出保持定時(shí)器 // OSATimerStop(dtu_do4_timer_ref); // } // if(strcmp((const char*)channel, "DO5") == 0) // { // //關(guān)閉輸出保持定時(shí)器 // OSATimerStop(dtu_do5_timer_ref); // } // } // //如果輸出保持時(shí)間不為0,而且當(dāng)前是輸出高電平 // else if(DTU_GPIO_HIGH == GpioGetLevel(DTU_GPIO_DO_PIN1) && 0 != doo->do_time) // { // if(strcmp((const char*)channel, "DO1") == 0) // { // //啟動(dòng)輸出保持定時(shí)器 // dtu_do1_timer_start(DTU_DO_TIME, doo->do_time); // } // if(strcmp((const char*)channel, "DO2") == 0) // { // //啟動(dòng)輸出保持定時(shí)器 // dtu_do1_timer_start(DTU_DO_TIME, doo->do_time); // } // if(strcmp((const char*)channel, "DO3") == 0) // { // //啟動(dòng)輸出保持定時(shí)器 // dtu_do1_timer_start(DTU_DO_TIME, doo->do_time); // } // if(strcmp((const char*)channel, "DO4") == 0) // { // //啟動(dòng)輸出保持定時(shí)器 // dtu_do1_timer_start(DTU_DO_TIME, doo->do_time); // } // if(strcmp((const char*)channel, "DO5") == 0) // { // //啟動(dòng)輸出保持定時(shí)器 // dtu_do1_timer_start(DTU_DO_TIME, doo->do_time); // } // } // //如果輸出保持時(shí)間沒有配置,配置定時(shí)翻轉(zhuǎn) // if(0 == doo->do_time && 0 != doo->do_flip) // { // if(strcmp((const char*)channel, "DO1") == 0) // { // //啟動(dòng)定時(shí)翻轉(zhuǎn)定時(shí)器 // dtu_do1_timer_start(DTU_DO_FLIP, doo->do_flip); // } // if(strcmp((const char*)channel, "DO2") == 0) // { // //啟動(dòng)定時(shí)翻轉(zhuǎn)定時(shí)器 // dtu_do1_timer_start(DTU_DO_FLIP, doo->do_flip); // } // if(strcmp((const char*)channel, "DO3") == 0) // { // //啟動(dòng)定時(shí)翻轉(zhuǎn)定時(shí)器 // dtu_do1_timer_start(DTU_DO_FLIP, doo->do_flip); // } // if(strcmp((const char*)channel, "DO4") == 0) // { // //啟動(dòng)定時(shí)翻轉(zhuǎn)定時(shí)器 // dtu_do1_timer_start(DTU_DO_FLIP, doo->do_flip); // } // if(strcmp((const char*)channel, "DO5") == 0) // { // //啟動(dòng)定時(shí)翻轉(zhuǎn)定時(shí)器 // dtu_do1_timer_start(DTU_DO_FLIP, doo->do_flip); // } // } }
5 dtu_do_init
DO初始化,根據(jù)NV項(xiàng)初始化DO輸出電平,初始化上報(bào)狀態(tài)
/** * Function : dtu_do_init * Description : 上電初始化所有的do * Input : * * Output : * Return : * Auther : zhaoning * Others : **/ void dtu_do_init(void) { int ret = 0; DTU_FILE_PARAM_T* dtu_file_ctx = NULL; dtu_file_ctx = dtu_get_file_ctx(); //init out gpio ret = GpioSetDirection(DTU_GPIO_DO_PIN1, GPIO_OUT_PIN); ASSERT(ret == GPIORC_OK); ret = GpioSetDirection(DTU_GPIO_DO_PIN2, GPIO_OUT_PIN); ASSERT(ret == GPIORC_OK); ret = GpioSetDirection(DTU_GPIO_DO_PIN3, GPIO_OUT_PIN); ASSERT(ret == GPIORC_OK); ret = GpioSetDirection(DTU_GPIO_DO_PIN4, GPIO_OUT_PIN); ASSERT(ret == GPIORC_OK); ret = GpioSetDirection(DTU_GPIO_DO_PIN5, GPIO_OUT_PIN); ASSERT(ret == GPIORC_OK); //初始化就停止定時(shí)器 OSATimerStop(dtu_do1_report_timer_ref); // OSATimerStop(dtu_do1_timer_ref); OSATimerStop(dtu_do2_report_timer_ref); // OSATimerStop(dtu_do2_timer_ref); OSATimerStop(dtu_do3_report_timer_ref); // OSATimerStop(dtu_do3_timer_ref); OSATimerStop(dtu_do4_report_timer_ref); // OSATimerStop(dtu_do4_timer_ref); OSATimerStop(dtu_do5_report_timer_ref); // OSATimerStop(dtu_do5_timer_ref); //初始化DO狀態(tài) if(dtu_file_ctx->doo.do1.do_status == DTU_DO_OUT_STATUS_LAST) { // printf("%s init set restore:%dn", channel, doo->do_out); GpioSetLevel(DTU_GPIO_DO_PIN1, dtu_file_ctx->doo.do1.do_out); } else if(dtu_file_ctx->doo.do1.do_status == DTU_DO_OUT_STATUS_HIGH) { // printf("%s init set highn", channel); GpioSetLevel(DTU_GPIO_DO_PIN1, 1); } else { // printf("%s init set lown", channel); GpioSetLevel(DTU_GPIO_DO_PIN1, 0); } if(dtu_file_ctx->doo.do2.do_status == DTU_DO_OUT_STATUS_LAST) { // printf("%s init set restore:%dn", channel, doo->do_out); GpioSetLevel(DTU_GPIO_DO_PIN2, dtu_file_ctx->doo.do2.do_out); } else if(dtu_file_ctx->doo.do2.do_status == DTU_DO_OUT_STATUS_HIGH) { // printf("%s init set highn", channel); GpioSetLevel(DTU_GPIO_DO_PIN2, 1); } else { // printf("%s init set lown", channel); GpioSetLevel(DTU_GPIO_DO_PIN2, 0); } if(dtu_file_ctx->doo.do3.do_status == DTU_DO_OUT_STATUS_LAST) { // printf("%s init set restore:%dn", channel, doo->do_out); GpioSetLevel(DTU_GPIO_DO_PIN3, dtu_file_ctx->doo.do3.do_out); } else if(dtu_file_ctx->doo.do3.do_status == DTU_DO_OUT_STATUS_HIGH) { // printf("%s init set highn", channel); GpioSetLevel(DTU_GPIO_DO_PIN3, 1); } else { // printf("%s init set lown", channel); GpioSetLevel(DTU_GPIO_DO_PIN3, 0); } if(dtu_file_ctx->doo.do4.do_status == DTU_DO_OUT_STATUS_LAST) { // printf("%s init set restore:%dn", channel, doo->do_out); GpioSetLevel(DTU_GPIO_DO_PIN4, dtu_file_ctx->doo.do4.do_out); } else if(dtu_file_ctx->doo.do4.do_status == DTU_DO_OUT_STATUS_HIGH) { // printf("%s init set highn", channel); GpioSetLevel(DTU_GPIO_DO_PIN4, 1); } else { // printf("%s init set lown", channel); GpioSetLevel(DTU_GPIO_DO_PIN4, 0); } if(dtu_file_ctx->doo.do5.do_status == DTU_DO_OUT_STATUS_LAST) { // printf("%s init set restore:%dn", channel, doo->do_out); GpioSetLevel(DTU_GPIO_DO_PIN5, dtu_file_ctx->doo.do5.do_out); } else if(dtu_file_ctx->doo.do5.do_status == DTU_DO_OUT_STATUS_HIGH) { // printf("%s init set highn", channel); GpioSetLevel(DTU_GPIO_DO_PIN5, 1); } else { // printf("%s init set lown", channel); GpioSetLevel(DTU_GPIO_DO_PIN5, 0); } //初始化do上報(bào)狀態(tài) dtu_do_init_do("DO1", &dtu_file_ctx->doo.do1); dtu_do_init_do("DO2", &dtu_file_ctx->doo.do2); dtu_do_init_do("DO3", &dtu_file_ctx->doo.do3); dtu_do_init_do("DO4", &dtu_file_ctx->doo.do4); dtu_do_init_do("DO5", &dtu_file_ctx->doo.do5); }
6 dtu_do_read_pin
讀DO電平狀態(tài),并返回狀態(tài)值
/** * Function : dtu_do_read_pin * Description : 讀DO電平 * Input : * * Output : * Return : * Auther : zhaoning * Others : **/ UINT8 dtu_do_read_pin(UINT8 channel) { return GpioGetLevel(channel); }
7 dtu_do_write_pin
寫DO電平狀態(tài)
/** * Function : dtu_do_write_pin_1 * Description : 寫do1 * Input : status 電平,1設(shè)置高電平,0設(shè)置低電平 * * Output : * Return : * Auther : zhaoning * Others : **/ void dtu_do_write_pin(char* channel, UINT8 status) { DTU_FILE_PARAM_T* dtu_file_ctx = NULL; dtu_file_ctx = dtu_get_file_ctx(); if(strcmp((const char*)channel, "DO1") == 0) { GpioSetLevel(DTU_GPIO_DO_PIN1, status); dtu_file_ctx->doo.do1.do_out = status; //如果輸出保持時(shí)間不為0,而且當(dāng)前是輸出高電平 // if(DTU_GPIO_HIGH == status && 0 != dtu_file_ctx->doo.do1.do_time) // { // //啟動(dòng)輸出保持定時(shí)器 // dtu_do1_timer_start(DTU_DO_TIME, dtu_file_ctx->doo.do1.do_time); // } } if(strcmp((const char*)channel, "DO2") == 0) { GpioSetLevel(DTU_GPIO_DO_PIN2, status); dtu_file_ctx->doo.do2.do_out = status; //如果輸出保持時(shí)間不為0,而且當(dāng)前是輸出高電平 // if(DTU_GPIO_HIGH == status && 0 != dtu_file_ctx->doo.do2.do_time) // { // //啟動(dòng)輸出保持定時(shí)器 // dtu_do2_timer_start(DTU_DO_TIME, dtu_file_ctx->doo.do2.do_time); // } } if(strcmp((const char*)channel, "DO3") == 0) { GpioSetLevel(DTU_GPIO_DO_PIN3, status); dtu_file_ctx->doo.do3.do_out = status; //如果輸出保持時(shí)間不為0,而且當(dāng)前是輸出高電平 // if(DTU_GPIO_HIGH == status && 0 != dtu_file_ctx->doo.do3.do_time) // { // //啟動(dòng)輸出保持定時(shí)器 // dtu_do3_timer_start(DTU_DO_TIME, dtu_file_ctx->doo.do3.do_time); // } } if(strcmp((const char*)channel, "DO4") == 0) { GpioSetLevel(DTU_GPIO_DO_PIN4, status); dtu_file_ctx->doo.do4.do_out = status; //如果輸出保持時(shí)間不為0,而且當(dāng)前是輸出高電平 // if(DTU_GPIO_HIGH == status && 0 != dtu_file_ctx->doo.do4.do_time) // { // //啟動(dòng)輸出保持定時(shí)器 // dtu_do4_timer_start(DTU_DO_TIME, dtu_file_ctx->doo.do4.do_time); // } } if(strcmp((const char*)channel, "DO5") == 0) { GpioSetLevel(DTU_GPIO_DO_PIN5, status); dtu_file_ctx->doo.do5.do_out = status; //如果輸出保持時(shí)間不為0,而且當(dāng)前是輸出高電平 // if(DTU_GPIO_HIGH == status && 0 != dtu_file_ctx->doo.do5.do_time) // { // //啟動(dòng)輸出保持定時(shí)器 // dtu_do5_timer_start(DTU_DO_TIME, dtu_file_ctx->doo.do5.do_time); // } } }
8 dtu_do_clk_timeout_write_pin
鬧鐘超時(shí)后,寫對(duì)應(yīng)鬧鐘配置的DO電平
/** * Function : dtu_do_clk_timeout_write_pin * Description : 鬧鐘超時(shí)后,寫對(duì)應(yīng)鬧鐘配置的DO電平 * Input : * * Output : * Return : * Auther : zhaoning * Others : **/ void dtu_do_clk_timeout_write_pin(UINT8 channel, UINT8 status) { printf("%s[%d]timeout index:%d status:%d", __FUNCTION__, __LINE__, channel, status); if(DTU_GPIO_CHNNEL_1 == channel) { GpioSetLevel(DTU_GPIO_DO_PIN1, status); printf("%s[%d]timeout do1 set", __FUNCTION__, __LINE__); } else if(DTU_GPIO_CHNNEL_2 == channel) { GpioSetLevel(DTU_GPIO_DO_PIN2, status); printf("%s[%d]timeout do2 set", __FUNCTION__, __LINE__); } else if(DTU_GPIO_CHNNEL_3 == channel) { GpioSetLevel(DTU_GPIO_DO_PIN3, status); printf("%s[%d]timeout do3 set", __FUNCTION__, __LINE__); } else if(DTU_GPIO_CHNNEL_4 == channel) { GpioSetLevel(DTU_GPIO_DO_PIN4, status); printf("%s[%d]timeout do4 set", __FUNCTION__, __LINE__); } else if(DTU_GPIO_CHNNEL_5 == channel) { GpioSetLevel(DTU_GPIO_DO_PIN5, status); printf("%s[%d]timeout do5 set", __FUNCTION__, __LINE__); } }
9 dtu_do_times_init
DO上報(bào)定時(shí)器句柄初始化
/** * Function : dtu_do_times_init * Description : 初始化所有定時(shí)器句柄 * Input : * * Output : * Return : * Auther : zhaoning * Others : **/ void dtu_do_times_init(void) { int ret = 0; ret = OSATimerCreate(&dtu_do1_report_timer_ref); ASSERT(ret == OS_SUCCESS); // ret = OSATimerCreate(&dtu_do1_timer_ref); // ASSERT(ret == OS_SUCCESS); ret = OSATimerCreate(&dtu_do2_report_timer_ref); ASSERT(ret == OS_SUCCESS); // ret = OSATimerCreate(&dtu_do2_timer_ref); // ASSERT(ret == OS_SUCCESS); ret = OSATimerCreate(&dtu_do3_report_timer_ref); ASSERT(ret == OS_SUCCESS); // ret = OSATimerCreate(&dtu_do3_timer_ref); // ASSERT(ret == OS_SUCCESS); ret = OSATimerCreate(&dtu_do4_report_timer_ref); ASSERT(ret == OS_SUCCESS); // ret = OSATimerCreate(&dtu_do4_timer_ref); // ASSERT(ret == OS_SUCCESS); ret = OSATimerCreate(&dtu_do5_report_timer_ref); ASSERT(ret == OS_SUCCESS); // ret = OSATimerCreate(&dtu_do5_timer_ref); // ASSERT(ret == OS_SUCCESS); }
4 Demo實(shí)戰(zhàn)
4.1 創(chuàng)建一個(gè)Demo
復(fù)制20.9_di_xtu示例工程,到同一個(gè)文件夾下,修改文件名為20.10_do_xtu,如圖:
4.2 修改makefile
增加文件組件所在目錄頭文件路徑,和源文件路徑,以及一些宏定義,如圖:
-D是makefile中定義宏定義必要的前綴,可以搜索相關(guān)makefile學(xué)習(xí)文章學(xué)習(xí)相關(guān)知識(shí)。
DTU_BASED_ON_TCP 表示當(dāng)前是TCP模式,當(dāng)前組件使用需要am.h中包含一些對(duì)應(yīng)。
DTU_TYPE_5X6 表示使用SOM板貼片5x6卡,可以使用其它卡,修改為對(duì)應(yīng)宏定義就可以。
DTU_UART_115200_BAUD 表示使用115200波特率
DTU_TYPE_JSON_INCLUDE 表示把JSON功能包含進(jìn)來
4.3 增加頭文件
使用代碼編輯器,將新建的工程文件加入代碼編輯器中,打開main.c,修改main.c,加入am.h頭文件,如圖:
4.4 修改代碼
示例使用的是板載5x6卡,用戶的硬件可能是使用外置卡,或者是三合一全網(wǎng)通卡,因?yàn)橛布先N卡使用的模組SIM卡接口不一樣(外置卡SIM1,5x6卡和三合一卡SIM2),所以,需要通過一個(gè)全局變量來制定SIM卡硬件接口。
extern外部變量SDK_INIT_SIM_SELECT_VALUE,這里判斷了是否使用外置卡,這個(gè)宏定義在Makefile里面定義。
在Phase1Inits_enter中,宏定義判斷是否要包含對(duì)SDK_INIT_SIM_SELECT_VALUE變量的修改。
在Phase2Inits_exit 調(diào)用文件組件提供的對(duì)外API,如圖:
4.5 編譯
在SDK根目錄打開命令行,輸入命令.build.bat -l .amaziot_bloom_os_sdksamplelibraries20.10_do_xtu
PS F:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08 λ .build.bat -l .amaziot_bloom_os_sdksamplelibraries20.10_do_xtu 子目錄或文件 outbin 已經(jīng)存在。 子目錄或文件 buildcJSON 已經(jīng)存在。 子目錄或文件 buildobj 已經(jīng)存在。 gnumake: Entering directory `F:/3.asr-b/cat.1-asr1606/1.software/BLOOM_OS_1606_OPENCPU_1191_A08/amaziot_bloom_os_sdk/sample/libraries/20.10_do_xtu' armcc.exe -c --cpu Cortex-R4 --no_unaligned_access -g -O2 --apcs /inter --diag_suppress 2084,1,2,177,188,223,550,1296,2795,6319,9931,9933 --diag_error=warning --gnu --thumb --loose_implicit_cast -DDATA_COLLECTOR_IMPL -DISPT_OVER_SSP -DDIAG_SSP_DOUBLE_BUFFER_USE_DYNAMIC_ALLOCATION -DENV_XSCALE -DL1_DCXO_ENABLED -DLTE_HIGH_MOBILITY_OPTIMIZATION -DRUN_XIP_MODE -DCRANE_Z2 -DCA_LONG_IPC_MSG -DNEZHA3 -DNEZHA3_1826 -DUPGRADE_PLMS -DUPGRADE_PLMS_SR -DLTE_GSMMULTIBCCH -DGPLC_LTE_RSSI_SCAN -DL1V_NEW_RSSI -DUPGRADE_PLMS_3G -DUPGRADE_PLMS_L1 -DUPGRADE_FG_PLMS -DFG_PLMS_URR -DUPGRADE_L1A_FG_PLMS -DUPGRADE_PLMS_STAGE_2 -DUPGRADE_MBCCH -DMULTI_BCCH_READY_IND -DURR_MRAT_ICS_SEARCH -DUPGRADE_ICS -DMRAT_NAS -DUPGRADE_PLMS_SEARCH_API -DICS_MBCCH -DICS_MBCCH_2G_RSSI -DDIAG_NEWPP -DPHS_SW_DEMO -DPHS_SW_DEMO_TTC -DPHS_SW_DEMO_TTC_PM -DFULL_SYSTEM -D_DDR_INIT_ -D_TAVOR_HARBELL_ -DUPGRADE_ARBEL_PLATFORM -D_TAVOR_B0_SILICON_ -DTDL1C_SPY_ENABLE -DDLM_TAVOR -DTAVOR -DFLAVOR_DUALCORE -DDEBUG_D2_MOR_REG_RESEREVED_ENABLE -D_DIAG_USE_COMMSTACK_ -D_TAVOR_DIAG_ -DPM_DEBUG_MODE_ENABLED -DPM_D2FULL_MODE -DPM_EXT_DBG_INT_ARR -DFEATURE_WB_AMR_PS -DMACRO_FOR_LWG -DHL_LWG -DOPTIMIZE_FOR_2G_BCCH -DPLAT_TEST -D_FDI_USE_OSA_ -DPLAT_USE_THREADX -DLWIP_IPNETBUF_SUPPORT -DCRANE_MCU_DONGLE -DAT_OVER_UART -DPHS_SW_DEMO_TTC_PM -DUPGRADE_LTE_ONLY -DEXT_AT_MODEM_SUPPORT -DLTEONLY_THIN_SINGLE_SIM -DLFS_FILE_SYS -DLFS_FILE_SYS_V2 -DPSM_ENABLE -DNO_PAHO_MQTT -DNO_XML -DNO_LWM2M -DREMOVE_MBEDTLS -DNO_AT_NET -DCRANE_SD_NOT_SUPPORT -DNTP -DYMODEM_EEH_DUMP -DENABLE_DM_LTEONLY -DLTEONLY_THIN -DNO_EXTEND_MY_Q_AT -DNOT_SUPPORT_HTTPS -DNOT_SUPPORT_PM813 -DCRANEL_4MRAM -DREMOVE_PB -DUART_NEW_VERSION -DREMOVE_MEP -DREMOVE_SMS -DREMOVE_ENVSIM -DAPN_INCODE -DLTEONLY_THIN_SINGLE_SIM_2MFLASH -DASR160X_OPENCPU_FEATURE -DENABLE_UART3_FEATRUE -DENABLE_UART4_FEATRUE -DYUGE_MBEDTLS_3_2_1 -DENABLE_MAC_TX_DATA_LOGGING -DDISABLE_NVRAM_ACCESS -DINTEL_UPGRADE_EE_HANDLER_SUPPORT -DLTE_W_PS -DL1_DUAL_MODE -DUPGRADE_HERMON_DUAL -DINTEL_UPGRADE_DUAL_RAT -DINTEL_UPGRADE_GPRS_CIPHER_FLUSH -DUPGRADE_ENHANCED_QUAD_BAND -DINTEL_2CHIP_PLAT -DI_2CHIP_PLAT -DUPGRDE_TAVOR_COMMUNICATION -DRUN_WIRELESS_MODEM -DFLAVOR_DDR12MB_GB1MB5 -DFEATURE_SHMEM -DACIPC_ENABLE_NEW_CALLBACK_MECHANISM -DRELIABLE_DATA -DMAP_NSS -DTV_FNAME=""SW_PLATFORM=PMD2NONE PHS_SW_DEMO PHS_SW_DEMO_PM SRCNUCLEUS FULL_SYSTEM NOACRTC PDFLT PLAT_TEST PV2 DIAGOSHMEM NVM WITHL1V"" -DTV_FDESC=""SW_DESCRIPTION="" -DENABLE_ACIPC -D_DATAOMSL_ENABLED_ -DUSB_CABLE_DETECTION_VIA_PMIC -DMIPS_TEST -DMIPS_TEST_RAM -DFLAVOR_DIET_RAM -DNVM_INCLUDE -DMSL_INCLUDE -DMSL_POOL_MEM -DNO_AUDIO -DOSA_QUEUE_NAMES -D_DIAG_DISABLE_USB_ -DOSA_NUCLEUS -DOSA_USED -DPM_D2NONE_MODE -DCRANE_SOC_TEMPERATURE_SENSOR -DL1_SW_UPDATE_FOR_DIGRF -DPHS_L1_SW_UPDATE_R7 -DUPGRADE_LTE -DFRBD_CALIB_NVM -DFRBD_AGC_CALIB -DFRBD_FDT_CALIB -DHSPA_MPR -DCAPT_PARAMS_OPTIMIZE -DL1_WB_R99_ONLY -DL1V_WB_R99_ONLY -DINTERGRATED_RF_SUPPORT -DL1_RX_DIV_SUPPORT -DENABLE_OOS_HANDLING -DTAVOR_D2_WB_L1_SUPPORT -DL1_DDR_HIGH_FREQ -DUPGRADE_DIGRF3G_SUPPORT -DW_PS_PLUS_G_PAGING -D"NO_APLP=0" -DINTEL_UPGRADE_UNIFIED_VOICE_TASK -DINTEL_UPGRADE_R99 -DAPLP_SPY_ENABLE -D__TARGET_FEATURE_DOUBLEWORD -DWHOLE_UMTS_STACK -DUSE_TTPCOM_CSR_BLUETOOTH_AUDIO_GAIN_CONTROL -DL1_UPGRADE_R5 -DUPGRADE_EDGE -DUPGRADE_R4_FS1 -DINTEL_UPGRADE_GSM_CRL_IF -DUPGRADE_EGPRS_M -DINTEL_UPGRADE_EGPRS_M -DINTEL_UPGRADE_RF_PARAMS_IN_CF_TDS -DINTEL_UPGRADE_2SAMPLES_PER_SYMBOL -D"GPRS_MULTISLOT_CLASS=12" -D"EGPRS_MULTISLOT_CLASS=12" -DMARVELL_UPGRADE_BSIC_REDESIGN -DMSL_INCLUDE -DINTEL_HERMON_SAC -DCRANE_CUST_BUILD -DL1_SW_UPDATE_FOR_DIGRF -DFLAVOR_COM -DSILICON_PV2 -DSILICON_SEAGULL -DSILICON_TTC_CORE_SEAGULL -DPCAC_INCLUDE -Otime -DBUILD_DATE=""11 22 2023"" -DBUILD_TIME=""10:22:51"" -Iatcmdsinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhoptelephonyyugeinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhalUARTinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhalcoreinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhalPMUinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhalGPIOinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xosposixinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xdiagdiag_logicsrc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xcswSysCfginc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xcswplatforminc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xenvwin32inc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xcswBSPinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xcswplatformdev_platbuild -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xososainc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xosthreadxinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xosnu_xscaleinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcacpsminc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcachttpclientsrc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xdiagdiag_logicinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhoptimerinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhopintcinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xcswPMinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhoppminc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilTickManagerinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhopBSPinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhoptelephonyatcmdsrvinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhoptelephonyatparserinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhoptelephonysdkinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcachttpclientinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcacciinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcaclwipv4v6srcinclude -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcaclwipv4v6srcincludearch -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcaclwipv4v6srcincludeipv4 -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcaclwipv4v6srcincludeipv6 -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcaclwipv4v6srcincludelwip -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcaclwipv4v6srcincludenetif -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhopmmi_matinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xtavorArbelinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xtavorenvinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhoptelephonymodeminc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcacdusterinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcacfotainc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhalI2Cinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhalACIPCinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilfatsysflash -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilFDIsrcINCLUDE -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhalMMUinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilFDIsrcFDI_ADD -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilFDIsrcFM_INC -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilfatsysfshdr -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutillittlefsinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcacttsinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcacdialinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilcsw_memoryinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhoputilitiesinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhopcommpminc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilnvminc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilEEhandlerinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilEEhandlersrc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhopRTCinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhoptelephonyci_clientinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhalBT_deviceinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhalUARTinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhopmrdinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhopdmainc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilsoftutilinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhalSPIinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcacwebsocketinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcacatnet_srvinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xsoftutilfotacomminc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xaud_swAudioinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xaud_swACM_COMMinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xaud_swaudio_stubsrc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhopaaminc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xaud_swAudioHALinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xhaldbgshellinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08includeasr160xpcacopencpuinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08amaziot_bloom_os_sdkutils -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08CSDK_CODEcJSONinc -IF:/3.asr-b/cat.1-asr1606/1.software/BLOOM_OS_1606_OPENCPU_1191_A08/amaziot_bloom_os_sdk/sample/libraries/20.10_do_xtuaminc -IF:/3.asr-b/cat.1-asr1606/1.software/BLOOM_OS_1606_OPENCPU_1191_A08/amaziot_bloom_os_sdk/sample/libraries/20.10_do_xtuatcmdsinc -IF:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08/amaziot_bloom_os_sdk/librariesamxtu -DDTU_BASED_ON_TCP -DDTU_TYPE_5X6 -DDTU_UART_115200_BAUD -DDTU_TYPE_DODIAI_INCLUDE -DDTU_TYPE_JSON_INCLUDE -o buildobj/ext_at_cmds.o F:/3.asr-b/cat.1-asr1606/1.software/BLOOM_OS_1606_OPENCPU_1191_A08/amaziot_bloom_os_sdk/sample/libraries/20.10_do_xtu/atcmds/src/ext_at_cmds.c armlink.exe buildobj/main.o buildobj/ext_at_cmds.o buildobj/ext_at_controller.o buildobj/am_file.o buildobj/am_at.o buildobj/am_trans.o buildobj/am_hb.o buildobj/am_di.o buildobj/am_do.o buildobj/am_ai.o buildobj/am_clock.o buildobj/am_json.o buildobj/am_socket.o buildCSDK_CODE.lib -o F:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08outbinArbel_PMD2NONE_40M.axf --via F:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08prebuilt_1606lArbel_PMD2NONE_targ_objliblist.txt --elf --scatter F:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08prebuilt_1606lCrane_DS_4M_Ram_2M_Flash_XIP_CIPSRAM_Common_SingleSIM.sct --predefine="-DLTEONLY_THIN_SINGLE_SIM" --map --symbols --info sizes,totals --list F:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08outbinArbel_PMD2NONE_40M.map --keep init.o(Header) --keep init.o(Vectors) --diag_suppress 6312,6314,6319,6329 --feedback F:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08outfeedbackLinkOptLteonlyThin_SingleSim_NoSMS.txt F:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08toolsbuildimage_1606l.bat SDK_PROD_TYPE : [DM] SDK_CUST_SKU : [THIN_SINGLE_SIM_NO_SMS] SDK_PS_MODE : [LTEONLY] SDK_CHIP_VER : [Z2A0] SDK_OS_TYPE : [TX] Platform Convertion Tools v4.01 with PS option extension Convertion done! |INPUT |outbincp_1606L.bin |MARK |NAME |EXEADDR .LOADADDR.LENGTH .CPZLADDR|COMPRESS STASTIC | |--------|--------|--------.--------.--------.--------|------------------------------| |This Is LteOnly 4M| |RW_CPZ_1|DDR_RW_ |7e11c000.8006cd70.0000d40c.8006d000|0000d40c->00003000 |This Is LteOnly 4M| |RW_CPZ_2|PS_NCAH |7e388000.8007a17c.00001300.80070000|00001300->00001000 |This Is LteOnly 4M| |RW_CPZ_3|ITCM |7e3dac00.8007b47c.0000f51c.80071000|0000f51c->0000a000 |This Is LteOnly 4M| |RW_CPZ_4|CODE_PS |7e1ad000.8008a998.0002fcdc.8007b000|0002fcdc->0001e000 |This Is LteOnly 4M| |RW_CPZ_5|CODEPSB |7e1df000.800ba674.000339c0.80099000|000339c0->0001b000 |This Is LteOnly 4M| |RW_CPZ_6|CODEPSC |7e216000.800ee034.000323ec.800b4000|000323ec->0001b000 |This Is LteOnly 4M| |RW_CPZ_7|CODEPSD |7e24c000.80120420.00028d88.800cf000|00028d88->0001a000 |This Is LteOnly 4M| |RW_CPZ_8|CODEPSE |7e27a000.801491a8.0002e310.800e9000|0002e310->0001a000 |This Is LteOnly 4M| |RW_CPZ_9|CODEPSF |7e2ac000.801774b8.0001c948.80103000|0001c948->00011000 |This Is LteOnly 4M| |RW_CPZ_A|CODE_PL |7e2cd000.80193e00.0002f914.80114000|0002f914->0001e000 |This Is LteOnly 4M| |RW_CPZ_B|CODEPLB |7e2fd000.801c3714.00038d38.80132000|00038d38->00021000 |This Is LteOnly 4M| |RW_CPZ_C|CODEPLC |7e337000.801fc44c.000268d4.80153000|000268d4->00012000 |--------|--------|--------.--------.--------.--------|------------------------------| | | 0x0020bd20 -> 0x0014e000| | | 2.046(MB) -> 1.305(MB)| |------------------------------------------------------------------------------------| cp_1606L.axf cp_1606L.bin cp_1606L.map gnumake: Leaving directory `F:/3.asr-b/cat.1-asr1606/1.software/BLOOM_OS_1606_OPENCPU_1191_A08/amaziot_bloom_os_sdk/sample/libraries/20.10_do_xtu' "copy NEZHAC_CP_CNR_MIFI_TX.bin to ./ " 已復(fù)制 1 個(gè)文件。
4.6 生成固件
參考入門中開發(fā)工具,生成工具。
4.7 查看現(xiàn)象
固件下載到模組后,發(fā)送DI 配置AT指令,觀察AT串口信息,
[11-22 10:24:20:275]RDY [11-22 10:24:26:029] [11-22 10:24:26:029]OK [11-22 10:24:31:646] [11-22 10:24:31:646]+DO1CFG:0,0,0 [11-22 10:24:31:646]+DO2CFG:0,0,0 [11-22 10:24:31:646]+DO3CFG:0,0,0 [11-22 10:24:31:646]+DO4CFG:0,0,0 [11-22 10:24:31:646]+DO5CFG:0,0,0 [11-22 10:24:31:646] [11-22 10:24:31:646]OK [11-22 10:24:32:446] [11-22 10:24:32:446]AT+DOCFG=5,0,10,0 [11-22 10:24:32:446] [11-22 10:24:32:446]OK [11-22 10:24:40:136] [11-22 10:24:40:136]+DO1CFG:0,0,0 [11-22 10:24:40:136]+DO2CFG:0,0,0 [11-22 10:24:40:136]+DO3CFG:0,0,0 [11-22 10:24:40:136]+DO4CFG:0,0,0 [11-22 10:24:40:136]+DO5CFG:0,10,0 [11-22 10:24:40:136] [11-22 10:24:40:136]OK [11-22 10:24:43:039] [11-22 10:24:43:039]+DORD:0,0,0,0,0 [11-22 10:24:43:039] [11-22 10:24:43:039]OK [11-22 10:24:47:303] [11-22 10:24:47:303]+DORD:0 [11-22 10:24:47:303] [11-22 10:24:47:303]OK
5 總結(jié)
根據(jù)實(shí)驗(yàn)現(xiàn)象,用戶需要實(shí)現(xiàn)自己的AT指令,只需要參考組件中的例子,按照自己需求修改,
本文章源自奇跡物聯(lián)開源的物聯(lián)網(wǎng)應(yīng)用知識(shí)庫Cellular IoT Wiki,更多技術(shù)干貨歡迎關(guān)注收藏Wiki:Cellular IoT Wiki 知識(shí)庫(https://rckrv97mzx.feishu.cn/wiki/wikcnBvAC9WOkEYG5CLqGwm6PHf)
歡迎同學(xué)們走進(jìn)AmazIOT知識(shí)庫的世界!
這里是為物聯(lián)網(wǎng)人構(gòu)建的技術(shù)應(yīng)用百科,以便幫助你更快更簡(jiǎn)單的開發(fā)物聯(lián)網(wǎng)產(chǎn)品。
Cellular IoT Wiki初心:
在我們長(zhǎng)期投身于蜂窩物聯(lián)網(wǎng) ODM/OEM 解決方案的實(shí)踐過程中,一直被物聯(lián)網(wǎng)技術(shù)碎片化與產(chǎn)業(yè)資源碎片化的問題所困擾。從產(chǎn)品定義、芯片選型,到軟硬件研發(fā)和測(cè)試,物聯(lián)網(wǎng)技術(shù)的碎片化以及產(chǎn)業(yè)資源的碎片化,始終對(duì)團(tuán)隊(duì)的產(chǎn)品開發(fā)交付質(zhì)量和效率形成制約。為了減少因物聯(lián)網(wǎng)碎片化而帶來的重復(fù)開發(fā)工作,我們著手對(duì)物聯(lián)網(wǎng)開發(fā)中高頻應(yīng)用的技術(shù)知識(shí)進(jìn)行沉淀管理,并基于 Bloom OS 搭建了不同平臺(tái)的 RTOS 應(yīng)用生態(tài)。后來我們發(fā)現(xiàn),很多物聯(lián)網(wǎng)產(chǎn)品開發(fā)團(tuán)隊(duì)都面臨著相似的困擾,于是,我們決定向全體物聯(lián)網(wǎng)行業(yè)開發(fā)者開放奇跡物聯(lián)內(nèi)部沉淀的應(yīng)用技術(shù)知識(shí)庫 Wiki,期望能為更多物聯(lián)網(wǎng)產(chǎn)品開發(fā)者減輕一些重復(fù)造輪子的負(fù)擔(dān)。
Cellular IoT Wiki沉淀的技術(shù)內(nèi)容方向如下:
奇跡物聯(lián)的業(yè)務(wù)服務(wù)范圍:基于自研的NB-IoT、Cat1、Cat4等物聯(lián)網(wǎng)模組,為客戶物聯(lián)網(wǎng)ODM/OEM解決方案服務(wù)。我們的研發(fā)技術(shù)中心在石家莊,PCBA生產(chǎn)基地分布在深圳、石家莊、北京三個(gè)工廠,滿足不同區(qū)域&不同量產(chǎn)規(guī)模&不同產(chǎn)品開發(fā)階段的生產(chǎn)制造任務(wù)。跟傳統(tǒng)PCBA工廠最大的區(qū)別是我們只服務(wù)物聯(lián)網(wǎng)行業(yè)客戶。
連接我們,和10000+物聯(lián)網(wǎng)開發(fā)者一起 降低技術(shù)和成本門檻
讓蜂窩物聯(lián)網(wǎng)應(yīng)用更簡(jiǎn)單~~
哈哈你終于滑到最重要的模塊了,
千萬不!要!劃!走!忍住沖動(dòng)!~
歡迎加入飛書“開源技術(shù)交流群”,隨時(shí)找到我們哦~
點(diǎn)擊鏈接如何加入奇跡物聯(lián)技術(shù)話題群(https://rckrv97mzx.feishu.cn/docx/Xskpd1cFQo7hu9x5EuicbsjTnTf)可以獲取加入技術(shù)話題群攻略
Hey 物聯(lián)網(wǎng)從業(yè)者,
你是否有了解過奇跡物聯(lián)的官方公眾號(hào)“eSIM物聯(lián)工場(chǎng)”呢?
這里是奇跡物聯(lián)的物聯(lián)網(wǎng)應(yīng)用技術(shù)開源wiki主陣地,歡迎關(guān)注公眾號(hào),不迷路~
及時(shí)獲得最新物聯(lián)網(wǎng)應(yīng)用技術(shù)沉淀發(fā)布
(如有侵權(quán),聯(lián)系刪除)
-
繼電器
+關(guān)注
關(guān)注
132文章
5315瀏覽量
148390 -
存儲(chǔ)器
+關(guān)注
關(guān)注
38文章
7439瀏覽量
163529 -
物聯(lián)網(wǎng)
+關(guān)注
關(guān)注
2902文章
44118瀏覽量
370421 -
RTU
+關(guān)注
關(guān)注
0文章
403瀏覽量
28602
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論