Eric Jung / Mbed OS BG96_K6xF_pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Files at this revision

API Documentation at this revision

Comitter:
hkjung
Date:
Thu May 02 06:12:45 2019 +0000
Parent:
7:c249d4c9dcad
Commit message:
Added hardware reset function for WIZnet IoT Shield BG96

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed_cloud_dev_credentials.c Show annotated file Show diff for this revision Revisions of this file
update_certificate.pem Show annotated file Show diff for this revision Revisions of this file
update_default_resources.c Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Apr 25 06:45:36 2019 +0000
+++ b/main.cpp	Thu May 02 06:12:45 2019 +0000
@@ -22,6 +22,14 @@
 #include "FATFileSystem.h"
 #include "LittleFileSystem.h"
 
+/* Pin configuraiton */
+// Cat.M1
+#define MBED_CONF_IOTSHIELD_CATM1_RESET             D7
+#define MBED_CONF_IOTSHIELD_CATM1_PWRKEY            D9
+// On-board sensors
+#define MBED_CONF_IOTSHIELD_SENSOR_CDS              A0
+#define MBED_CONF_IOTSHIELD_SENSOR_TEMP             A1
+
 // Default network interface object. Don't forget to change the WiFi SSID/password in mbed_app.json if you're using WiFi.
 NetworkInterface *net = NetworkInterface::get_default_instance();
 
@@ -90,6 +98,23 @@
 // When the device is registered, this variable will be used to access various useful information, like device ID etc.
 static const ConnectorClientEndpointInfo* endpointInfo;
 
+void iotshield_modem_init(void)
+{
+    DigitalOut _RESET_IOTSHIELD(MBED_CONF_IOTSHIELD_CATM1_RESET);
+    DigitalOut _PWRKEY_IOTSHIELD(MBED_CONF_IOTSHIELD_CATM1_PWRKEY);
+
+    _RESET_IOTSHIELD = 1;
+    _PWRKEY_IOTSHIELD = 1;
+    wait_ms(300);
+
+    _RESET_IOTSHIELD = 0;
+    _PWRKEY_IOTSHIELD = 0;
+    wait_ms(400);
+
+    _RESET_IOTSHIELD = 1;
+    wait_ms(1000);
+}
+
 /**
  * PUT handler - sets the value of the built-in LED
  * @param resource The resource that triggered the callback
@@ -235,6 +260,9 @@
     }
 
     sensors_init();
+    
+    // Cat.M1 module init: Hardware reset and power on
+    iotshield_modem_init();
 
     // Connect to the Internet (DHCP is expected to be on)
     printf("Connecting to the network using the default network interface...\n");
--- a/mbed_cloud_dev_credentials.c	Thu Apr 25 06:45:36 2019 +0000
+++ b/mbed_cloud_dev_credentials.c	Thu May 02 06:12:45 2019 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 ARM Limited. All rights reserved.
+ * Copyright (c) 2018 ARM Limited. All rights reserved.
  * SPDX-License-Identifier: Apache-2.0
  * Licensed under the Apache License, Version 2.0 (the License); you may
  * not use this file except in compliance with the License.
@@ -15,7 +15,9 @@
  */
 #ifndef __MBED_CLOUD_DEV_CREDENTIALS_H__
 #define __MBED_CLOUD_DEV_CREDENTIALS_H__
- 
+
+#include <inttypes.h>
+
 #if MBED_CONF_DEVICE_MANAGEMENT_DEVELOPER_MODE == 1
 #error "Replace mbed_cloud_dev_credentials.c with your own developer cert."
 #endif
@@ -50,4 +52,4 @@
 const uint32_t MBED_CLOUD_DEV_BOOTSTRAP_SERVER_ROOT_CA_CERTIFICATE_SIZE = sizeof(MBED_CLOUD_DEV_BOOTSTRAP_SERVER_ROOT_CA_CERTIFICATE);
 const uint32_t MBED_CLOUD_DEV_BOOTSTRAP_DEVICE_PRIVATE_KEY_SIZE = sizeof(MBED_CLOUD_DEV_BOOTSTRAP_DEVICE_PRIVATE_KEY);
  
