物联网中RTU的DO是什么?如何实现DO相关软件功能?

电子说

1.3w人已加入

描述

一 概述

DO 即数字输出(DO, Digital Output),用于输出二进制信号,可以控制继电器、灯光、电机启停等。数字输出同样只能有两种状态:高电平或低电平。

二 相关技术描述

远程或本地事件触发执行开、关、脉冲等操作

输出状态断电记忆保存

断电记忆功能(Power-off Memory Function)是一种电子设备或系统在断电后能够保留其运行状态或数据的功能。这种功能通常用于计算机、服务器、工业控制设备等需要长时间运行和稳定性的场合。

当设备或系统断电时,内存中的数据会被保存在临时存储器中,如RAM(随机存取存储器)。当电源恢复后,设备或系统将恢复到断电前的状态,继续执行未完成的操作或显示断电前的数据。这样,用户可以在断电期间不受干扰地工作或处理数据,而无需担心数据丢失或设备损坏。

集电极开路输出

物联网

集电极开路输出的结构如图1所示,右边的那个三极管集电极什么都不接,所以叫做集电极开路;左边的三极管为反相之用,使输入为“0”时,输出也为“0”。对于图 1,当左端的输入为“0”时,前面的三极管截止,所以5v电源通过1k电阻加到右边的三极管上,右边的三极管导通;当左端的输入为“1”时,前面的三极管导通,而后面的三极管截止。

我们将图1简化成图2的样子,很明显可以看出,当开关闭合时,输出直接接地,所以输出电平为0。而当开关断开时,则输出端悬空了,即高阻态。这时电平状态未知,如果后面一个电阻负载到地,那么输出端的电平就被这个负载拉到低电平了,所以这个电路是不能输出高电平的。

图3中那个1k的电阻即是上拉电阻。如果开关闭合,则有电流从1k电阻及开关上流过,但由于开关闭和时电阻为0(方便我们的讨论,实际情况中开关电阻不为0,另外对于三极管还存在饱和压降),所以在开关上的电压为0,即输出电平为0。如果开关断开,则由于开关电阻为无穷大(同上,不考虑实际中的漏电流),所以流过的电流为0,因此在1k电阻上的压降也为0,所以输出端的电压就是5v了,这样就能输出高电平了。

但是这个输出的内阻是比较大的 —— 即1k,如果接一个电阻为r的负载,通过分压计算,就可以算得最后的输出电压为5*r/(r+1000)伏,所以,如果要达到一定的电压的话,r就不能太小。如果r真的太小,而导致输出电压不够的话,那我们只有通过减小那个1k的上拉电阻来增加驱动能力。

但是,上拉电阻又不能取得太小,因为当开关闭合时,将产生电流,由于开关能流过的电流是有限的,因此限制了上拉电阻的取值。另外还需要考虑到,当输出低电平时,负载可能还会给提供一部分电流从开关流过,因此要综合这些电流考虑来选择合适的上拉电阻。

如果我们将一个读数据用的输入端接在输出端,这样就是一个IO口了,51的IO口就是这样的结构,其中P0口内部不带上拉,而其它三个口带内部上拉。当我们要使用输入功能时,只要将输出口设置为1即可,这样就相当于那个开关断开,而对于P0口来说,就是高阻态了。

输出驱动电压=设备供电压

输出驱动电流≤500mA

三 应用场景

3.1 水泵

云端通过控制DO输出高低电平,来控制外围电路,进而控制水泵的启停。

物联网

3.2 风扇

同理,云端通过控制DO输出高低电平,来控制外围电路,进而控制风扇的启停。

物联网

3.3 报警灯

结合DTU的DI功能,如果检测到了DI异常信号输入,DTU可以控制连接DO的报警灯报警。

物联网

四 DO组件的使用

1 Gitee链接地址

组件位于amaziot_bloom_os_sdklibrariesamxtuam_do.c

Gitee源码地址:https://gitee.com/ning./hongdou

Github源码地址:https://github.com/ayumid/hongdou

2 应用层组件功能介绍

提供DO实现实例。

使用该组件,必须同时使用AT组件,文件组件,TCP组件,掉线组件,掉线重连组件,DI组件,DO组件,AI组件,JSON组件,CLK组件。

