Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    Compiling Errors when trying to send data over LoRa

    stsmith1975
    New Poster

    Compiling Errors when trying to send data over LoRa

     

    Hi,
     
    I'm am trying to connect an XDK110 with LoRa Extension (https://www.bosch-connectivity.com/products/cross-domain/xdk-lora-extension/buy/) to Helium LoRaWAN network. I have tried to compile a Mita project using the example code here: https://www.eclipse.org/mita/platforms/xdk110/#lora and here: https://developer.bosch.com/web/xdk/lora. I note that the example code is different in each of these sites.
     
    I have tried to create two different application.mita files using the examples provided and putting in my loraAppKey, loraAppEui and loraDeviceEui. Both versions of the code fail to compile to C code correctly. I provide my code and the errors below.
     
    It would be helpful if someone could help by providing the correct syntax for connecting the device and sending data (Cayenne LPP and raw).
     
    Thanks,
    Stephen.

    ___________________________________________________

    Application.mita file 1
     

    package main;

    import platforms.xdk110;

    setup lora: LoRa {

      region = EU;

      loraAppKey = [0xBC, 0x52, 0x7E, 0x12, 0x36, 0x97, 0xA1, 0x40, 0x7E, 0xF0, 0x59, 0x65, 0x20, 0xB5, 0x99, 0x85];

      loraAppEui = [0xC8, 0x28, 0x39, 0x34, 0x16, 0xF8, 0xC4, 0x18];

      loraDeviceEui = [0x00, 0x04, 0xA3, 0x0B, 0x00, 0xE8, 0xFB, 0x22];

      bandFrequency = 868;

      rx2Frequency = 869525;

      rx2DataRate = 0;

      dataRate = 3;

      var r = raw(0, Unconfirmed);

      var c = cayenne(1, Confirmed);

    }

    every 1 hour {

      let data = new array(1);

      data[0] = CayennePayload.Accelerometer(

        accelerometer.x_axis.read() as int16,

        accelerometer.y_axis.read() as int16,

        accelerometer.z_axis.read() as int16

      );

      lora.c.write(data);

    }

    every 10 minutes {

      let data: array = [0xCA, 0xFE];

      lora.r.write(data);

    }

    Application.mita file 1 Errors
    • at line let data = new array(1); I have error "array is a raw type. References to generic type array<T> should be parameterized"
    • at line lora.c.write(data); I have error"Multiple markers at this line - Could not infer common type for type parameter T from argument types [array, array]. - Incompatible types array and array<CayennePayload>.
    • at line  let data: array = [0xCA, 0xFE]; I have error "Multiple markers at this line - array is a raw type. References to generic type array<T> should be parameterized. - Assignment operator '=' may only be applied on compatible types, not on array and array."

    • at line lora.r.write(data); I have error "Multiple markers at this line - Incompatible types array and array<uint8>. - Could not infer common type for type parameter T from argument types [array, array]. - Cannot assign a value of type array<integer> to a variable of type array."

     __________________________________________________
     
    Application.mita file 2
     
    package main;

    import platforms.xdk110;

    setup lora: LoRa {

      region = EU;

      loraAppKey = [0xBC, 0x52, 0x7E, 0x12, 0x36, 0x97, 0xA1, 0x40, 0x7E, 0xF0, 0x59, 0x65, 0x20, 0xB5, 0x99, 0x85];

      loraAppEui = [0xC8, 0x28, 0x39, 0x34, 0x16, 0xF8, 0xC4, 0x18];

      loraDeviceEui = [0x00, 0x04, 0xA3, 0x0B, 0x00, 0xE8, 0xFB, 0x22];

      var r = raw(0, Unconfirmed);

      var c = cayenne(1, Confirmed);

    }

    every 1 hour {

      let data: array<CayennePayload, 1>;

      data[0] = CayennePayload.Accelerometer(

        accelerometer.x_axis.read() as int16, 

        accelerometer.y_axis.read() as int16, 

        accelerometer.z_axis.read() as int16

      );

      lora.c.write(data);

    }

    every 10 minutes {

      let data: array<uint8, _> = [0xCA, 0xFE];

      lora.r.write(data);

    }

    Application.mita file 2 Errors
    • at line let data: array<CayennePayload, 1>; I have error "mismatched input '1' expecting RULE_ID"
    • at line let data: array<uint8, _> = [0xCA, 0xFE]; I have error "Multiple markers at this line - Couldn't resolve reference to Type '_'.- Incorrect number of arguments for type array<T>; it cannot be parameterized with arguments <uint8, >."
     
     
    3 REPLIES 3
    mkpraveen
    Member

    Re: Compiling Errors when trying to send data over LoRa

    Hi Stephen,

    The reason for compile error is array declaration syntex is changed somewhat and it is not as documeted in eclipe or bosch website.

    Please use these following declaration

    1. at line let data: array<CayennePayload, 1>;  use as let data = new array<CayennePayload>(size = 1);

    2. at line let data: array<uint8, _> = [0xCA, 0xFE]; use as let data : array<uint8> = [0xCA, 0xFE];

    This will solve the compile issue on both application files that you shared as the issue is same.

     

    stsmith1975
    New Poster

    Re: Compiling Errors when trying to send data over LoRa

    Hi,

    Thanks for your reply. This has solved the compiling issue but I still cannot connect the device over LoRa. Please see responses from XDK Console below line.

    Could it be that I have a problem with the AppKey, AppEui or DeviceEui? To confirm how I am doing this:

    - To get the LoraDeviceEui I previously flashed the demo project called LoRaThingsNetworkDemo (following instructions here: https://developer.bosch.com/web/xdk/lora1). This provides a Hardware DevEui in the XDK Console which I am then using as the DeviceEui. I am however using the msb format (i.e. where XDK Console shows the Hardware DevEui  as 000x.... I am setting DeviceEui as [ 0x00, 0x04, .......] )

    - To get the AppKey and AppEui I have created a Device in the console.helium.com console and I am using the App Eui and App Key values provided. I have tried to use them in msb and lsb formats.

    Please can you provide further support to help resolve this issue.

    Thanks,

    Stephen.

    ______________________________________________

     

    INFO | Application checksum '63f' successfully verified.

    INFO | Transmission successfully completed!

    INFO | Booting application...

    INFO | XDK DEVICE 1:  Jumping to application

    INFO | Port '/dev/tty.usbmodem14201' has been disconnected

    INFO | Connecting to XDK device 'XDK Device 1' in port '/dev/tty.usbmodem14201'...

    INFO | Connection to port '/dev/tty.usbmodem14201' established

    INFO | XDK DEVICE 1: [INFO, /Users/Smudger/XDK-Workspace/EclipseMitaApplication/src-gen/base/ConnectivityLoRaLora.c:160] device init LoRa succeeded

    INFO | XDK DEVICE 1: [INFO, /Users/Smudger/XDK-Workspace/EclipseMitaApplication/src-gen/base/ConnectivityLoRaLora.c:170] set rx window LoRa succeeded

    INFO | XDK DEVICE 1: [INFO, /Users/Smudger/XDK-Workspace/EclipseMitaApplication/src-gen/base/ConnectivityLoRaLora.c:185] set device eui LoRa succeeded: 22fbe8000ba30400

    INFO | XDK DEVICE 1: [INFO, /Users/Smudger/XDK-Workspace/EclipseMitaApplication/src-gen/base/ConnectivityLoRaLora.c:195] set app eui LoRa succeeded

    INFO | XDK DEVICE 1: [INFO, /Users/Smudger/XDK-Workspace/EclipseMitaApplication/src-gen/base/ConnectivityLoRaLora.c:205] set app key LoRa succeeded

    INFO | XDK DEVICE 1: [INFO, /Users/Smudger/XDK-Workspace/EclipseMitaApplication/src-gen/base/ConnectivityLoRaLora.c:216] set radio coding rate LoRa succeeded

    INFO | XDK DEVICE 1: [INFO, /Users/Smudger/XDK-Workspace/EclipseMitaApplication/src-gen/base/ConnectivityLoRaLora.c:227] set adaptive data rate LoRa succeeded

    INFO | XDK DEVICE 1: [INFO, /Users/Smudger/XDK-Workspace/EclipseMitaApplication/src-gen/base/ConnectivityLoRaLora.c:238] save config LoRa succeeded

    INFO | XDK DEVICE 1: Lora Network join timeout/failure: 2

    INFO | XDK DEVICE 1: [ERROR, /Users/Smudger/XDK-Workspace/EclipseMitaApplication/src-gen/base/ConnectivityLoRaLora.c:253] failed to join network LoRa

    INFO | XDK DEVICE 1: Error in XDK110 Application package.

    INFO | XDK DEVICE 1: Package ID: 153

    INFO | XDK DEVICE 1: Module ID: 0

    INFO | XDK DEVICE 1: Severity code: 2

    INFO | XDK DEVICE 1: Error code: 116

    INFO | XDK DEVICE 1: [ERROR, /Users/Smudger/XDK-Workspace/EclipseMitaApplication/src-gen/main.c:150] failed to enable ConnectivityLoRaLora

    mkpraveen
    Member

    Re: Compiling Errors when trying to send data over LoRa

    Hi Stephen,

    Sorry for delyed response.

    You mention in MITA app only Lora App key and App EUI in msb formats and Device EUI is not required. I do not see any issue with these configuration by looking the output.

    The lora join failure is becuase of Gateway connectivity issue. please ensure your gateway connection properly as the source code is working when I tested with my gateway setup. Please fine the snapshot of the result

    Lora-join-success.PNG

    mita source code.PNG

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist