一 概述
鬧鐘,顧名思義,即在未來某個(gè)時(shí)刻提醒做某件事情。在嵌入式開發(fā)中,尤其是物聯(lián)網(wǎng)領(lǐng)域。
在對(duì)功耗要求不高的場(chǎng)景中,鬧鐘可以使用定時(shí)器實(shí)現(xiàn)。MCU還可以使用系統(tǒng)滴答定時(shí)器SYSTicks實(shí)現(xiàn)。
在低功耗場(chǎng)景中,建議使用RTC實(shí)時(shí)時(shí)鐘實(shí)現(xiàn),因?yàn)樵诘凸膱?chǎng)景中,大多數(shù)主控都可以做到低功耗情況下保持RTC的運(yùn)行。同時(shí)RTC鬧鐘超時(shí)后,可以喚醒主控,進(jìn)行下一步業(yè)務(wù),例如聯(lián)網(wǎng)等。
紅豆版本中,鬧鐘使用定時(shí)器實(shí)現(xiàn)。
二 定時(shí)器是什么
1.什么是定時(shí)器
定時(shí)器是SoC的常見外設(shè)
(1)定時(shí)器和計(jì)數(shù)器。計(jì)數(shù)器是用來計(jì)數(shù)的(每隔一個(gè)固定時(shí)間會(huì)計(jì)一個(gè)數(shù));因?yàn)橛?jì)數(shù)器的計(jì)數(shù)時(shí)間周期是固定的,因此到了一定時(shí)間只要用計(jì)數(shù)值x計(jì)數(shù)時(shí)間周期,就可以得到一個(gè)時(shí)間段,這個(gè)時(shí)間段就是我們定的時(shí)間(這就是定時(shí)器)。
(2)定時(shí)器/計(jì)數(shù)器作為SoC的外設(shè),主要用來實(shí)現(xiàn)定時(shí)執(zhí)行代碼的功能。定時(shí)器相對(duì)于SoC來說,就好象鬧鐘相對(duì)于人來說意義一樣。
2.定時(shí)器有什么用
(1)定時(shí)器可以讓SoC在執(zhí)行主程序的同時(shí),具有計(jì)時(shí)功能(通過定時(shí)器),到了一定時(shí)間(計(jì)時(shí)結(jié)束)后,定時(shí)器會(huì)產(chǎn)生中斷提醒CPU,CPU會(huì)去處理中斷并執(zhí)行定時(shí)器中斷的ISR。從而去執(zhí)行預(yù)先設(shè)定好的事件。
(2)定時(shí)器就好象是CPU的一個(gè)秘書一樣,這個(gè)秘書專門管幫CPU來計(jì)時(shí),并到時(shí)間后提醒CPU要做某件事情。所以CPU有了定時(shí)器之后,只需預(yù)先把自己xx時(shí)間之后必須要做的事情綁定到定時(shí)器中斷ISR即可,到了時(shí)間之后定時(shí)器就會(huì)以中斷的方式提醒CPU來處理這個(gè)事情。
3.定時(shí)器的原理
(1)定時(shí)器計(jì)時(shí)其實(shí)是通過計(jì)數(shù)來實(shí)現(xiàn)的。 定時(shí)器內(nèi)部有一個(gè)計(jì)數(shù)器,這個(gè)計(jì)數(shù)器根據(jù)一個(gè)時(shí)鐘(這個(gè)時(shí)鐘源來自于ARM的APB總線 66MHz,然后經(jīng)過時(shí)鐘模塊內(nèi)部的分頻器來分頻得到)來工作。每隔一個(gè)時(shí)鐘周期,計(jì)數(shù)器就計(jì)數(shù)一次,定時(shí)器的時(shí)間就是計(jì)數(shù)器計(jì)數(shù)值×?xí)r鐘周期。
(2)定時(shí)器內(nèi)部有1個(gè)寄存器TCNT,計(jì)時(shí)開始時(shí)我們會(huì)把一個(gè)總的計(jì)數(shù)值(初值)放入TCNT寄存器中,然后每隔一個(gè)時(shí)鐘周期(假設(shè)為1ms)TCNT中的值會(huì)自動(dòng)減1(硬件自動(dòng)完成,不需要CPU軟件去干預(yù)),直到TCNT中減為0的時(shí)候,TCNT就會(huì)觸發(fā)定時(shí)器中斷。
(3)定時(shí)時(shí)間是由2個(gè)東西共同決定的:一個(gè)是TCNT中的計(jì)數(shù)值,一個(gè)是時(shí)鐘周期,兩者的乘積即為最終定時(shí)的時(shí)間。
三 SYSTicks是什么
嵌入式開發(fā)中的SysTick(System Tick Timer)是一個(gè)簡(jiǎn)單的定時(shí)器,它為嵌入式系統(tǒng)提供了一個(gè)周期性的中斷或事件,通常用于操作系統(tǒng)任務(wù)調(diào)度、時(shí)間跟蹤或其他需要定時(shí)功能的場(chǎng)合。SysTick是ARM Cortex-M微控制器內(nèi)核的一部分,但類似的概念也存在于其他架構(gòu)中。
四 RTC是什么
1.簡(jiǎn)介
實(shí)時(shí)時(shí)鐘是一個(gè)獨(dú)立的定時(shí)器。RTC模塊擁有一組連續(xù)計(jì)數(shù)的計(jì)數(shù)器,在相應(yīng)軟件配置下,可提供時(shí)鐘日歷的功能,計(jì)數(shù)頻率常為秒。修改計(jì)數(shù)器的值可以重新設(shè)置系統(tǒng)當(dāng)前的時(shí)間和日期。
2.特性
(1)32位的可編程計(jì)數(shù)器,可用于較長(zhǎng)時(shí)間段的測(cè)量
(2)能在MCU掉電后運(yùn)行
(3) 低功耗
3.后備寄存器和RTC寄存器特性
(1)部分寄存器寫保護(hù):RTC_PRL、RTC_ALR、RTC_CNT和RTC_DIV寄存器不會(huì)被系統(tǒng)復(fù)位。
(2)數(shù)據(jù)存儲(chǔ)功能:RTC和后備寄存器不會(huì)被系統(tǒng)或電源復(fù)位源復(fù)位;當(dāng)從待機(jī)模式喚醒時(shí),也不會(huì)被復(fù)位。后備寄存器可用于保存掉電時(shí)的數(shù)據(jù)。
(3)獨(dú)立工作:RTC和后備寄存器通過一個(gè)開關(guān)供電,在VDD有效時(shí)該開關(guān)選擇VDD供電,否則由VBAT引腳供電。在VBAT供電時(shí)仍可繼續(xù)工作。
(4)2個(gè)獨(dú)立復(fù)位:APB1接口由系統(tǒng)復(fù)位;RTC核心只能由后備域復(fù)位;
三 使用場(chǎng)景
定時(shí)和服務(wù)器通信,可以用到鬧鐘功能。每次鬧鐘超時(shí)通知后,和服務(wù)器通信,通信完畢,再次設(shè)置一個(gè)下次通信的鬧鐘。
定時(shí)采集傳感器數(shù)據(jù),
五 鬧鐘組件的使用
1 Gitee鏈接地址
組件位于amaziot_bloom_os_sdklibrariesamxtuam_clock.c
Gitee源碼地址:https://gitee.com/ning./hongdou
Github源碼地址:https://github.com/ayumid/hongdou
2 應(yīng)用層組件功能介紹
提供鬧鐘實(shí)例。
使用該組件,必須同時(shí)使用AT組件,文件組件,TCP組件,掉線組件,掉線重連組件,DI組件,DO組件,AI組件,JSON組件,CLK組件。
3 代碼講解
1 dtu_clk_times_init
時(shí)鐘定時(shí)器初始化
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) { //開啟定時(shí)器 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
鬧鐘開啟,判斷鬧鐘時(shí)間是一天內(nèi)當(dāng)前時(shí)間之前,還是之后
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(); //獲取當(dāng)前北京時(shí)間 SDK_GET_BEIJING_TIME(&bj_time); //計(jì)算當(dāng)前時(shí)間和鬧鐘時(shí)間秒數(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); //判斷鬧鐘時(shí)間是在今天還是明天 //鬧鐘時(shí)間在今天當(dāng)前時(shí)間之后 if(time_sec_now < time_sec_alarm) { //開啟定時(shí)器 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 { //開啟定時(shí)器 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(); //按照配置輸出對(duì)應(yīng)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實(shí)戰(zhàn)
4.1 創(chuàng)建一個(gè)Demo
復(fù)制20.2_at_xtu示例工程,到同一個(gè)文件夾下,修改文件名為20.9_di_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.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 ./ " 已復(fù)制 1 個(gè)文件。
4.6 生成固件
參考入門中開發(fā)工具,生成工具。
4.7 查看現(xiàn)象
固件下載到模組后,發(fā)送CLK 配置AT指令,觀察AT串口信息,超時(shí)后Debug口會(huì)出現(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ù)實(shí)驗(yàn)現(xiàn)象,用戶需要實(shí)現(xiàn)自己的AT指令,只需要參考組件中的例子,按照自己需求修改,
本文章源自奇跡物聯(lián)開源的物聯(lián)網(wǎng)應(yīng)用知識(shí)庫(kù)Cellular IoT Wiki,更多技術(shù)干貨歡迎關(guān)注收藏Wiki:Cellular IoT Wiki 知識(shí)庫(kù)(https://rckrv97mzx.feishu.cn/wiki/wikcnBvAC9WOkEYG5CLqGwm6PHf)
歡迎同學(xué)們走進(jìn)AmazIOT知識(shí)庫(kù)的世界!
這里是為物聯(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í)庫(kù) 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)單~~
哈哈你終于滑到最重要的模塊了,
千萬(wà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)注
5082文章
19126瀏覽量
305184 -
物聯(lián)網(wǎng)
+關(guān)注
關(guān)注
2909文章
44635瀏覽量
373354 -
定時(shí)器
+關(guān)注
關(guān)注
23文章
3248瀏覽量
114798 -
DTU
+關(guān)注
關(guān)注
3文章
436瀏覽量
25242 -
RTU
+關(guān)注
關(guān)注
0文章
413瀏覽量
28679
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論