原创 物联网中的DTU/RTU中的闹钟功能有哪些作用,如何实现

2024-9-29 16:05 240 1 1 分类: 物联网


01

概述


闹钟,顾名思义,即在未来某个时刻提醒做某件事情。在嵌入式开发中,尤其是物联网领域。

在对功耗要求不高的场景中,闹钟可以使用定时器实现。MCU还可以使用系统滴答定时器SYSTicks实现。

在低功耗场景中,建议使用RTC实时时钟实现,因为在低功耗场景中,大多数主控都可以做到低功耗情况下保持RTC的运行。同时RTC闹钟超时后,可以唤醒主控,进行下一步业务,例如联网等。

红豆版本中,闹钟使用定时器实现。


02

定时器是什么


1.什么是定时器

定时器是SoC的常见外设

(1)定时器和计数器。计数器是用来计数的(每隔一个固定时间会计一个数);因为计数器的计数时间周期是固定的,因此到了一定时间只要用计数值x计数时间周期,就可以得到一个时间段,这个时间段就是我们定的时间(这就是定时器)。

(2)定时器/计数器作为SoC的外设,主要用来实现定时执行代码的功能。定时器相对于SoC来说,就好象闹钟相对于人来说意义一样。

2.定时器有什么用

(1)定时器可以让SoC在执行主程序的同时,具有计时功能(通过定时器),到了一定时间(计时结束)后,定时器会产生中断提醒CPU,CPU会去处理中断并执行定时器中断的ISR。从而去执行预先设定好的事件。

(2)定时器就好象是CPU的一个秘书一样,这个秘书专门管帮CPU来计时,并到时间后提醒CPU要做某件事情。所以CPU有了定时器之后,只需预先把自己xx时间之后必须要做的事情绑定到定时器中断ISR即可,到了时间之后定时器就会以中断的方式提醒CPU来处理这个事情。

3.定时器的原理

(1)定时器计时其实是通过计数来实现的。 定时器内部有一个计数器,这个计数器根据一个时钟(这个时钟源来自于ARM的APB总线 66MHz,然后经过时钟模块内部的分频器来分频得到)来工作。每隔一个时钟周期,计数器就计数一次,定时器的时间就是计数器计数值×时钟周期。

(2)定时器内部有1个寄存器TCNT,计时开始时我们会把一个总的计数值(初值)放入TCNT寄存器中,然后每隔一个时钟周期(假设为1ms)TCNT中的值会自动减1(硬件自动完成,不需要CPU软件去干预),直到TCNT中减为0的时候,TCNT就会触发定时器中断。

(3)定时时间是由2个东西共同决定的:一个是TCNT中的计数值,一个是时钟周期,两者的乘积即为最终定时的时间。


03

SYSTicks是什么


嵌入式开发中的SysTick(System Tick Timer)是一个简单的定时器,它为嵌入式系统提供了一个周期性的中断或事件,通常用于操作系统任务调度、时间跟踪或其他需要定时功能的场合。SysTick是ARM Cortex-M微控制器内核的一部分,但类似的概念也存在于其他架构中。


04

RTC是什么


1.简介

实时时钟是一个独立的定时器。RTC模块拥有一组连续计数的计数器,在相应软件配置下,可提供时钟日历的功能,计数频率常为秒。修改计数器的值可以重新设置系统当前的时间和日期。

2.特性

(1)32位的可编程计数器,可用于较长时间段的测量

(2)能在MCU掉电后运行

(3) 低功耗

3.后备寄存器和RTC寄存器特性

(1)部分寄存器写保护:RTC_PRL、RTC_ALR、RTC_CNT和RTC_DIV寄存器不会被系统复位。

(2)数据存储功能:RTC和后备寄存器不会被系统或电源复位源复位;当从待机模式唤醒时,也不会被复位。后备寄存器可用于保存掉电时的数据

(3)独立工作:RTC和后备寄存器通过一个开关供电,在VDD有效时该开关选择VDD供电,否则由VBAT引脚供电。在VBAT供电时仍可继续工作

(4)2个独立复位:APB1接口由系统复位;RTC核心只能由后备域复位;


05

闹钟组件的使用


1 Gitee链接地址

组件位于amaziot_bloom_os_sdk\libraries\am\xtu\am_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

时钟定时器初始化

C++
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

闹钟停止

C++
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

闹钟开启,判断闹钟时间是一天内当前时间之前,还是之后

C++
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);
//计算当前时间和闹钟时间秒数
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回调函数,响铃后去做一些事情

C++
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实战

4.1 创建一个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卡,用户的硬件可能是使用外置卡,或者是三合一全网通卡,因为硬件上三种卡使用的模组SIM卡接口不一样(外置卡SIM1,5x6卡和三合一卡SIM2),所以,需要通过一个全局变量来制定SIM卡硬件接口。

extern外部变量SDK_INIT_SIM_SELECT_VALUE,这里判断了是否使用外置卡,这个宏定义在Makefile里面定义。

在Phase1Inits_enter中,宏定义判断是否要包含对SDK_INIT_SIM_SELECT_VALUE变量的修改。

在Phase2Inits_exit 调用文件组件提供的对外API,如图:

