BG96_K6xF_pelion-example-frdm_Temp

Dependencies:   FXAS21002 FXOS8700Q

Overview

This document is based on https://os.mbed.com/teams/NXP/code/pelion-example-frdm/ and the code forked Daniel_Lee's(https://os.mbed.com/users/Daniel_Lee/code/BG96_K6xF_pelion-example-frdm/)BG96_K6xF_pelion-example-frdm repository and added some features. Need a WIZnet IoT Shield BG96 board and development board.

This example is known to work great on the following platforms:

/media/uploads/stkim92/pel01.png

Requirement

  1. FRDM-K64F or FRDM-K66F
  2. WIZnet IoT Shield BG96 board
  3. USIM card

Example functionality

This example showcases the following device functionality:

Read onboard FXOS8700Q accelerometer, magnetometer and temperature(on shield). And report the values as Pelion LWM2M resources (see image below). (FRDM-K66F only) Read onboard FXAS21002 gyroscope and report the values as Pelion LWM2M resources. On user button click, increment Pelion LWM2M button resource. Allow the user to change the state of the board LED from Pelion LWM2M led_state resource and PUT request.

1. Import into Compiler

/media/uploads/stkim92/pel1.png

2. Apply Update Certificate

/media/uploads/stkim92/pel03.png

3. Compile and Program

/media/uploads/stkim92/pel04.png

4. If successfully connect to cellular networks(SKTelecom) then you can get below message

Device's Result

include the mbed library with this snippet

You can hold the user button during boot to format the storage and change the device identity.

M2Mnet(BG96) Power ON



Sensors configuration:

FXOS8700Q accelerometer = 0xC7

FXOS8700Q magnetometer  = 0xC7



Connecting to the network using the default network interface...

Connected to the network successfully. IP address: 2001:2D8:65

Initializing Pelion Device Management Client...

Initialized Pelion Device Management Client. Registering...

Press the user button to increment the LwM2M resource value...

Celsius temp : 26.10 C                                                             

FXOS8700Q mag:    0.217 x,   0.420 y,   0.288 z [gauss]     

Pelion Cloud Result (1)

/media/uploads/stkim92/pel4.png

Pelion Cloud Result (2)

/media/uploads/stkim92/pel5.png

update_default_resources.c

Committer:
stkim92
Date:
2019-08-06
Revision:
14:bd420de18a97
Parent:
0:a9d53048f0b6

File content as of revision 14:bd420de18a97:


#ifdef MBED_CLOUD_CLIENT_USER_CONFIG_FILE
#include MBED_CLOUD_CLIENT_USER_CONFIG_FILE
#endif

#include <stdint.h>

#ifdef MBED_CLOUD_DEV_UPDATE_ID
const uint8_t arm_uc_vendor_id[] = {
    0x8b, 0x9c, 0x29, 0x91, 0xfc, 0xf8, 0x55, 0x8a, 0xa5, 0x30, 0x1d, 0xd4, 0x05, 0xb4, 0x83, 0xb9
};
const uint16_t arm_uc_vendor_id_size = sizeof(arm_uc_vendor_id);

const uint8_t arm_uc_class_id[]  = {
    0x95, 0x9e, 0xdf, 0x33, 0xe0, 0x68, 0x55, 0xc2, 0x80, 0x7f, 0xb1, 0x6b, 0xa9, 0x8d, 0x29, 0x6a
};
const uint16_t arm_uc_class_id_size = sizeof(arm_uc_class_id);
#endif

#ifdef MBED_CLOUD_DEV_UPDATE_CERT
const uint8_t arm_uc_default_fingerprint[] =  {
    0x84, 0x89, 0x24, 0xfd, 0xff, 0x10, 0xea, 0x83, 0x7e, 0xff, 0x30, 0xcf, 0xe2, 0xd8, 0xa3, 0x68,
    0xe2, 0x4c, 0x3e, 0x88, 0xd0, 0xf9, 0x77, 0x3d, 0x8e, 0x70, 0xf9, 0x63, 0x10, 0x01, 0x94, 0x08
};
const uint16_t arm_uc_default_fingerprint_size =
    sizeof(arm_uc_default_fingerprint);

