Menu

Building library with MSTP and IP included

ElmerFudge
2016-02-08
2016-02-10
  • ElmerFudge

    ElmerFudge - 2016-02-08

    Hi,

    I am tryin to build a library that can select either MSTP (RS485) or IP data link layer durning run time before the BACnet Stack starts up.

    Could you please provide me with a make file on how I can do this. I have tried enable both BACDL_MSTP and BACDL_BIP but the code would not compile. Also would I have to set BACDL_MSTP and BACDL_BIP to 1 in the config.h?

    I currently have an application using IP data link layer, I need this application to run on the MSTP or IP data link depending on my configuration file. Where can I find a example that uses device object and analog object with the MSTP data link layer.

    Thanks

     

    Last edit: ElmerFudge 2016-02-08
  • Steve Karg

    Steve Karg - 2016-02-08

    The datalink.c module does this, using the define BACDL_ALL.

    I also have gone through the code and replaced MAX_HEADER and MAX_MPDU in each datalink with BIP_HEADER_MAX and BIP_MPDU_MAX in BACnet/IP, for example, to eliminate the common defines and the compiler headaches. However, this hasn't been back ported to the public stack yet.

     
  • ElmerFudge

    ElmerFudge - 2016-02-08

    I got the library built using BACDL_ALL. But I am having some linker problems with mstptext_receive_state. I notice mstptext.c is not included under PORT_ALL_SRC in the makefile located in the lib folder. Why is this file not included?

    Also what is the difference between the dlmstp_linux.c and dlmstp.c located under the linux port? I notice the router demo uses dlmstp_linux.c but the library PORT_ALL_SRC uses dlmstp.c. Why is that?

     
  • ElmerFudge

    ElmerFudge - 2016-02-09

    Hi,

    Just an update I orginally thought the library was compiled correctly. But it wasn't. I notice the datalink.c file was not included in the make files under library. After I built the library with the C file. I have the following errors

    ../src/datalink.c:64:6: error: ‘datalink_send_pdu’ redeclared as different kind of symbol
         *datalink_send_pdu) (
          ^
    In file included from ../src/datalink.c:34:0:
    ../include/datalink.h:92:9: note: previous declaration of ‘datalink_send_pdu’ was here
         int datalink_send_pdu(
             ^
    ../src/datalink.c:70:11: error: ‘datalink_receive’ redeclared as different kind of symbol
     uint16_t(*datalink_receive) (BACNET_ADDRESS * src, uint8_t * pdu,
               ^
    In file included from ../src/datalink.c:34:0:
    ../include/datalink.h:97:21: note: previous declaration of ‘datalink_receive’ was here
         extern uint16_t datalink_receive(
                         ^
    ../src/datalink.c:77:6: error: ‘datalink_cleanup’ redeclared as different kind of symbol
         *datalink_cleanup) (
          ^
    In file included from ../src/datalink.c:34:0:
    ../include/datalink.h:102:17: note: previous declaration of ‘datalink_cleanup’ was here
         extern void datalink_cleanup(
                     ^
    ../src/datalink.c:81:6: error: ‘datalink_get_broadcast_address’ redeclared as different kind of symbol
         *datalink_get_broadcast_address) (
          ^
    In file included from ../src/datalink.c:34:0:
    ../include/datalink.h:104:17: note: previous declaration of ‘datalink_get_broadcast_address’ was here
         extern void datalink_get_broadcast_address(
                     ^
    ../src/datalink.c:85:6: error: ‘datalink_get_my_address’ redeclared as different kind of symbol
         *datalink_get_my_address) (
          ^
    In file included from ../src/datalink.c:34:0:
    ../include/datalink.h:106:17: note: previous declaration of ‘datalink_get_my_address’ was here
         extern void datalink_get_my_address(
                     ^
    ../src/datalink.c: In function ‘datalink_set’:
    ../src/datalink.c:92:25: error: ‘bip_init’ undeclared (first use in this function)
             datalink_init = bip_init;
                             ^
    ../src/datalink.c:92:25: note: each undeclared identifier is reported only once for each function it appears in
    ../src/datalink.c:93:29: error: ‘bip_send_pdu’ undeclared (first use in this function)
             datalink_send_pdu = bip_send_pdu;
                                 ^
    ../src/datalink.c:94:28: error: ‘bip_receive’ undeclared (first use in this function)
             datalink_receive = bip_receive;
                                ^
    ../src/datalink.c:95:28: error: ‘bip_cleanup’ undeclared (first use in this function)
             datalink_cleanup = bip_cleanup;
                                ^
    ../src/datalink.c:96:42: error: ‘bip_get_broadcast_address’ undeclared (first use in this function)
             datalink_get_broadcast_address = bip_get_broadcast_address;
                                              ^
    ../src/datalink.c:97:35: error: ‘bip_get_my_address’ undeclared (first use in this function)
             datalink_get_my_address = bip_get_my_address;
                                       ^
    ../src/datalink.c:99:25: error: ‘ethernet_init’ undeclared (first use in this function)
             datalink_init = ethernet_init;
                             ^
    ../src/datalink.c:100:29: error: ‘ethernet_send_pdu’ undeclared (first use in this function)
             datalink_send_pdu = ethernet_send_pdu;
                                 ^
    ../src/datalink.c:101:28: error: ‘ethernet_receive’ undeclared (first use in this function)
             datalink_receive = ethernet_receive;
                                ^
    ../src/datalink.c:102:28: error: ‘ethernet_cleanup’ undeclared (first use in this function)
             datalink_cleanup = ethernet_cleanup;
                                ^
    ../src/datalink.c:103:42: error: ‘ethernet_get_broadcast_address’ undeclared (first use in this function)
             datalink_get_broadcast_address = ethernet_get_broadcast_address;
                                              ^
    ../src/datalink.c:104:35: error: ‘ethernet_get_my_address’ undeclared (first use in this function)
             datalink_get_my_address = ethernet_get_my_address;
                                       ^
    ../src/datalink.c:106:25: error: ‘arcnet_init’ undeclared (first use in this function)
             datalink_init = arcnet_init;
                             ^
    ../src/datalink.c:107:29: error: ‘arcnet_send_pdu’ undeclared (first use in this function)
             datalink_send_pdu = arcnet_send_pdu;
                                 ^
    ../src/datalink.c:108:28: error: ‘arcnet_receive’ undeclared (first use in this function)
             datalink_receive = arcnet_receive;
                                ^
    ../src/datalink.c:109:28: error: ‘arcnet_cleanup’ undeclared (first use in this function)
             datalink_cleanup = arcnet_cleanup;
                                ^
    ../src/datalink.c:110:42: error: ‘arcnet_get_broadcast_address’ undeclared (first use in this function)
             datalink_get_broadcast_address = arcnet_get_broadcast_address;
                                              ^
    ../src/datalink.c:111:35: error: ‘arcnet_get_my_address’ undeclared (first use in this function)
             datalink_get_my_address = arcnet_get_my_address;
                                       ^
    ../src/datalink.c:113:25: error: ‘dlmstp_init’ undeclared (first use in this function)
             datalink_init = dlmstp_init;
                             ^
    ../src/datalink.c:114:29: error: ‘dlmstp_send_pdu’ undeclared (first use in this function)
             datalink_send_pdu = dlmstp_send_pdu;
                                 ^
    ../src/datalink.c:115:28: error: ‘dlmstp_receive’ undeclared (first use in this function)
             datalink_receive = dlmstp_receive;
                                ^
    ../src/datalink.c:116:28: error: ‘dlmstp_cleanup’ undeclared (first use in this function)
             datalink_cleanup = dlmstp_cleanup;
                                ^
    ../src/datalink.c:117:42: error: ‘dlmstp_get_broadcast_address’ undeclared (first use in this function)
             datalink_get_broadcast_address = dlmstp_get_broadcast_address;
                                              ^
    ../src/datalink.c:118:35: error: ‘dlmstp_get_my_address’ undeclared (first use in this function)
             datalink_get_my_address = dlmstp_get_my_address;
    
     
  • ElmerFudge

    ElmerFudge - 2016-02-09

    Update
    I got the library compile both the IP and MSTP. I had to modify the function pointers for the data link layer. The IP data link layer is working but the MTSP layer isn't,

    Currently debugging this problem. It's the same application level code with a few modifcation when using serial.

    The problem occurs when the WhoIs command is sent. Garbage is just returned. I am guessing this hassomething to do with the MAX_MPDU.

    Since I remember seeing a redifination warning durning the library build.

     
  • ElmerFudge

    ElmerFudge - 2016-02-10

    So good news. It appearsto be working now. But everytime I try to lookup all the objects a device I get the error below from the library. The objects are looked up correctly but why would a address mistach occur? Note this is over MSTP only.

    DLMSTP: DER Compare failed: BACnet Address mismatch

     

    Last edit: ElmerFudge 2016-02-10

Log in to post a comment.