3 代码讲解

1 dtu_do1_report_timer_callback

DO1周期上报定时器回调函数。定时器超时后进入本函数,如果在透传模式,配置消息结构体变量,发送消息给JSON主任务,主任务将协议内容发送到服务器

 

/**
  * Function    : dtu_do1_report_timer_callback
  * Description : 主动上报定时器超时回调函数,发送消息给主任务,由主任务上报信息到服务器
  * 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");

    //判断是否是在透传模式
    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);
        //发送消息给json主任务
        dtu_json_task_send_msgq(&do_send_msg);
    }
}

 

2 dtu_do1_report_timer_start

主动上报定时器启动,周期性打开定时器

 

/**
  * Function    : dtu_do1_report_timer_start
  * Description : 主动上报定时器启动
  * 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);
    //开启定时器
    OSATimerStart(dtu_do1_report_timer_ref, uc_time * 200, uc_time * 200, dtu_do1_report_timer_callback, 0);
}

 

3 dtu_do1_report_timer_stop

主动上报定时器停止

 

/**
  * Function    : dtu_do1_report_timer_stop
  * Description : 主动上报定时器停止
  * Input       : 
  *               
  * Output      : 
  * Return      : 
  * Auther      : zhaoning
  * Others      : 
  **/
void dtu_do1_report_timer_stop(void)
{
    //关闭定时器
    OSATimerStop(dtu_do1_report_timer_ref);
}

 

4 dtu_do_init_do

根据NV项,判断是否需要开启do上报

 

/**
  * Function    : dtu_do_init_do
  * Description : 根据NV项,判断是否需要开启do上报
  * Input       : 
  *               
  * Output      : 
  * Return      : 
  * Auther      : zhaoning
  * Others      : 
  **/
