一 概述
鬧鐘,顧名思義,即在未來某個時刻提醒做某件事情。在嵌入式開發(fā)中,尤其是物聯(lián)網(wǎng)領域。
在對功耗要求不高的場景中,鬧鐘可以使用定時器實現(xiàn)。MCU還可以使用系統(tǒng)滴答定時器SYSTicks實現(xiàn)。
在低功耗場景中,建議使用RTC實時時鐘實現(xiàn),因為在低功耗場景中,大多數(shù)主控都可以做到低功耗情況下保持RTC的運行。同時RTC鬧鐘超時后,可以喚醒主控,進行下一步業(yè)務,例如聯(lián)網(wǎng)等。
紅豆版本中,鬧鐘使用定時器實現(xiàn)。
二 定時器是什么
1.什么是定時器
定時器是SoC的常見外設
(1)定時器和計數(shù)器。計數(shù)器是用來計數(shù)的(每隔一個固定時間會計一個數(shù));因為計數(shù)器的計數(shù)時間周期是固定的,因此到了一定時間只要用計數(shù)值x計數(shù)時間周期,就可以得到一個時間段,這個時間段就是我們定的時間(這就是定時器)。
(2)定時器/計數(shù)器作為SoC的外設,主要用來實現(xiàn)定時執(zhí)行代碼的功能。定時器相對于SoC來說,就好象鬧鐘相對于人來說意義一樣。
2.定時器有什么用
(1)定時器可以讓SoC在執(zhí)行主程序的同時,具有計時功能(通過定時器),到了一定時間(計時結(jié)束)后,定時器會產(chǎn)生中斷提醒CPU,CPU會去處理中斷并執(zhí)行定時器中斷的ISR。從而去執(zhí)行預先設定好的事件。
(2)定時器就好象是CPU的一個秘書一樣,這個秘書專門管幫CPU來計時,并到時間后提醒CPU要做某件事情。所以CPU有了定時器之后,只需預先把自己xx時間之后必須要做的事情綁定到定時器中斷ISR即可,到了時間之后定時器就會以中斷的方式提醒CPU來處理這個事情。
3.定時器的原理
(1)定時器計時其實是通過計數(shù)來實現(xiàn)的。 定時器內(nèi)部有一個計數(shù)器,這個計數(shù)器根據(jù)一個時鐘(這個時鐘源來自于ARM的APB總線 66MHz,然后經(jīng)過時鐘模塊內(nèi)部的分頻器來分頻得到)來工作。每隔一個時鐘周期,計數(shù)器就計數(shù)一次,定時器的時間就是計數(shù)器計數(shù)值×時鐘周期。
(2)定時器內(nèi)部有1個寄存器TCNT,計時開始時我們會把一個總的計數(shù)值(初值)放入TCNT寄存器中,然后每隔一個時鐘周期(假設為1ms)TCNT中的值會自動減1(硬件自動完成,不需要CPU軟件去干預),直到TCNT中減為0的時候,TCNT就會觸發(fā)定時器中斷。
(3)定時時間是由2個東西共同決定的:一個是TCNT中的計數(shù)值,一個是時鐘周期,兩者的乘積即為最終定時的時間。
三 SYSTicks是什么
嵌入式開發(fā)中的SysTick(System Tick Timer)是一個簡單的定時器,它為嵌入式系統(tǒng)提供了一個周期性的中斷或事件,通常用于操作系統(tǒng)任務調(diào)度、時間跟蹤或其他需要定時功能的場合。SysTick是ARM Cortex-M微控制器內(nèi)核的一部分,但類似的概念也存在于其他架構中。
四 RTC是什么
1.簡介
實時時鐘是一個獨立的定時器。RTC模塊擁有一組連續(xù)計數(shù)的計數(shù)器,在相應軟件配置下,可提供時鐘日歷的功能,計數(shù)頻率常為秒。修改計數(shù)器的值可以重新設置系統(tǒng)當前的時間和日期。
2.特性
(1)32位的可編程計數(shù)器,可用于較長時間段的測量
(2)能在MCU掉電后運行
(3) 低功耗
3.后備寄存器和RTC寄存器特性
(1)部分寄存器寫保護:RTC_PRL、RTC_ALR、RTC_CNT和RTC_DIV寄存器不會被系統(tǒng)復位。
(2)數(shù)據(jù)存儲功能:RTC和后備寄存器不會被系統(tǒng)或電源復位源復位;當從待機模式喚醒時,也不會被復位。后備寄存器可用于保存掉電時的數(shù)據(jù)。
(3)獨立工作:RTC和后備寄存器通過一個開關供電,在VDD有效時該開關選擇VDD供電,否則由VBAT引腳供電。在VBAT供電時仍可繼續(xù)工作。
(4)2個獨立復位:APB1接口由系統(tǒng)復位;RTC核心只能由后備域復位;
三 使用場景
定時和服務器通信,可以用到鬧鐘功能。每次鬧鐘超時通知后,和服務器通信,通信完畢,再次設置一個下次通信的鬧鐘。
定時采集傳感器數(shù)據(jù),
五 鬧鐘組件的使用
1 Gitee鏈接地址
組件位于amaziot_bloom_os_sdklibrariesamxtuam_clock.c
Gitee源碼地址:https://gitee.com/ning./hongdou
Github源碼地址:https://github.com/ayumid/hongdou
2 應用層組件功能介紹
提供鬧鐘實例。
使用該組件,必須同時使用AT組件,文件組件,TCP組件,掉線組件,掉線重連組件,DI組件,DO組件,AI組件,JSON組件,CLK組件。
3 代碼講解
1 dtu_clk_times_init
時鐘定時器初始化
void dtu_clk_times_init(void) { int ret = 0; ret = OSATimerCreate(&dtu_clock1_timer_ref); ASSERT(ret == OS_SUCCESS); ret = OSATimerCreate(&dtu_clock2_timer_ref); ASSERT(ret == OS_SUCCESS); ret = OSATimerCreate(&dtu_clock3_timer_ref); ASSERT(ret == OS_SUCCESS); ret = OSATimerCreate(&dtu_clock4_timer_ref); ASSERT(ret == OS_SUCCESS); ret = OSATimerCreate(&dtu_clock5_timer_ref); ASSERT(ret == OS_SUCCESS); }
2 dtu_clk_timer_stop
鬧鐘停止
void dtu_clk_timer_stop(UINT8 index) { //開啟定時器 if(DTU_TIME_INDEX_1 == index) { OSATimerStop(dtu_clock1_timer_ref); } else if(DTU_TIME_INDEX_2 == index) { OSATimerStop(dtu_clock2_timer_ref); } else if(DTU_TIME_INDEX_3 == index) { OSATimerStop(dtu_clock3_timer_ref); } else if(DTU_TIME_INDEX_4 == index) { OSATimerStop(dtu_clock4_timer_ref); } else if(DTU_TIME_INDEX_5 == index) { OSATimerStop(dtu_clock5_timer_ref); } }
3 dtu_clk_timer_start
鬧鐘開啟,判斷鬧鐘時間是一天內(nèi)當前時間之前,還是之后
void dtu_clk_timer_start(UINT8 index) { t_rtc bj_time; UINT32 time_sec_now = 0; UINT32 time_sec_alarm = 0; DTU_FILE_PARAM_T* dtu_file_ctx = NULL; dtu_file_ctx = dtu_get_file_ctx(); //獲取當前北京時間 SDK_GET_BEIJING_TIME(&bj_time); //計算當前時間和鬧鐘時間秒數(shù) time_sec_now = bj_time.tm_hour * DTU_CLK_ONE_HOUR_HAS_SEC + bj_time.tm_min * DTU_CLK_ONE_MIN_HAS_SEC + bj_time.tm_sec; time_sec_alarm = dtu_file_ctx->clk.params[index - 1].h * DTU_CLK_ONE_HOUR_HAS_SEC + dtu_file_ctx->clk.params[index - 1].m * DTU_CLK_ONE_MIN_HAS_SEC + dtu_file_ctx->clk.params[index - 1].s; uprintf("clk%d: %d:%d:%d,%d %d:%d:%d,%d", index, bj_time.tm_hour, bj_time.tm_min, bj_time.tm_sec, time_sec_now, dtu_file_ctx->clk.params[index - 1].h, dtu_file_ctx->clk.params[index - 1].m, dtu_file_ctx->clk.params[index - 1].s, time_sec_alarm); dtu_clk_timer_stop(index); //判斷鬧鐘時間是在今天還是明天 //鬧鐘時間在今天當前時間之后 if(time_sec_now < time_sec_alarm) { //開啟定時器 if(DTU_TIME_INDEX_1 == index) { OSATimerStart(dtu_clock1_timer_ref, (time_sec_alarm - time_sec_now) * 200, 0, dtu_clk1_timer_callback, 0); } else if(DTU_TIME_INDEX_2 == index) { OSATimerStart(dtu_clock2_timer_ref, (time_sec_alarm - time_sec_now) * 200, 0, dtu_clk2_timer_callback, 0); } else if(DTU_TIME_INDEX_3 == index) { OSATimerStart(dtu_clock3_timer_ref, (time_sec_alarm - time_sec_now) * 200, 0, dtu_clk3_timer_callback, 0); } else if(DTU_TIME_INDEX_4 == index) { OSATimerStart(dtu_clock4_timer_ref, (time_sec_alarm - time_sec_now) * 200, 0, dtu_clk4_timer_callback, 0); } else if(DTU_TIME_INDEX_5 == index) { OSATimerStart(dtu_clock5_timer_ref, (time_sec_alarm - time_sec_now) * 200, 0, dtu_clk5_timer_callback, 0); } } else { //開啟定時器 if(DTU_TIME_INDEX_1 == index) { OSATimerStart(dtu_clock1_timer_ref, (time_sec_alarm - time_sec_now + 86400) * 200, 0, dtu_clk1_timer_callback, 0); } else if(DTU_TIME_INDEX_2 == index) { OSATimerStart(dtu_clock2_timer_ref, (time_sec_alarm - time_sec_now + 86400) * 200, 0, dtu_clk2_timer_callback, 0); } else if(DTU_TIME_INDEX_3 == index) { OSATimerStart(dtu_clock3_timer_ref, (time_sec_alarm - time_sec_now + 86400) * 200, 0, dtu_clk3_timer_callback, 0); } else if(DTU_TIME_INDEX_4 == index) { OSATimerStart(dtu_clock4_timer_ref, (time_sec_alarm - time_sec_now + 86400) * 200, 0, dtu_clk4_timer_callback, 0); } else if(DTU_TIME_INDEX_5 == index) { OSATimerStart(dtu_clock5_timer_ref, (time_sec_alarm - time_sec_now + 86400) * 200, 0, dtu_clk5_timer_callback, 0); } } }
4 dtu_clk1_timer_callback
鬧鐘1回調(diào)函數(shù),響鈴后去做一些事情
static void dtu_clk1_timer_callback(UINT32 tmrId) { DTU_FILE_PARAM_T* dtu_file_ctx = NULL; dtu_file_ctx = dtu_get_file_ctx(); uprintf("%s[%d]", __FUNCTION__, __LINE__); // dtu_clk1_timer_stop(); //按照配置輸出對應DO dtu_do_clk_timeout_write_pin(dtu_file_ctx->clk.params[DTU_BUF_INDEX_1].num, dtu_file_ctx->clk.params[DTU_BUF_INDEX_1].level); }
4 Demo實戰(zhàn)
4.1 創(chuàng)建一個Demo
復制20.2_at_xtu示例工程,到同一個文件夾下,修改文件名為20.9_di_xtu,如圖:
4.2 修改makefile
增加文件組件所在目錄頭文件路徑,和源文件路徑,以及一些宏定義,如圖:
-D是makefile中定義宏定義必要的前綴,可以搜索相關makefile學習文章學習相關知識。
DTU_BASED_ON_TCP 表示當前是TCP模式,當前組件使用需要am.h中包含一些對應。
DTU_TYPE_5X6 表示使用SOM板貼片5x6卡,可以使用其它卡,修改為對應宏定義就可以。
DTU_UART_115200_BAUD 表示使用115200波特率
DTU_TYPE_JSON_INCLUDE 表示把JSON功能包含進來
4.3 增加頭文件
使用代碼編輯器,將新建的工程文件加入代碼編輯器中,打開main.c,修改main.c,加入am.h頭文件,如圖:
4.4 修改代碼
示例使用的是板載5x6卡,用戶的硬件可能是使用外置卡,或者是三合一全網(wǎng)通卡,因為硬件上三種卡使用的模組SIM卡接口不一樣(外置卡SIM1,5x6卡和三合一卡SIM2),所以,需要通過一個全局變量來制定SIM卡硬件接口。
extern外部變量SDK_INIT_SIM_SELECT_VALUE,這里判斷了是否使用外置卡,這個宏定義在Makefile里面定義。
在Phase1Inits_enter中,宏定義判斷是否要包含對SDK_INIT_SIM_SELECT_VALUE變量的修改。
在Phase2Inits_exit 調(diào)用文件組件提供的對外API,如圖:
4.5 編譯
在SDK根目錄打開命令行,輸入命令.build.bat -l .amaziot_bloom_os_sdksamplelibraries20.13_clk_xtu
PS F:3.asr-bcat.1-asr16061.softwareBLOOM_OS_1606_OPENCPU_1191_A08 λ .build.bat -l .amaziot_bloom_os_sdksamplelibraries20.13_clk_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.13_clk_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:53:28"" -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.13_clk_xtuaminc -IF:/3.asr-b/cat.1-asr1606/1.software/BLOOM_OS_1606_OPENCPU_1191_A08/amaziot_bloom_os_sdk/sample/libraries/20.13_clk_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.13_clk_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.13_clk_xtu' "copy NEZHAC_CP_CNR_MIFI_TX.bin to ./ " 已復制 1 個文件。
4.6 生成固件
參考入門中開發(fā)工具,生成工具。
4.7 查看現(xiàn)象
固件下載到模組后,發(fā)送CLK 配置AT指令,觀察AT串口信息,超時后Debug口會出現(xiàn)DO1輸出高的信息
觸發(fā)di后,使用查看命令
[11-22 11:01:05:807]?? [11-22 11:01:09:624]RDY [11-22 11:01:17:158] [11-22 11:01:17:158]OK [11-22 11:01:54:705] [11-22 11:01:54:705]+CLK1:0,0,0,0,0 [11-22 11:01:54:705]+CLK2:0,0,0,0,0 [11-22 11:01:54:705]+CLK3:0,0,0,0,0 [11-22 11:01:54:705]+CLK4:0,0,0,0,0 [11-22 11:01:54:705]+CLK5:0,0,0,0,0 [11-22 11:01:54:705] [11-22 11:01:54:705]OK [11-22 11:01:55:421] [11-22 11:01:55:421]AT+CLKCFG=1,11,2,0,1,1 [11-22 11:01:55:421] [11-22 11:01:55:421]OK [11-22 11:01:56:754] [11-22 11:01:56:754]+CLK1:11,2,0,1,1 [11-22 11:01:56:754]+CLK2:0,0,0,0,0 [11-22 11:01:56:754]+CLK3:0,0,0,0,0 [11-22 11:01:56:754]+CLK4:0,0,0,0,0 [11-22 11:01:56:754]+CLK5:0,0,0,0,0 [11-22 11:01:56:754] [11-22 11:01:56:754]OK [11-22 11:02:08:282] [11-22 11:02:08:282]+DORD:1 [11-22 11:02:08:282] [11-22 11:02:08:282]OK
5 總結(jié)
根據(jù)實驗現(xiàn)象,用戶需要實現(xiàn)自己的AT指令,只需要參考組件中的例子,按照自己需求修改,
本文章源自奇跡物聯(lián)開源的物聯(lián)網(wǎng)應用知識庫Cellular IoT Wiki,更多技術干貨歡迎關注收藏Wiki:Cellular IoT Wiki 知識庫(https://rckrv97mzx.feishu.cn/wiki/wikcnBvAC9WOkEYG5CLqGwm6PHf)
歡迎同學們走進AmazIOT知識庫的世界!
這里是為物聯(lián)網(wǎng)人構建的技術應用百科,以便幫助你更快更簡單的開發(fā)物聯(lián)網(wǎng)產(chǎn)品。
Cellular IoT Wiki初心:
在我們長期投身于蜂窩物聯(lián)網(wǎng) ODM/OEM 解決方案的實踐過程中,一直被物聯(lián)網(wǎng)技術碎片化與產(chǎn)業(yè)資源碎片化的問題所困擾。從產(chǎn)品定義、芯片選型,到軟硬件研發(fā)和測試,物聯(lián)網(wǎng)技術的碎片化以及產(chǎn)業(yè)資源的碎片化,始終對團隊的產(chǎn)品開發(fā)交付質(zhì)量和效率形成制約。為了減少因物聯(lián)網(wǎng)碎片化而帶來的重復開發(fā)工作,我們著手對物聯(lián)網(wǎng)開發(fā)中高頻應用的技術知識進行沉淀管理,并基于 Bloom OS 搭建了不同平臺的 RTOS 應用生態(tài)。后來我們發(fā)現(xiàn),很多物聯(lián)網(wǎng)產(chǎn)品開發(fā)團隊都面臨著相似的困擾,于是,我們決定向全體物聯(lián)網(wǎng)行業(yè)開發(fā)者開放奇跡物聯(lián)內(nèi)部沉淀的應用技術知識庫 Wiki,期望能為更多物聯(lián)網(wǎng)產(chǎn)品開發(fā)者減輕一些重復造輪子的負擔。
Cellular IoT Wiki沉淀的技術內(nèi)容方向如下:
奇跡物聯(lián)的業(yè)務服務范圍:基于自研的NB-IoT、Cat1、Cat4等物聯(lián)網(wǎng)模組,為客戶物聯(lián)網(wǎng)ODM/OEM解決方案服務。我們的研發(fā)技術中心在石家莊,PCBA生產(chǎn)基地分布在深圳、石家莊、北京三個工廠,滿足不同區(qū)域&不同量產(chǎn)規(guī)模&不同產(chǎn)品開發(fā)階段的生產(chǎn)制造任務。跟傳統(tǒng)PCBA工廠最大的區(qū)別是我們只服務物聯(lián)網(wǎng)行業(yè)客戶。
連接我們,和10000+物聯(lián)網(wǎng)開發(fā)者一起 降低技術和成本門檻
讓蜂窩物聯(lián)網(wǎng)應用更簡單~~
哈哈你終于滑到最重要的模塊了,
千萬不!要!劃!走!忍住沖動!~
歡迎加入飛書“開源技術交流群”,隨時找到我們哦~
點擊鏈接如何加入奇跡物聯(lián)技術話題群(https://rckrv97mzx.feishu.cn/docx/Xskpd1cFQo7hu9x5EuicbsjTnTf)可以獲取加入技術話題群攻略
Hey 物聯(lián)網(wǎng)從業(yè)者,
你是否有了解過奇跡物聯(lián)的官方公眾號“eSIM物聯(lián)工場”呢?
這里是奇跡物聯(lián)的物聯(lián)網(wǎng)應用技術開源wiki主陣地,歡迎關注公眾號,不迷路~
及時獲得最新物聯(lián)網(wǎng)應用技術沉淀發(fā)布
(如有侵權,聯(lián)系刪除)
-
嵌入式
+關注
關注
5060文章
18979瀏覽量
302235 -
物聯(lián)網(wǎng)
+關注
關注
2902文章
44118瀏覽量
370421 -
定時器
+關注
關注
23文章
3234瀏覽量
114356 -
DTU
+關注
關注
3文章
428瀏覽量
25145 -
RTU
+關注
關注
0文章
403瀏覽量
28602
發(fā)布評論請先 登錄
相關推薦
評論