![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Use LoRaWAN on mDot with IKS01A1 sensor board plugged into UDK board.
Dependencies: X_NUCLEO_IKS01A1 mbed LoRaWAN-lib SX1272Lib
Fork of LoRaWAN-demo-72 by
This project uses IKS01A1 driver library with pin definitions for mDot UDK arduino headers.
The mDot platform doesnt define arduino header pins, so they must be defined in the IKS01A1 driver library header.
Revision 6:72ea69843556, committed 2016-08-17
- Comitter:
- dudmuck
- Date:
- Wed Aug 17 23:56:43 2016 +0000
- Parent:
- 5:62862ef9480b
- Commit message:
- use LoRaWAN on mDot with IKS01A1 sensor board
Changed in this revision
diff -r 62862ef9480b -r 72ea69843556 X_NUCLEO_IKS01A1.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/X_NUCLEO_IKS01A1.lib Wed Aug 17 23:56:43 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/dudmuck/code/X_NUCLEO_IKS01A1/#b5b8e7cab622
diff -r 62862ef9480b -r 72ea69843556 app/Comissioning.h --- a/app/Comissioning.h Tue Jul 05 15:00:47 2016 +0000 +++ b/app/Comissioning.h Wed Aug 17 23:56:43 2016 +0000 @@ -29,12 +29,12 @@ /*! * IEEE Organizationally Unique Identifier ( OUI ) (big endian) */ -#define IEEE_OUI 0x11, 0x22, 0x33 +#define IEEE_OUI 0x00, 0x25, 0x0c /*! * Mote device IEEE EUI (big endian) */ -#define LORAWAN_DEVICE_EUI { IEEE_OUI, 0x44, 0x55, 0x66, 0x77, 0x88 } +#define LORAWAN_DEVICE_EUI { IEEE_OUI, 0x01, 0x00, 0x00, 0x00, 0x21 } /*! * Application IEEE EUI (big endian) @@ -44,7 +44,7 @@ /*! * AES encryption/decryption cipher application key */ -#define LORAWAN_APPLICATION_KEY { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C } +#define LORAWAN_APPLICATION_KEY { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff } /*! * Current network ID
diff -r 62862ef9480b -r 72ea69843556 app/main.cpp --- a/app/main.cpp Tue Jul 05 15:00:47 2016 +0000 +++ b/app/main.cpp Wed Aug 17 23:56:43 2016 +0000 @@ -19,17 +19,20 @@ #include "LoRaMac.h" #include "Comissioning.h" #include "SerialDisplay.h" +#include "x_nucleo_iks01a1.h" +#include "vt100.h" +extern VT100 vt; /*! * Defines the application data transmission duty cycle. 5s, value in [us]. */ -#define APP_TX_DUTYCYCLE 5000000 +#define APP_TX_DUTYCYCLE 15000000 /*! * Defines a random delay for application data transmission duty cycle. 1s, * value in [us]. */ -#define APP_TX_DUTYCYCLE_RND 1000000 +#define APP_TX_DUTYCYCLE_RND 3000000 /*! * Default datarate @@ -78,7 +81,7 @@ /*! * LoRaWAN application port */ -#define LORAWAN_APP_PORT 15 +#define LORAWAN_APP_PORT 5 //15 /*! * User application data buffer size @@ -281,6 +284,8 @@ } } +static X_NUCLEO_IKS01A1 *mems_expansion_board = X_NUCLEO_IKS01A1::Instance(); +static TempSensor *temp_sensor1 = mems_expansion_board->ht_sensor; /*! * \brief Prepares the payload of the frame */ @@ -288,6 +293,16 @@ { switch( port ) { + case 5: + unsigned int ret; + float TEMPERATURE_Value; + AppDataSize = 11; + AppData[0] = AppLedStateOn; + ret |= (!CALL_METH(temp_sensor1, GetTemperature, &TEMPERATURE_Value, 0.0f) ? 0x0 : 0x1); + vt.SetCursorPos( 43, 1 ); + vt.printf( "temp:%f", TEMPERATURE_Value ); + AppData[1] = (int)TEMPERATURE_Value * 2; + break; case 15: { AppData[0] = AppLedStateOn; @@ -778,6 +793,7 @@ { case DEVICE_STATE_INIT: { + uint8_t id2; LoRaMacPrimitives.MacMcpsConfirm = McpsConfirm; LoRaMacPrimitives.MacMcpsIndication = McpsIndication; LoRaMacPrimitives.MacMlmeConfirm = MlmeConfirm; @@ -824,7 +840,8 @@ SerialDisplayUpdatePublicNetwork( LORAWAN_PUBLIC_NETWORK ); LoRaMacDownlinkStatus.DownlinkCounter = 0; - + + CALL_METH(temp_sensor1, ReadID, &id2, 0x0); DeviceState = DEVICE_STATE_JOIN; break; }
diff -r 62862ef9480b -r 72ea69843556 board/board.h --- a/board/board.h Tue Jul 05 15:00:47 2016 +0000 +++ b/board/board.h Wed Aug 17 23:56:43 2016 +0000 @@ -21,7 +21,7 @@ #include "system/utilities.h" #include "sx1272-hal.h" -#define USE_BAND_868 +#define USE_BAND_915_HYBRID extern SX1272MB2xAS Radio;