-#endif //__MBED_CLOUD_DEV_CREDENTIALS_H__
\ No newline at end of file
+#endif //__MBED_CLOUD_DEV_CREDENTIALS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/update_certificate.pem	Thu May 02 06:12:45 2019 +0000
@@ -0,0 +1,9 @@
+-----BEGIN CERTIFICATE-----
+MIIBTDCB9KADAgECAhSdB5gfU4ZLYpSKiKUqB+pNZAzC6TAKBggqhkjOPQQDAjAU
+MRIwEAYDVQQDDAlsb2NhbGhvc3QwHhcNMTkwNTAyMDQ1MjQ0WhcNMjAwNTAxMTUw
+MDAwWjAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwWTATBgcqhkjOPQIBBggqhkjOPQMB
+BwNCAAQhfKERVb/L9RiXQK6iQ86iZkET8y+SLsTxQlJgEAjFJmF2osz9mYh+xZ1s
+4E9FrhAenIdQhhd7QSxMjjPbCEA2oyQwIjALBgNVHQ8EBAMCB4AwEwYDVR0lBAww
+CgYIKwYBBQUHAwMwCgYIKoZIzj0EAwIDRwAwRAIgyApNjq7utqZ8KodLJNG4FA3z
+kitswG4aKV+N88QPZUACIOTUu0DjekvRUZYjSyR18480kTrnE66dHcGVcW5fzQTB
+-----END CERTIFICATE-----
--- a/update_default_resources.c	Thu Apr 25 06:45:36 2019 +0000
+++ b/update_default_resources.c	Thu May 02 06:12:45 2019 +0000
@@ -1,41 +1,71 @@
-// ----------------------------------------------------------------------------
-// Copyright 2016-2017 ARM Ltd.
-//
-// SPDX-License-Identifier: Apache-2.0
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ----------------------------------------------------------------------------
- 
+
 #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[16] = { "dev_manufacturer" };
+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[16]  = { "dev_model_number" };
+
+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[32] = { 0 };
+const uint8_t arm_uc_default_fingerprint[] =  {
+    0x9f, 0xf5, 0xa6, 0x54, 0x58, 0xda, 0x45, 0xac, 0x53, 0x30, 0x85, 0xe7, 0xcc, 0x03, 0x75, 0xb2,
+    0x23, 0xea, 0xc2, 0x6c, 0x5f, 0xd2, 0x2d, 0x0b, 0xa6, 0xfe, 0xbc, 0xdd, 0xe3, 0x65, 0x49, 0x9c
+};
 const uint16_t arm_uc_default_fingerprint_size =
     sizeof(arm_uc_default_fingerprint);
- 
-const uint8_t arm_uc_default_certificate[1] = { 0 };
-const uint16_t arm_uc_default_certificate_size =
-    sizeof(arm_uc_default_certificate);
-#endif
\ No newline at end of file
+
+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, 0x9d, 0x07,
+    0x98, 0x1f, 0x53, 0x86, 0x4b, 0x62, 0x94, 0x8a, 0x88, 0xa5, 0x2a, 0x07, 0xea, 0x4d, 0x64, 0x0c,
+    0xc2, 0xe9, 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, 0x35, 0x30, 0x32, 0x30, 0x34,
+    0x35, 0x32, 0x34, 0x34, 0x5a, 0x17, 0x0d, 0x32, 0x30, 0x30, 0x35, 0x30, 0x31, 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, 0x21, 0x7c, 0xa1, 0x11, 0x55, 0xbf, 0xcb, 0xf5, 0x18, 0x97, 0x40,
+    0xae, 0xa2, 0x43, 0xce, 0xa2, 0x66, 0x41, 0x13, 0xf3, 0x2f, 0x92, 0x2e, 0xc4, 0xf1, 0x42, 0x52,
+    0x60, 0x10, 0x08, 0xc5, 0x26, 0x61, 0x76, 0xa2, 0xcc, 0xfd, 0x99, 0x88, 0x7e, 0xc5, 0x9d, 0x6c,
+    0xe0, 0x4f, 0x45, 0xae, 0x10, 0x1e, 0x9c, 0x87, 0x50, 0x86, 0x17, 0x7b, 0x41, 0x2c, 0x4c, 0x8e,
+    0x33, 0xdb, 0x08, 0x40, 0x36, 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, 0xc8, 0x0a,
+    0x4d, 0x8e, 0xae, 0xee, 0xb6, 0xa6, 0x7c, 0x2a, 0x87, 0x4b, 0x24, 0xd1, 0xb8, 0x14, 0x0d, 0xf3,
+    0x92, 0x2b, 0x6c, 0xc0, 0x6e, 0x1a, 0x29, 0x5f, 0x8d, 0xf3, 0xc4, 0x0f, 0x65, 0x40, 0x02, 0x20,
+    0xe4, 0xd4, 0xbb, 0x40, 0xe3, 0x7a, 0x4b, 0xd1, 0x51, 0x96, 0x23, 0x4b, 0x24, 0x75, 0xf3, 0x8f,
+    0x34, 0x91, 0x3a, 0xe7, 0x13, 0xae, 0x9d, 0x1d, 0xc1, 0x95, 0x71, 0x6e, 0x5f, 0xcd, 0x04, 0xc1
+};
+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