K6xF board with BG96 of WIZnet for CatM1 board.

Dependencies:   FXAS21002 FXOS8700Q

This document is based on https://os.mbed.com/teams/NXP/code/pelion-example-frdm/

This code could be access via Cat.M1(BG96 module) of SK telecom network in Korea. Need a WIZnet BG96 board or can connect directly to M2Mnet BG96 module and development board.

board board

  • FRDM-K64F - onboard Ethernet and onboard SD card holder.
  • FRDM-K66F - onboard Ethernet and onboard SD card holder.

-------------------------------

/media/uploads/Daniel_Lee/small_pic.jpg /media/uploads/Daniel_Lee/screen_shot_2019-07-24_at_5.29.42_pm.jpg

  • BG96 RESET = D7
  • BG96 PWRKEY = D9
  • BG96 TX = D1
  • BG96 RX = D0
  • BG96 VCC = VCC(5V)
  • BG96 GND = GND

Requirement

Example functionality

This example showcases the following device functionality:

Read onboard FXOS8700Q accelerometer and magnetometer, 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 the application into your desktop:

mbed import http://os.mbed.com/users/Daniel_Lee/code/BG96_K6xF_pelion-example-frdm/

 cd BG96_K6xF_pelion-example-frdm

2. Install the CLOUD_SDK_API_KEY

mbed config -G CLOUD_SDK_API_KEY <PELION_DM_API_KEY>

For instructions on how to generate your API key, please see the documentation.

3. Initialize firmware credentials (done once per repository). You can use the following command:

mbed dm init -d "<your company name in Pelion DM>" --model-name "<product model identifier>" -q --force

If the above command does not work for your Mbed CLI, please consider upgrading Mbed CLI to version 1.9.x or above.

4. Compile and program:

mbed compile -t <toolchain> -m <TARGET_BOARD>

(supported toolchains : GCC_ARM / ARM / IAR)

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

[BOOT] Mbed Bootloader
[BOOT] ARM: 00000000000000000000
[BOOT] OEM: 00000000000000000000
[BOOT] Layout: 0 83A8
[BOOT] Active firmware integrity check:
[BOOT] SHA256: 2DD1793-----------------------------------------------------------------
[BOOT] Version: 1563983916
[BOOT] Slot 0 is empty
[BOOT] Active firmware up-to-date
[BOOT] Application's start address: 0x10400
[BOOT] Application's jump address: 0x10B11
[BOOT] Application's stack address: 0x20030000
[BOOT] Forwarding to application...


Starting Simple Pelion Device Management Client example
You can hold the user button during boot to format the storage and change the d.
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: 000:000:000:000:000:000:000:0
Initializing Pelion Device Management Client...
Initialized Pelion Device Management Client. Registering...
Press the user button to increment the LwM2M resource value...
Registered to Pelion Device Management. Endpoint Name: "xx Your Endpoint Name xx"
*** Button notification, status Subscribed (6)