const uint8_t arm_uc_default_subject_key_identifier[] =  {
};
const uint16_t arm_uc_default_subject_key_identifier_size =
    sizeof(arm_uc_default_subject_key_identifier);

const uint8_t arm_uc_default_certificate[] = {
    0x30, 0x82, 0x01, 0x4c, 0x30, 0x81, 0xf4, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x68, 0xce,
    0xff, 0x25, 0x09, 0xe4, 0x72, 0xeb, 0x9f, 0x1e, 0xa9, 0x0b, 0xeb, 0xcd, 0xef, 0x0c, 0x31, 0x42,
    0xf8, 0xc3, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x14,
    0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
    0x68, 0x6f, 0x73, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, 0x30, 0x37, 0x33, 0x31, 0x30, 0x33,
    0x34, 0x37, 0x30, 0x31, 0x5a, 0x17, 0x0d, 0x32, 0x30, 0x30, 0x37, 0x33, 0x30, 0x31, 0x35, 0x30,
    0x30, 0x30, 0x30, 0x5a, 0x30, 0x14, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
    0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07,
    0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01,
    0x07, 0x03, 0x42, 0x00, 0x04, 0x9f, 0x86, 0x63, 0x51, 0x9e, 0x78, 0x23, 0x69, 0xa2, 0xdf, 0x80,
    0x2f, 0x8b, 0x11, 0xee, 0x03, 0x37, 0xef, 0x5e, 0xee, 0xf6, 0x60, 0x96, 0xb3, 0xed, 0xcf, 0xf7,
    0x14, 0xb4, 0x4c, 0x4d, 0xff, 0x2c, 0x1d, 0xc6, 0xbd, 0xbd, 0xec, 0x01, 0x35, 0x15, 0x4e, 0x36,
    0x34, 0xe9, 0x03, 0x11, 0x77, 0x98, 0x6c, 0x02, 0x11, 0xfd, 0x20, 0x11, 0x79, 0x2b, 0x09, 0xc4,
    0x07, 0x9d, 0x50, 0x09, 0x57, 0xa3, 0x24, 0x30, 0x22, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f,
    0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x04, 0x0c, 0x30,
    0x0a, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, 0x30, 0x0a, 0x06, 0x08, 0x2a,
    0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47, 0x00, 0x30, 0x44, 0x02, 0x20, 0x73, 0x10,
    0x3c, 0x80, 0x7f, 0xd2, 0x04, 0x37, 0x66, 0x09, 0x00, 0xba, 0x71, 0xae, 0xc6, 0x6f, 0x9b, 0xbf,
    0x12, 0x0f, 0xb1, 0xc6, 0x0d, 0xf0, 0x5c, 0x53, 0x59, 0x11, 0x77, 0x52, 0xf6, 0x4a, 0x02, 0x20,
    0xd8, 0xfb, 0x0c, 0x8e, 0x83, 0xb3, 0xbc, 0x16, 0x37, 0x69, 0x92, 0x05, 0xa5, 0x70, 0x2a, 0x57,
    0x06, 0x30, 0x2b, 0xb5, 0xfd, 0xb3, 0xaf, 0x70, 0xe9, 0x77, 0x6a, 0xf1, 0xaf, 0x93, 0x3e, 0x02
};
const uint16_t arm_uc_default_certificate_size = sizeof(arm_uc_default_certificate);
#endif


#ifdef MBED_CLOUD_DEV_UPDATE_PSK
const uint8_t arm_uc_default_psk[] = {

};
const uint8_t arm_uc_default_psk_size = sizeof(arm_uc_default_psk);
const uint16_t arm_uc_default_psk_bits = sizeof(arm_uc_default_psk)*8;

const uint8_t arm_uc_default_psk_id[] = {

};
const uint8_t arm_uc_default_psk_id_size = sizeof(arm_uc_default_psk_id);
#endif