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

Committer:
stkim92
Date:
Tue Aug 06 14:38:56 2019 +0000
Revision:
14:bd420de18a97
Parent:
0:a9d53048f0b6
Add MbedCloudClientResource_temperature

Who changed what in which revision?

UserRevisionLine numberNew contents of line
stkim92 14:bd420de18a97 1
screamer 0:a9d53048f0b6 2 #ifdef MBED_CLOUD_CLIENT_USER_CONFIG_FILE
screamer 0:a9d53048f0b6 3 #include MBED_CLOUD_CLIENT_USER_CONFIG_FILE
screamer 0:a9d53048f0b6 4 #endif
stkim92 14:bd420de18a97 5
screamer 0:a9d53048f0b6 6 #include <stdint.h>
stkim92 14:bd420de18a97 7
screamer 0:a9d53048f0b6 8 #ifdef MBED_CLOUD_DEV_UPDATE_ID
stkim92 14:bd420de18a97 9 const uint8_t arm_uc_vendor_id[] = {
stkim92 14:bd420de18a97 10 0x8b, 0x9c, 0x29, 0x91, 0xfc, 0xf8, 0x55, 0x8a, 0xa5, 0x30, 0x1d, 0xd4, 0x05, 0xb4, 0x83, 0xb9
stkim92 14:bd420de18a97 11 };
screamer 0:a9d53048f0b6 12 const uint16_t arm_uc_vendor_id_size = sizeof(arm_uc_vendor_id);
stkim92 14:bd420de18a97 13
stkim92 14:bd420de18a97 14 const uint8_t arm_uc_class_id[] = {
stkim92 14:bd420de18a97 15 0x95, 0x9e, 0xdf, 0x33, 0xe0, 0x68, 0x55, 0xc2, 0x80, 0x7f, 0xb1, 0x6b, 0xa9, 0x8d, 0x29, 0x6a
stkim92 14:bd420de18a97 16 };
screamer 0:a9d53048f0b6 17 const uint16_t arm_uc_class_id_size = sizeof(arm_uc_class_id);
screamer 0:a9d53048f0b6 18 #endif
stkim92 14:bd420de18a97 19
screamer 0:a9d53048f0b6 20 #ifdef MBED_CLOUD_DEV_UPDATE_CERT
stkim92 14:bd420de18a97 21 const uint8_t arm_uc_default_fingerprint[] = {
stkim92 14:bd420de18a97 22 0x84, 0x89, 0x24, 0xfd, 0xff, 0x10, 0xea, 0x83, 0x7e, 0xff, 0x30, 0xcf, 0xe2, 0xd8, 0xa3, 0x68,
stkim92 14:bd420de18a97 23 0xe2, 0x4c, 0x3e, 0x88, 0xd0, 0xf9, 0x77, 0x3d, 0x8e, 0x70, 0xf9, 0x63, 0x10, 0x01, 0x94, 0x08
stkim92 14:bd420de18a97 24 };
screamer 0:a9d53048f0b6 25 const uint16_t arm_uc_default_fingerprint_size =
screamer 0:a9d53048f0b6 26 sizeof(arm_uc_default_fingerprint);
stkim92 14:bd420de18a97 27
stkim92 14:bd420de18a97 28 const uint8_t arm_uc_default_subject_key_identifier[] = {
stkim92 14:bd420de18a97 29 };
stkim92 14:bd420de18a97 30 const uint16_t arm_uc_default_subject_key_identifier_size =
stkim92 14:bd420de18a97 31 sizeof(arm_uc_default_subject_key_identifier);
stkim92 14:bd420de18a97 32
stkim92 14:bd420de18a97 33 const uint8_t arm_uc_default_certificate[] = {
stkim92 14:bd420de18a97 34 0x30, 0x82, 0x01, 0x4c, 0x30, 0x81, 0xf4, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x68, 0xce,
stkim92 14:bd420de18a97 35 0xff, 0x25, 0x09, 0xe4, 0x72, 0xeb, 0x9f, 0x1e, 0xa9, 0x0b, 0xeb, 0xcd, 0xef, 0x0c, 0x31, 0x42,
stkim92 14:bd420de18a97 36 0xf8, 0xc3, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x14,
stkim92 14:bd420de18a97 37 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
stkim92 14:bd420de18a97 38 0x68, 0x6f, 0x73, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, 0x30, 0x37, 0x33, 0x31, 0x30, 0x33,
stkim92 14:bd420de18a97 39 0x34, 0x37, 0x30, 0x31, 0x5a, 0x17, 0x0d, 0x32, 0x30, 0x30, 0x37, 0x33, 0x30, 0x31, 0x35, 0x30,
stkim92 14:bd420de18a97 40 0x30, 0x30, 0x30, 0x5a, 0x30, 0x14, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
stkim92 14:bd420de18a97 41 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07,
stkim92 14:bd420de18a97 42 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01,
stkim92 14:bd420de18a97 43 0x07, 0x03, 0x42, 0x00, 0x04, 0x9f, 0x86, 0x63, 0x51, 0x9e, 0x78, 0x23, 0x69, 0xa2, 0xdf, 0x80,
stkim92 14:bd420de18a97 44 0x2f, 0x8b, 0x11, 0xee, 0x03, 0x37, 0xef, 0x5e, 0xee, 0xf6, 0x60, 0x96, 0xb3, 0xed, 0xcf, 0xf7,
stkim92 14:bd420de18a97 45 0x14, 0xb4, 0x4c, 0x4d, 0xff, 0x2c, 0x1d, 0xc6, 0xbd, 0xbd, 0xec, 0x01, 0x35, 0x15, 0x4e, 0x36,
stkim92 14:bd420de18a97 46 0x34, 0xe9, 0x03, 0x11, 0x77, 0x98, 0x6c, 0x02, 0x11, 0xfd, 0x20, 0x11, 0x79, 0x2b, 0x09, 0xc4,
stkim92 14:bd420de18a97 47 0x07, 0x9d, 0x50, 0x09, 0x57, 0xa3, 0x24, 0x30, 0x22, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f,
stkim92 14:bd420de18a97 48 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x04, 0x0c, 0x30,
stkim92 14:bd420de18a97 49 0x0a, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, 0x30, 0x0a, 0x06, 0x08, 0x2a,
stkim92 14:bd420de18a97 50 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47, 0x00, 0x30, 0x44, 0x02, 0x20, 0x73, 0x10,
stkim92 14:bd420de18a97 51 0x3c, 0x80, 0x7f, 0xd2, 0x04, 0x37, 0x66, 0x09, 0x00, 0xba, 0x71, 0xae, 0xc6, 0x6f, 0x9b, 0xbf,
stkim92 14:bd420de18a97 52 0x12, 0x0f, 0xb1, 0xc6, 0x0d, 0xf0, 0x5c, 0x53, 0x59, 0x11, 0x77, 0x52, 0xf6, 0x4a, 0x02, 0x20,
stkim92 14:bd420de18a97 53 0xd8, 0xfb, 0x0c, 0x8e, 0x83, 0xb3, 0xbc, 0x16, 0x37, 0x69, 0x92, 0x05, 0xa5, 0x70, 0x2a, 0x57,
stkim92 14:bd420de18a97 54 0x06, 0x30, 0x2b, 0xb5, 0xfd, 0xb3, 0xaf, 0x70, 0xe9, 0x77, 0x6a, 0xf1, 0xaf, 0x93, 0x3e, 0x02
stkim92 14:bd420de18a97 55 };
stkim92 14:bd420de18a97 56 const uint16_t arm_uc_default_certificate_size = sizeof(arm_uc_default_certificate);
stkim92 14:bd420de18a97 57 #endif
stkim92 14:bd420de18a97 58
stkim92 14:bd420de18a97 59
stkim92 14:bd420de18a97 60 #ifdef MBED_CLOUD_DEV_UPDATE_PSK
stkim92 14:bd420de18a97 61 const uint8_t arm_uc_default_psk[] = {
stkim92 14:bd420de18a97 62
stkim92 14:bd420de18a97 63 };
stkim92 14:bd420de18a97 64 const uint8_t arm_uc_default_psk_size = sizeof(arm_uc_default_psk);
stkim92 14:bd420de18a97 65 const uint16_t arm_uc_default_psk_bits = sizeof(arm_uc_default_psk)*8;
stkim92 14:bd420de18a97 66
stkim92 14:bd420de18a97 67 const uint8_t arm_uc_default_psk_id[] = {
stkim92 14:bd420de18a97 68
stkim92 14:bd420de18a97 69 };
stkim92 14:bd420de18a97 70 const uint8_t arm_uc_default_psk_id_size = sizeof(arm_uc_default_psk_id);
stkim92 14:bd420de18a97 71 #endif