void dtu_do_init_do(char* channel, DTU_DO* doo)
{
    if(strcmp((const char*)channel, "DO1") == 0)
    {
        //如果主动上报
        if(DTU_DO_REPORT_INITIATIVE == doo- >do_type)
        {
            //启动主动上报定时器
            dtu_do1_report_timer_start(doo- >do_interval);
        }
        else if(DTU_DO_REPORT_NONE == doo- >do_type)
        {
            //关闭主动上报定时器
            OSATimerStop(dtu_do1_report_timer_ref);
        }
    }
    else if(strcmp((const char*)channel, "DO2") == 0)
    {
        //如果主动上报
        if(DTU_DO_REPORT_INITIATIVE == doo- >do_type)
        {
            //启动主动上报定时器
            dtu_do2_report_timer_start(doo- >do_interval);
        }
        else if(DTU_DO_REPORT_NONE == doo- >do_type)
        {
            //关闭主动上报定时器
            OSATimerStop(dtu_do2_report_timer_ref);
        }
    }
    else if(strcmp((const char*)channel, "DO3") == 0)
    {
        //如果主动上报
        if(DTU_DO_REPORT_INITIATIVE == doo- >do_type)
        {
            //启动主动上报定时器
            dtu_do3_report_timer_start(doo- >do_interval);
        }
        else if(DTU_DO_REPORT_NONE == doo- >do_type)
        {
            //关闭主动上报定时器
            OSATimerStop(dtu_do3_report_timer_ref);
        }
    }
    else if(strcmp((const char*)channel, "DO4") == 0)
    {
        //如果主动上报
        if(DTU_DO_REPORT_INITIATIVE == doo- >do_type)
        {
            //启动主动上报定时器
            dtu_do4_report_timer_start(doo- >do_interval);
        }
        else if(DTU_DO_REPORT_NONE == doo- >do_type)
        {
            //关闭主动上报定时器
            OSATimerStop(dtu_do4_report_timer_ref);
        }
    }
    else if(strcmp((const char*)channel, "DO5") == 0)
    {
        //如果主动上报
        if(DTU_DO_REPORT_INITIATIVE == doo- >do_type)
        {
            //启动主动上报定时器
            dtu_do5_report_timer_start(doo- >do_interval);
        }
        else if(DTU_DO_REPORT_NONE == doo- >do_type)
        {
            //关闭主动上报定时器
            OSATimerStop(dtu_do5_report_timer_ref);
        }
    }

//    if(0 == doo- >do_time)
//    {
//        if(strcmp((const char*)channel, "DO1") == 0)
//        {
//            //关闭输出保持定时器
//            OSATimerStop(dtu_do1_timer_ref);
//        }
//        if(strcmp((const char*)channel, "DO2") == 0)
//        {
//            //关闭输出保持定时器
//            OSATimerStop(dtu_do2_timer_ref);
//        }
//        if(strcmp((const char*)channel, "DO3") == 0)
//        {
//            //关闭输出保持定时器
//            OSATimerStop(dtu_do3_timer_ref);
//        }
//        if(strcmp((const char*)channel, "DO4") == 0)
//        {
//            //关闭输出保持定时器
//            OSATimerStop(dtu_do4_timer_ref);
//        }
//        if(strcmp((const char*)channel, "DO5") == 0)
//        {
//            //关闭输出保持定时器
//            OSATimerStop(dtu_do5_timer_ref);
//        }
//    }
//    //如果输出保持时间不为0,而且当前是输出高电平
//    else if(DTU_GPIO_HIGH == GpioGetLevel(DTU_GPIO_DO_PIN1) && 0 != doo- >do_time)
//    {
//        if(strcmp((const char*)channel, "DO1") == 0)
//        {
//            //启动输出保持定时器
//            dtu_do1_timer_start(DTU_DO_TIME, doo- >do_time);
//        }
//        if(strcmp((const char*)channel, "DO2") == 0)
//        {
//            //启动输出保持定时器
//            dtu_do1_timer_start(DTU_DO_TIME, doo- >do_time);
//        }
//        if(strcmp((const char*)channel, "DO3") == 0)
//        {
//            //启动输出保持定时器
//            dtu_do1_timer_start(DTU_DO_TIME, doo- >do_time);
//        }
//        if(strcmp((const char*)channel, "DO4") == 0)
//        {
//            //启动输出保持定时器
//            dtu_do1_timer_start(DTU_DO_TIME, doo- >do_time);
//        }
//        if(strcmp((const char*)channel, "DO5") == 0)
//        {
//            //启动输出保持定时器
//            dtu_do1_timer_start(DTU_DO_TIME, doo- >do_time);
//        }
//    }

//    //如果输出保持时间没有配置,配置定时翻转
//    if(0 == doo- >do_time && 0 != doo- >do_flip)
//    {
//        if(strcmp((const char*)channel, "DO1") == 0)
//        {
//            //启动定时翻转定时器
//            dtu_do1_timer_start(DTU_DO_FLIP, doo- >do_flip);
//        }
//        if(strcmp((const char*)channel, "DO2") == 0)
//        {
//            //启动定时翻转定时器
//            dtu_do1_timer_start(DTU_DO_FLIP, doo- >do_flip);
//        }
//        if(strcmp((const char*)channel, "DO3") == 0)
//        {
//            //启动定时翻转定时器
//            dtu_do1_timer_start(DTU_DO_FLIP, doo- >do_flip);
//        }
//        if(strcmp((const char*)channel, "DO4") == 0)
//        {
//            //启动定时翻转定时器
//            dtu_do1_timer_start(DTU_DO_FLIP, doo- >do_flip);
//        }
//        if(strcmp((const char*)channel, "DO5") == 0)
//        {
//            //启动定时翻转定时器
//            dtu_do1_timer_start(DTU_DO_FLIP, doo- >do_flip);
//        }
//    }

}

 

5 dtu_do_init

DO初始化,根据NV项初始化DO输出电平,初始化上报状态

 

