code crashes accessing randomization code
Dependencies: LoRaWAN-SX1272-Application-24-31-9sec X_NUCLEO_IKS01A1 driver_mbed_TH02 LoRaWAN-lib-v1_0_1 SX1272Lib mbed
Fork of LoRaWAN-SX1272-Application-24-31-9sec by
Revision 8:0a3a16fd1bc8, committed 2017-11-27
- Comitter:
- billvs
- Date:
- Mon Nov 27 20:49:31 2017 +0000
- Parent:
- 7:c63508d8ff9c
- Commit message:
- crashes with autoconfig address on L073RZ
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LoRaWAN-SX1272-Application-24-31-9sec.lib Mon Nov 27 20:49:31 2017 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/Oleh_Zvonarov/code/LoRaWAN-SX1272-Application-24-31-9sec/#c63508d8ff9c
--- a/app/Comissioning.h Thu Nov 16 18:30:00 2017 +0000 +++ b/app/Comissioning.h Mon Nov 27 20:49:31 2017 +0000 @@ -40,7 +40,7 @@ * \remark In this application, if the last 4 bytes are all 0, then the 32 bit address is automatically generated using a pseudo random generator seeded with a value derived from BoardUniqueId value * If provided by user, e.g. { IEEE_OUI, 0x00, 0x00, 0x00, 0xFF, 0x01 }, then this value is used by the application */ -#define LORAWAN_DEVICE_EUI { IEEE_OUI, 0x01, 0x00, 0x00, 0x00, 0x01 } +#define LORAWAN_DEVICE_EUI { IEEE_OUI, 0x01, 0x00, 0x00, 0x00, 0x00 } /*! * Application IEEE EUI (big endian) @@ -60,7 +60,8 @@ * \remark In this application, if the value is 0, then the address is automatically generated using a pseudo random generator seeded with a value derived from BoardUniqueId value * If provided by user, e.g. 0x78563412, then this value is used by the application */ -#define LORAWAN_DEVICE_ADDRESS ( uint32_t )0x00000001 +#define LORAWAN_DEVICE_ADDRESS ( uint32_t )0x00000000 + /*! * AES encryption/decryption cipher network session key
--- a/app/LoRaDeviceStateProc.cpp Thu Nov 16 18:30:00 2017 +0000 +++ b/app/LoRaDeviceStateProc.cpp Mon Nov 27 20:49:31 2017 +0000 @@ -189,6 +189,7 @@ // Choose a random device address if not already defined in Config.h if( DevAddr == 0 ) { + printf("rand\r\n"); // Random seed initialization srand1( BoardGetRandomSeed( ) ); DevAddr = randr( 0, 0x01FFFFFF );
--- a/app/main.cpp Thu Nov 16 18:30:00 2017 +0000 +++ b/app/main.cpp Mon Nov 27 20:49:31 2017 +0000 @@ -114,10 +114,13 @@ */ int main( void ) { + printf("hello\r\n"); + // Initialize board peripherals BoardInit( ); + printf("hello2\r\n"); // Initialize Device state DeviceState = DEVICE_STATE_INIT; @@ -154,6 +157,7 @@ RxEvent( ); SerialDisplayRxUpdate( ); } + printf("devstate = 0x%x\r\n", DeviceState); switch( DeviceState ) {
--- a/board/board.cpp Thu Nov 16 18:30:00 2017 +0000 +++ b/board/board.cpp Mon Nov 27 20:49:31 2017 +0000 @@ -49,18 +49,30 @@ uint32_t BoardGetRandomSeed( void ) { + printf("rand 0x%x %x %x\r\n", ID1, ID2, ID3); + printf("*ID1 = 0x%x\r\n", *( uint32_t* ) ID1); + printf("helloxxx\r\n"); + return ( ( *( uint32_t* )ID1 ) ^ ( *( uint32_t* )ID2 ) ^ ( *( uint32_t* )ID3 ) ); } void BoardGetDevEUI( uint8_t *id ) { - uint32_t *pDevEuiHWord = ( uint32_t* )&id[4]; + printf("&id[4] = 0x%x, id[4] = %x\r\n", &id[4], id[4]); + + { + uint32_t *pDevEuiHWord = ( uint32_t* )&id[4]; + + printf("&id[4] = 0x%x, pDev = 0x%x\r\n", &id[4], pDevEuiHWord); + printf("*pDev = 0x%x\r\n",*pDevEuiHWord); - if( *pDevEuiHWord == 0 ) - { - *pDevEuiHWord = BoardGetRandomSeed( ); + if( *pDevEuiHWord == 0 ) + { + printf("preGetRandom\r\n"); + *pDevEuiHWord = BoardGetRandomSeed( ); + } } - + } void BoardGetUniqueId( uint8_t *id )