4.5 编译

在SDK根目录打开命令行,输入命令.\build.bat -l .\amaziot_bloom_os_sdk\sample\libraries\20.13_clk_xtu\

C++
PS F:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08
λ .\build.bat -l .\amaziot_bloom_os_sdk\sample\libraries\20.13_clk_xtu\
子目录或文件 out\bin 已经存在。
子目录或文件 build\cJSON 已经存在。
子目录或文件 build\obj 已经存在。
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\"" -Iatcmds\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\telephony\yuge\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hal\UART\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hal\core\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hal\PMU\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hal\GPIO\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\os\posix\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\diag\diag_logic\src -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\csw\SysCfg\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\csw\platform\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\env\win32\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\csw\BSP\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\csw\platform\dev_plat\build -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\os\osa\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\os\threadx\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\os\nu_xscale\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\psm\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\httpclient\src -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\diag\diag_logic\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\timer\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\intc\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\csw\PM\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\pm\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\TickManager\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\BSP\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\telephony\atcmdsrv\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\telephony\atparser\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\telephony\sdk\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\httpclient\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\ci\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\lwipv4v6\src\include -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\lwipv4v6\src\include\arch -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\lwipv4v6\src\include\ipv4 -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\lwipv4v6\src\include\ipv6 -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\lwipv4v6\src\include\lwip -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\lwipv4v6\src\include\netif -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\mmi_mat\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\tavor\Arbel\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\tavor\env\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\telephony\modem\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\duster\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\fota\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hal\I2C\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hal\ACIPC\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\fatsys\flash -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\FDI\src\INCLUDE -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hal\MMU\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\FDI\src\FDI_ADD -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\FDI\src\FM_INC -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\fatsys\fs\hdr -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\littlefs\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\tts\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\dial\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\csw_memory\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\utilities\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\commpm\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\nvm\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\EEhandler\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\EEhandler\src -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\RTC\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\telephony\ci_client\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hal\BT_device\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hal\UART\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\mrd\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\dma\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\softutil\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hal\SPI\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\websocket\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\atnet_srv\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\softutil\fotacomm\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\aud_sw\Audio\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\aud_sw\ACM_COMM\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\aud_sw\audio_stub\src -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hop\aam\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\aud_sw\AudioHAL\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\hal\dbgshell\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\include\asr160x\pcac\opencpu\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\amaziot_bloom_os_sdk\utils -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\CSDK_CODE\cJSON\inc -IF:/3.asr-b/cat.1-asr1606/1.software/BLOOM_OS_1606_OPENCPU_1191_A08/amaziot_bloom_os_sdk/sample/libraries/20.13_clk_xtu\am\inc -IF:/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\inc -IF:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08/amaziot_bloom_os_sdk/libraries\am\xtu -DDTU_BASED_ON_TCP -DDTU_TYPE_5X6 -DDTU_UART_115200_BAUD -DDTU_TYPE_DODIAI_INCLUDE -DDTU_TYPE_JSON_INCLUDE -o build\obj/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 build\obj/main.o build\obj/ext_at_cmds.o build\obj/ext_at_controller.o build\obj/am_file.o build\obj/am_at.o build\obj/am_trans.o build\obj/am_hb.o build\obj/am_di.o build\obj/am_do.o build\obj/am_ai.o build\obj/am_clock.o build\obj/am_json.o build\obj/am_socket.o build\CSDK_CODE.lib \
-o F:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\out\bin\Arbel_PMD2NONE_40M.axf \
--via F:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\prebuilt_1606l\Arbel_PMD2NONE_targ_objliblist.txt \
--elf \
--scatter F:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\prebuilt_1606l\Crane_DS_4M_Ram_2M_Flash_XIP_CIPSRAM_Common_SingleSIM.sct \
--predefine="-DLTEONLY_THIN_SINGLE_SIM" --map --symbols --info sizes,totals \
--list F:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\out\bin\Arbel_PMD2NONE_40M.map \
--keep init.o(Header) --keep init.o(Vectors) --diag_suppress 6312,6314,6319,6329 \
--feedback F:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\out\feedbackLinkOptLteonlyThin_SingleSim_NoSMS.txt
F:\3.asr-b\cat.1-asr1606\1.software\BLOOM_OS_1606_OPENCPU_1191_A08\tools\buildimage_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 |out\bin\cp_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 生成固件

参考入门中开发工具,生成工具。

4.7 查看现象

固件下载到模组后,发送CLK 配置AT指令,观察AT串口信息,超时后Debug口会出现DO1输出高的信息

触发di后,使用查看命令

Plain Text
[11-22 11:01:05:807]\0\0
[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


06

总结


根据实验现象,用户需要实现自己的AT指令,只需要参考组件中的例子,按照自己需求修改,

注:本文部分内容来源于网络,如有侵权,请及时联系我们。

本文章源自奇迹物联开源的物联网应用知识库Cellular IoT Wiki,更多技术干货欢迎关注收藏Wiki:Cellular IoT Wiki 知识库(https://rckrv97mzx.feishu.cn/wiki/wikcnBvAC9WOkEYG5CLqGwm6PHf)

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
1
关闭 站长推荐上一条 /3 下一条