FXOS8700Q mag:   -2.426 x,  -0.902 y,  -1.611 z [gauss]
FXOS8700Q acc:   -0.054 x,  -0.309 y,   4.306 z [g]
Committer:
Daniel_Lee
Date:
Wed Jul 24 16:03:48 2019 +0000
Revision:
11:34e86cb4dd2f
Parent:
0:a9d53048f0b6
Added BG96 power on sequence

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Daniel_Lee 11:34e86cb4dd2f 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
Daniel_Lee 11:34e86cb4dd2f 5
screamer 0:a9d53048f0b6 6 #include <stdint.h>
Daniel_Lee 11:34e86cb4dd2f 7
screamer 0:a9d53048f0b6 8 #ifdef MBED_CLOUD_DEV_UPDATE_ID
Daniel_Lee 11:34e86cb4dd2f 9 const uint8_t arm_uc_vendor_id[] = {
Daniel_Lee 11:34e86cb4dd2f 10 0x8b, 0x9c, 0x29, 0x91, 0xfc, 0xf8, 0x55, 0x8a, 0xa5, 0x30, 0x1d, 0xd4, 0x05, 0xb4, 0x83, 0xb9
Daniel_Lee 11:34e86cb4dd2f 11 };
screamer 0:a9d53048f0b6 12 const uint16_t arm_uc_vendor_id_size = sizeof(arm_uc_vendor_id);
Daniel_Lee 11:34e86cb4dd2f 13
Daniel_Lee 11:34e86cb4dd2f 14 const uint8_t arm_uc_class_id[] = {
Daniel_Lee 11:34e86cb4dd2f 15 0x95, 0x9e, 0xdf, 0x33, 0xe0, 0x68, 0x55, 0xc2, 0x80, 0x7f, 0xb1, 0x6b, 0xa9, 0x8d, 0x29, 0x6a
Daniel_Lee 11:34e86cb4dd2f 16 };
screamer 0:a9d53048f0b6 17 const uint16_t arm_uc_class_id_size = sizeof(arm_uc_class_id);
screamer 0:a9d53048f0b6 18 #endif
Daniel_Lee 11:34e86cb4dd2f 19
screamer 0:a9d53048f0b6 20 #ifdef MBED_CLOUD_DEV_UPDATE_CERT
Daniel_Lee 11:34e86cb4dd2f 21 const uint8_t arm_uc_default_fingerprint[] = {
Daniel_Lee 11:34e86cb4dd2f 22 0xf2, 0x35, 0x6b, 0x7b, 0x7b, 0xf8, 0x67, 0xf5, 0xe9, 0x64, 0xbc, 0x74, 0x46, 0xc2, 0xcb, 0x03,
Daniel_Lee 11:34e86cb4dd2f 23 0x7b, 0xcf, 0x97, 0x95, 0xb4, 0x1b, 0x0b, 0x0f, 0x34, 0x31, 0xf0, 0xc8, 0xf0, 0x52, 0x34, 0x52
Daniel_Lee 11:34e86cb4dd2f 24 };
screamer 0:a9d53048f0b6 25 const uint16_t arm_uc_default_fingerprint_size =
screamer 0:a9d53048f0b6 26 sizeof(arm_uc_default_fingerprint);
Daniel_Lee 11:34e86cb4dd2f 27
Daniel_Lee 11:34e86cb4dd2f 28 const uint8_t arm_uc_default_subject_key_identifier[] = {
Daniel_Lee 11:34e86cb4dd2f 29 };
Daniel_Lee 11:34e86cb4dd2f 30 const uint16_t arm_uc_default_subject_key_identifier_size =
Daniel_Lee 11:34e86cb4dd2f 31 sizeof(arm_uc_default_subject_key_identifier);
Daniel_Lee 11:34e86cb4dd2f 32
Daniel_Lee 11:34e86cb4dd2f 33 const uint8_t arm_uc_default_certificate[] = {
Daniel_Lee 11:34e86cb4dd2f 34 0x30, 0x82, 0x01, 0x4c, 0x30, 0x81, 0xf4, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0xea, 0xae,
Daniel_Lee 11:34e86cb4dd2f 35 0x79, 0x9d, 0x16, 0xd6, 0x27, 0x94, 0x76, 0x5a, 0x9b, 0x77, 0x7e, 0x6b, 0xfb, 0xd1, 0x39, 0x01,
Daniel_Lee 11:34e86cb4dd2f 36 0x24, 0x17, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x14,
Daniel_Lee 11:34e86cb4dd2f 37 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
Daniel_Lee 11:34e86cb4dd2f 38 0x68, 0x6f, 0x73, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, 0x30, 0x37, 0x32, 0x34, 0x31, 0x35,
Daniel_Lee 11:34e86cb4dd2f 39 0x35, 0x32, 0x30, 0x39, 0x5a, 0x17, 0x0d, 0x32, 0x30, 0x30, 0x37, 0x32, 0x34, 0x31, 0x35, 0x30,
Daniel_Lee 11:34e86cb4dd2f 40 0x30, 0x30, 0x30, 0x5a, 0x30, 0x14, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
Daniel_Lee 11:34e86cb4dd2f 41 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07,
Daniel_Lee 11:34e86cb4dd2f 42 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01,
Daniel_Lee 11:34e86cb4dd2f 43 0x07, 0x03, 0x42, 0x00, 0x04, 0x6e, 0xbb, 0x70, 0x11, 0xea, 0x3e, 0x1c, 0x7f, 0x2c, 0x4e, 0x12,
Daniel_Lee 11:34e86cb4dd2f 44 0x07, 0x40, 0x43, 0x7f, 0xd4, 0x5e, 0x72, 0x67, 0xf7, 0xa5, 0xf5, 0xf4, 0xdc, 0x0a, 0xff, 0x1f,
Daniel_Lee 11:34e86cb4dd2f 45 0x7b, 0xd7, 0x41, 0x61, 0x47, 0x89, 0xe0, 0x38, 0x7d, 0xcf, 0xcb, 0x12, 0xc6, 0x82, 0xb6, 0x57,
Daniel_Lee 11:34e86cb4dd2f 46 0xcc, 0x81, 0x67, 0x58, 0x0d, 0x5a, 0x37, 0xb3, 0xe6, 0x82, 0xe3, 0xc5, 0x64, 0x64, 0xee, 0xa8,
Daniel_Lee 11:34e86cb4dd2f 47 0x05, 0x62, 0xfb, 0x56, 0x02, 0xa3, 0x24, 0x30, 0x22, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f,
Daniel_Lee 11:34e86cb4dd2f 48 0x04, 0x04, 0x03, 0x02, 0x07, 0x80, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x04, 0x0c, 0x30,
Daniel_Lee 11:34e86cb4dd2f 49 0x0a, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, 0x30, 0x0a, 0x06, 0x08, 0x2a,
Daniel_Lee 11:34e86cb4dd2f 50 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47, 0x00, 0x30, 0x44, 0x02, 0x20, 0xc3, 0xf9,
Daniel_Lee 11:34e86cb4dd2f 51 0xaa, 0x5f, 0x49, 0xa6, 0x25, 0x8d, 0x88, 0x1b, 0xea, 0xc0, 0x53, 0xd5, 0x57, 0xc5, 0x2a, 0x61,
Daniel_Lee 11:34e86cb4dd2f 52 0xfd, 0xe2, 0x0d, 0xc4, 0x38, 0x22, 0xcf, 0x96, 0xfe, 0xd5, 0xbf, 0xcc, 0x46, 0x9a, 0x02, 0x20,
Daniel_Lee 11:34e86cb4dd2f 53 0x42, 0x4e, 0x38, 0xca, 0xf4, 0xb4, 0x30, 0x61, 0xaa, 0xbd, 0x54, 0xfe, 0xf6, 0x3d, 0xb2, 0x64,
Daniel_Lee 11:34e86cb4dd2f 54 0x12, 0xc0, 0xa7, 0x2e, 0xca, 0x88, 0xdd, 0x58, 0xaf, 0xcd, 0xf3, 0x26, 0xdb, 0xa7, 0x0d, 0x9d
Daniel_Lee 11:34e86cb4dd2f 55 };
Daniel_Lee 11:34e86cb4dd2f 56 const uint16_t arm_uc_default_certificate_size = sizeof(arm_uc_default_certificate);
Daniel_Lee 11:34e86cb4dd2f 57 #endif
Daniel_Lee 11:34e86cb4dd2f 58
Daniel_Lee 11:34e86cb4dd2f 59
Daniel_Lee 11:34e86cb4dd2f 60 #ifdef MBED_CLOUD_DEV_UPDATE_PSK
Daniel_Lee 11:34e86cb4dd2f 61 const uint8_t arm_uc_default_psk[] = {
Daniel_Lee 11:34e86cb4dd2f 62
Daniel_Lee 11:34e86cb4dd2f 63 };
Daniel_Lee 11:34e86cb4dd2f 64 const uint8_t arm_uc_default_psk_size = sizeof(arm_uc_default_psk);
Daniel_Lee 11:34e86cb4dd2f 65 const uint16_t arm_uc_default_psk_bits = sizeof(arm_uc_default_psk)*8;
Daniel_Lee 11:34e86cb4dd2f 66
Daniel_Lee 11:34e86cb4dd2f 67 const uint8_t arm_uc_default_psk_id[] = {
Daniel_Lee 11:34e86cb4dd2f 68
Daniel_Lee 11:34e86cb4dd2f 69 };
Daniel_Lee 11:34e86cb4dd2f 70 const uint8_t arm_uc_default_psk_id_size = sizeof(arm_uc_default_psk_id);
Daniel_Lee 11:34e86cb4dd2f 71 #endif