1

Dependencies:   X_NUCLEO_IKS01A1 LoRaWAN-lib SX1276Lib mbed

Revision:
6:711a4e008afa
Parent:
3:4bca7f8f731a
--- a/board/board.cpp	Sun Nov 26 03:26:34 2017 +0000
+++ b/board/board.cpp	Tue Nov 28 08:20:09 2017 +0000
@@ -51,12 +51,16 @@
 
 void BoardGetDevEUI( uint8_t *id )
 {
-    uint32_t *pDevEuiHWord = ( uint32_t* )&id[4];
+    uint32_t DevEuiHWord = 0;
 
-    if( *pDevEuiHWord == 0 )
+    if( ( id[7] == 0 ) && ( id[6] == 0 ) && ( id[5] == 0 ) && ( id[4] == 0 ) )
     {        
-        *pDevEuiHWord = BoardGetRandomSeed( );
-    }
+        DevEuiHWord = BoardGetRandomSeed( );
+        id[7] = (DevEuiHWord >> 3) & 0xFF;
+        id[6] = (DevEuiHWord >> 2) & 0xFF;
+        id[5] = (DevEuiHWord >> 1) & 0xFF;
+        id[4] = (DevEuiHWord >> 0) & 0xFF;
+    }    
     
 }