/**
  * 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);

    //初始化就停止定时器
    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状态
    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上报状态
    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电平状态,并返回状态值

 

/**
  * 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电平状态

 

/**
  * Function    : dtu_do_write_pin_1
  * Description : 写do1
  * Input       : status        电平,1设置高电平,0设置低电平
  *               
  * 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;
        //如果输出保持时间不为0,而且当前是输出高电平
//        if(DTU_GPIO_HIGH == status && 0 != dtu_file_ctx- >doo.do1.do_time)
//        {
//            //启动输出保持定时器
//            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;
        //如果输出保持时间不为0,而且当前是输出高电平
//        if(DTU_GPIO_HIGH == status && 0 != dtu_file_ctx- >doo.do2.do_time)
//        {
//            //启动输出保持定时器
//            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;
        //如果输出保持时间不为0,而且当前是输出高电平
//        if(DTU_GPIO_HIGH == status && 0 != dtu_file_ctx- >doo.do3.do_time)
//        {
//            //启动输出保持定时器
//            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;
        //如果输出保持时间不为0,而且当前是输出高电平
//        if(DTU_GPIO_HIGH == status && 0 != dtu_file_ctx- >doo.do4.do_time)
//        {
//            //启动输出保持定时器
//            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;
        //如果输出保持时间不为0,而且当前是输出高电平
//        if(DTU_GPIO_HIGH == status && 0 != dtu_file_ctx- >doo.do5.do_time)
//        {
//            //启动输出保持定时器
//            dtu_do5_timer_start(DTU_DO_TIME, dtu_file_ctx- >doo.do5.do_time);
//        }
    }
}

 

8 dtu_do_clk_timeout_write_pin

闹钟超时后,写对应闹钟配置的DO电平

 

/**
  * Function    : dtu_do_clk_timeout_write_pin
  * Description : 闹钟超时后,写对应闹钟配置的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上报定时器句柄初始化

 

/**
  * Function    : dtu_do_times_init
  * Description : 初始化所有定时器句柄
  * 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实战

4.1 创建一个Demo

复制20.9_di_xtu示例工程,到同一个文件夹下,修改文件名为20.10_do_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_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 已经存在。
子目录或文件 buildcJSON 已经存在。
子目录或文件 buildobj 已经存在。
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 ./ "

已复制         1 个文件。

 

4.6 生成固件

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

4.7 查看现象

固件下载到模组后,发送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 总结

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

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

欢迎同学们走进AmazIOT知识库的世界!

这里是为物联网人构建的技术应用百科,以便帮助你更快更简单的开发物联网产品。

Cellular IoT Wiki初心:

在我们长期投身于蜂窝物联网 ODM/OEM 解决方案的实践过程中,一直被物联网技术碎片化与产业资源碎片化的问题所困扰。从产品定义、芯片选型,到软硬件研发和测试,物联网技术的碎片化以及产业资源的碎片化,始终对团队的产品开发交付质量和效率形成制约。为了减少因物联网碎片化而带来的重复开发工作,我们着手对物联网开发中高频应用的技术知识进行沉淀管理,并基于 Bloom OS 搭建了不同平台的 RTOS 应用生态。后来我们发现,很多物联网产品开发团队都面临着相似的困扰,于是,我们决定向全体物联网行业开发者开放奇迹物联内部沉淀的应用技术知识库 Wiki,期望能为更多物联网产品开发者减轻一些重复造轮子的负担。

Cellular IoT Wiki沉淀的技术内容方向如下:

物联网

奇迹物联的业务服务范围:基于自研的NB-IoT、Cat1、Cat4等物联网模组,为客户物联网ODM/OEM解决方案服务。我们的研发技术中心在石家庄,PCBA生产基地分布在深圳、石家庄、北京三个工厂,满足不同区域&不同量产规模&不同产品开发阶段的生产制造任务。跟传统PCBA工厂最大的区别是我们只服务物联网行业客户。

连接我们,和10000+物联网开发者一起 降低技术和成本门槛

让蜂窝物联网应用更简单~~

哈哈你终于滑到最重要的模块了,

千万不!要!划!走!忍住冲动!~

欢迎加入飞书“开源技术交流群”,随时找到我们哦~

点击链接如何加入奇迹物联技术话题群(https://rckrv97mzx.feishu.cn/docx/Xskpd1cFQo7hu9x5EuicbsjTnTf)可以获取加入技术话题群攻略

Hey 物联网从业者,

你是否有了解过奇迹物联的官方公众号“eSIM物联工场”呢?

这里是奇迹物联的物联网应用技术开源wiki主阵地,欢迎关注公众号,不迷路~

及时获得最新物联网应用技术沉淀发布

(如有侵权,联系删除)

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分