Menu

Slave frequently disconnected from Master (BACnet-STMF429)

2016-02-22
2016-03-02
  • Paramasivan S

    Paramasivan S - 2016-02-22

    Hi ,
    I am a new bee to BACnet. I have used the latest BACnet stack and ported into STMF429 library. It works fine,my slave board comunnicating well with my master and displays the object values newly created by me. When i have added this Bacnet task into my exsiting project, it frequetly disconnected and object values couldn't read from my master, when a master polled these objects again it will found and displays the value. Hope this the timing issue to call my bacnet task.

    Please advice me, Is it possible to change the timings? or What is the maximun delay to call the BACnet task.?

     
  • Steve Karg

    Steve Karg - 2016-02-24

    The dlmstp_task() is expected to be called about every 1 to 5 milliseconds, not to exceed 5 milliseconds between calls. If your main loop includes delays that makes the time between dlmstp_task() calls exceed 5 milliseconds, then the dlmstp_task() will not function correctly.

     
    • Paramasivan S

      Paramasivan S - 2016-03-02

      Hi Steve,
      Thanks, sorry for the late reply. Yes, this issue is soved when i called dlmstp_task() in 1 msec interval. I have tried upto 5 msec, but it works only at 1 msec interval.

      One more question, my analog value and binary value object shows as a read only object at Master device. How can i turn into Read and writeable object?

      Is there any special interrupt will occur when a write command initiate by master. Please advice me how to handle the write operation from master device. Thanks in advance.

       
  • Steve Karg

    Steve Karg - 2016-03-02

    Verify that there is a WriteProperty handler callback:

        apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
            handler_write_property);
    

    Verify that each object has their WriteProperty handler in the device object call table (see demo/object/device.c for more examples):

    static struct my_object_functions {
        BACNET_OBJECT_TYPE Object_Type;
        object_init_function Object_Init;
        object_count_function Object_Count;
        object_index_to_instance_function Object_Index_To_Instance;
        object_valid_instance_function Object_Valid_Instance;
        object_name_function Object_Name;
        read_property_function Object_Read_Property;
        write_property_function Object_Write_Property;
        rpm_property_lists_function Object_RPM_List;
    } Object_Table[] = {
        {
        {OBJECT_DEVICE,
                NULL /* Init - don't init Device or it will recourse! */ ,
                Device_Count,
                Device_Index_To_Instance,
                Device_Valid_Object_Instance_Number,
                Device_Object_Name,
                Device_Read_Property_Local,
                Device_Write_Property_Local,
                Device_Property_Lists}, {
        {OBJECT_ANALOG_VALUE,
                Analog_Value_Init,
                Analog_Value_Count,
                Analog_Value_Index_To_Instance,
                Analog_Value_Valid_Instance,
                Analog_Value_Object_Name,
                Analog_Value_Read_Property,
                Analog_Value_Write_Property,
                Analog_Value_Property_Lists},
        {OBJECT_BINARY_VALUE,
                Binary_Value_Init,
                Binary_Value_Count,
                Binary_Value_Index_To_Instance,
                Binary_Value_Valid_Instance,
                Binary_Value_Object_Name,
                Binary_Value_Read_Property,
                Binary_Value_Write_Property,
                Binary_Value_Property_Lists},
        MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
    };
    

    Verify that that each object's WriteProperty handler does something useful for each property that is writable:

    /* returns true if successful */
    bool Analog_Value_Write_Property(
        BACNET_WRITE_PROPERTY_DATA * wp_data)
    {
    ...
        switch (wp_data->object_property) {
            case PROP_PRESENT_VALUE:
                if (value.tag == BACNET_APPLICATION_TAG_REAL) {
                    /* Command priority 6 is reserved for use by Minimum On/Off
                       algorithm and may not be used for other purposes in any
                       object. */
                    if (Analog_Value_Present_Value_Set(wp_data->object_instance,
                            value.type.Real, wp_data->priority)) {
                        status = true;
                    } else if (wp_data->priority == 6) {
                        /* Command priority 6 is reserved for use by Minimum On/Off
                           algorithm and may not be used for other purposes in any
                           object. */
                        wp_data->error_class = ERROR_CLASS_PROPERTY;
                        wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
                    } else {
                        wp_data->error_class = ERROR_CLASS_PROPERTY;
                        wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
                    }
                } else {
                    status = false;
                    wp_data->error_class = ERROR_CLASS_PROPERTY;
                    wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
                }
                break;
    ...
            default:
                wp_data->error_class = ERROR_CLASS_PROPERTY;
                wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
                break;
        }
    
        return status;
    }
    

    Master Nodes of BACnet MS/TP are in the datalink layer and "Master" only defines which nodes are able to discover their neighbors. WriteProperty is in the Application and can occur with any of the datalink layers including BACnet/IP which doesn't have a concept of Master Node. BACnet devices can be both client and server, or simply client or simply server.

     

Log in to post a comment.