Forked repository to push EVAL-AD593x updates

Dependencies:   platform_drivers

Files at this revision

API Documentation at this revision

Comitter:
pmallick
Date:
Wed Oct 13 14:39:58 2021 +0530
Parent:
4:953fb3148f25
Commit message:
No-OS Adoption Changes:
* Updated the .lib files for adoption of no-OS repository as-is.
* Replaced 'platform_drivers.h' with required header files.
* Updated the copyright year.

Mbed OS update changes:
1) Added the mbed_app.json file with custom parameters.
2) Updated the mbed-os version to 6.8.0

Changed in this revision

AD593x.lib Show diff for this revision Revisions of this file
License.txt Show annotated file Show diff for this revision Revisions of this file
README.txt Show annotated file Show diff for this revision Revisions of this file
app/.mbedignore Show annotated file Show diff for this revision Revisions of this file
app/app_config.h Show annotated file Show diff for this revision Revisions of this file
app/main.cpp Show annotated file Show diff for this revision Revisions of this file
app/mbed_platform_drivers.lib Show annotated file Show diff for this revision Revisions of this file
app/no-OS.lib Show annotated file Show diff for this revision Revisions of this file
app_config.h Show diff for this revision Revisions of this file
main.cpp Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
platform_drivers.lib Show diff for this revision Revisions of this file
diff -r 953fb3148f25 -r ca8fe90d3ab5 AD593x.lib
--- a/AD593x.lib	Tue Oct 29 21:42:57 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/teams/AnalogDevices/code/AD593x/#7351fce36ea6
diff -r 953fb3148f25 -r ca8fe90d3ab5 License.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/License.txt	Wed Oct 13 14:39:58 2021 +0530
@@ -0,0 +1,35 @@
+Copyright (c) 2019 Analog Devices, Inc.  All rights reserved.
+ 
+Redistribution and use in source and binary forms, with or without modification, 
+are permitted provided that the following conditions are met:
+  - Redistributions of source code must retain the above copyright notice, 
+  this list of conditions and the following disclaimer.
+  - Redistributions in binary form must reproduce the above copyright notice, 
+  this list of conditions and the following disclaimer in the documentation 
+  and/or other materials provided with the distribution.  
+  - Modified versions of the software must be conspicuously marked as such.
+  - This software is licensed solely and exclusively for use with processors/products 
+  manufactured by or for Analog Devices, Inc.
+  - This software may not be combined or merged with other code in any manner 
+  that would cause the software to become subject to terms and conditions which 
+  differ from those listed here.
+  - Neither the name of Analog Devices, Inc. nor the names of its contributors 
+  may be used to endorse or promote products derived from this software without 
+  specific prior written permission.
+  - The use of this software may or may not infringe the patent rights of one or 
+  more patent holders.  This license does not release you from the requirement 
+  that you obtain separate licenses from these patent holders to use this software.
+ 
+THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND 
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, 
+TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 
+NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES 
+(INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL 
+PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+2019-01-10-7CBSD SLA
\ No newline at end of file
diff -r 953fb3148f25 -r ca8fe90d3ab5 README.txt
--- a/README.txt	Tue Oct 29 21:42:57 2019 +0000
+++ b/README.txt	Wed Oct 13 14:39:58 2021 +0530
@@ -4,80 +4,42 @@
 AD5934
 
 Recommended Evaluation Board DIGILENT PMOD 1A
-
-
+ 
 Overview
 --------
-These code files provide drivers to interface with Analog Devices family of
-impedance-converters listed above and communicate with any compatable evaluation board.
-This code was developed and tested on SDP-K1 controller board 
-https://os.mbed.com/platforms/SDP_K1/ and used the Digilent PMOD 1A board for testing.
-
+These code files provide the console application and device libraries to 
+interface with AD5933/AD5934 EVAL boards. This code was developed and tested on SDP-K1 
+controller board: https://os.mbed.com/platforms/SDP_K1/ and and used the Digilent PMOD 1A board for testing.
+ 
 Product details: https://www.analog.com/en/products/ad5933.html
+Eval board details: https://reference.digilentinc.com/reference/pmod/pmodia/start?_ga=2.247997262.874832523.1572350909-1020412841.1562671075
 User Guide for this code: https://wiki.analog.com/resources/tools-software/product-support-software/ad5933-mbed
-Digilent PMOD 1A: https://reference.digilentinc.com/reference/pmod/pmodia/start?_ga=2.247997262.874832523.1572350909-1020412841.1562671075
+Communication Protocol: I2C
 
 
 Hardware Setup
 --------------
-Required: SDP-K1 (or alternative MBED-enabled controller board), evaluation-board - recommend Digilent PMOD 1A, 
+Required: SDP-K1 (or alternative MBED enabled controller board), recommend Digilent PMOD 1A, 
 USB cable.
-Connect the SPI port on the SDP-K1 board (or any other Mbed enabled 
+Connect the I2C port on the SDP-K1 board (or any other Mbed enabled 
 controller board) using short jumper-wires.
 Connect SDP-K1 board to the PC using the USB cable.
-
-
+ 
+ 
 How to Get Started
 ------------------
 Open Mbed online compiler. https://ide.mbed.com/compiler
-Import Code into compiler from here: https://os.mbed.com/teams/AnalogDevices/code/EVAL-AD593x/
-instructions on how to import code are here: https://os.mbed.com/docs/mbed-os/v5.12/tools/importing-code.html
-Compile code. Drag and drop binary into SDP-K1 controller board. Find detailed 
-instructions here: https://os.mbed.com/docs/mbed-os/v5.12/tools/getting-your-program-on-your-board.html
-Open Tera Term (or alternative), select 115200 baud rate, and the applicable COM 
-port to see the list of options.
+Import Code into compiler. Instructions on how to import code are here: https://os.mbed.com/docs/mbed-os/v6.8/quick-start/build-with-the-online-compiler.html
+Compile code to generate binary file and then drag and drop binary into SDP-K1 controller board. Detailed instructions are here: 
+https://os.mbed.com/docs/mbed-os/v6.8/build-tools/getting-your-program-on-your-board.html
 
-
+Refer project wiki page to find detailed guide on how to use firmware:
+https://wiki.analog.com/resources/tools-software/product-support-software/ad5933-mbed
+ 
+ 
 Notes
 -----
-If using Win 7, install serial drivers for Mbed. https://os.mbed.com/docs/mbed-os/v5.12/tutorials/windows-serial-driver.html
+Refer this page for latest documentation on Mbed-OS: https://os.mbed.com/docs/mbed-os/v6.8/introduction/index.html
 A detailed user guide on SDP-K1 controller board is available here https://www.analog.com/en/design-center/evaluation-hardware-and-software/evaluation-boards-kits/SDP-K1.html.
 
-
-License
--------
-Copyright (c) 2019 Analog Devices, Inc.  All rights reserved.
- 
-Redistribution and use in source and binary forms, with or without modification, 
-are permitted provided that the following conditions are met:
-  - Redistributions of source code must retain the above copyright notice, 
-  this list of conditions and the following disclaimer.
-  - Redistributions in binary form must reproduce the above copyright notice, 
-  this list of conditions and the following disclaimer in the documentation 
-  and/or other materials provided with the distribution.  
-  - Modified versions of the software must be conspicuously marked as such.
-  - This software is licensed solely and exclusively for use with processors/products 
-  manufactured by or for Analog Devices, Inc.
-  - This software may not be combined or merged with other code in any manner 
-  that would cause the software to become subject to terms and conditions which 
-  differ from those listed here.
-  - Neither the name of Analog Devices, Inc. nor the names of its contributors 
-  may be used to endorse or promote products derived from this software without 
-  specific prior written permission.
-  - The use of this software may or may not infringe the patent rights of one or 
-  more patent holders.  This license does not release you from the requirement 
-  that you obtain separate licenses from these patent holders to use this software.
- 
-THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND 
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, 
-TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 
-NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES 
-(INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL 
-PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- 
-2019-01-10-7CBSD SLA
\ No newline at end of file
+Copyright (c) 2021 Analog Devices, Inc.  All rights reserved.
\ No newline at end of file
diff -r 953fb3148f25 -r ca8fe90d3ab5 app/.mbedignore
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/.mbedignore	Wed Oct 13 14:39:58 2021 +0530
@@ -0,0 +1,40 @@
+mbed_platform_drivers/adc_data_capture.c
+mbed_platform_drivers/uart.cpp
+no-OS/ci/
+no-OS/doc/
+no-OS/legacy/
+no-OS/accel/
+no-OS/drivers/adc/adc_demo/
+no-OS/drivers/adc/ad4*
+no-OS/drivers/adc/ad6*
+no-OS/drivers/adc/ad7*
+no-OS/drivers/adc/ad9*
+no-OS/drivers/adc/adaq*
+no-OS/drivers/adc/l*
+no-OS/drivers/afe/
+no-OS/drivers/amplifiers/
+no-OS/drivers/axi_core/
+no-OS/drivers/cdc/
+no-OS/drivers/dac/
+no-OS/drivers/ecg/
+no-OS/drivers/frequency/
+no-OS/drivers/gpio/
+no-OS/drivers/gyro/
+no-OS/drivers/i2c/
+no-OS/drivers/io-expander/
+no-OS/drivers/instr-amplif/
+no-OS/drivers/mux/
+no-OS/drivers/photo-electronic/
+no-OS/drivers/platform/
+no-OS/drivers/potentiometer/
+no-OS/drivers/rf-transceiver/
+no-OS/drivers/sd-card/
+no-OS/drivers/spi/
+no-OS/drivers/tdm/
+no-OS/drivers/temperature/
+no-OS/iio/
+no-OS/legacy/
+no-OS/libraries/
+no-OS/network/
+no-OS/projects/
+no-OS/tools/
\ No newline at end of file
diff -r 953fb3148f25 -r ca8fe90d3ab5 app/app_config.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/app_config.h	Wed Oct 13 14:39:58 2021 +0530
@@ -0,0 +1,104 @@
+/*************************************************************************//**
+ *   @file   app_config.h
+ *   @brief  Configuration file of AD5686 firmware example program
+ *   @author ssmith (sean.smith@analog.com)
+******************************************************************************
+* Copyright (c) 2019 Analog Devices, Inc.  
+* 
+* All rights reserved.
+* 
+* Redistribution and use in source and binary forms, with or without 
+* modification, are permitted provided that the following conditions are met:
+*   - Redistributions of source code must retain the above copyright notice, 
+*     this list of conditions and the following disclaimer.
+*   - Redistributions in binary form must reproduce the above copyright notice, 
+*     this list of conditions and the following disclaimer in the documentation 
+*     and/or other materials provided with the distribution.  
+*   - Modified versions of the software must be conspicuously marked as such.
+*   - This software is licensed solely and exclusively for use with 
+*     processors/products manufactured by or for Analog Devices, Inc.
+*   - This software may not be combined or merged with other code in any manner 
+*     that would cause the software to become subject to terms and 
+*     conditions which differ from those listed here.
+*   - Neither the name of Analog Devices, Inc. nor the names of its 
+*     contributors may be used to endorse or promote products derived 
+*     from this software without specific prior written permission.
+*   - The use of this software may or may not infringe the patent rights 
+*     of one or more patent holders. This license does not release you from 
+*     the requirement that you obtain separate licenses from these patent 
+*     holders to use this software.
+* 
+* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" 
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+* NON-INFRINGEMENT, TITLE, MERCHANTABILITY AND FITNESS FOR A 
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, 
+* INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+* SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES 
+* (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF 
+* INTELLECTUAL PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE 
+* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
+* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
+* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+* POSSIBILITY OF SUCH DAMAGE.
+* 
+* 20180927-7CBSD SLA
+*****************************************************************************/
+
+#ifndef _APP_CONFIG_H_
+#define _APP_CONFIG_H_
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#ifdef __cplusplus
+#include "ad5933.h"
+}
+#endif
+
+
+//#define  ARDUINO
+
+
+/**
+  The ADI SDP_K1 can be used with both arduino headers
+  or the 120-pin SDP connector found on ADI evaluation
+  boards. The default is the SDP connector
+
+  Uncomment the ARDUINO #define above to enable the ARDUINO connector
+
+*/
+//#warning  check this
+#ifdef ARDUINO
+	#define I2C_SCL     D15
+	#define I2C_SDA     D14
+
+	#define SPI_CS		D10
+	#define SPI_MISO	D12
+	#define SPI_MOSI	D11
+	#define SPI_SCK		D13
+
+	#define GAIN_PIN	D8 
+	#define RESET_PIN	D9 
+	#define LDAC_PIN	D7 
+	#define ADDR0_PIN	D6 
+#else
+	
+	#define I2C_SCL     SDP_I2C_SCL
+	#define I2C_SDA     SDP_I2C_SDA
+
+	#define SPI_CS		SDP_SPI_CS_A
+	#define SPI_MISO	SDP_SPI_MISO
+	#define SPI_MOSI	SDP_SPI_MOSI
+	#define SPI_SCK		SDP_SPI_SCK
+
+	#define GAIN_PIN	SDP_GPIO_0
+	#define RESET_PIN	SDP_GPIO_2
+	#define LDAC_PIN	SDP_GPIO_3
+	#define ADDR0_PIN	SDP_GPIO_4
+#endif
+
+#endif //_APP_CONFIG_H_
\ No newline at end of file
diff -r 953fb3148f25 -r ca8fe90d3ab5 app/main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main.cpp	Wed Oct 13 14:39:58 2021 +0530
@@ -0,0 +1,525 @@
+/*************************************************************************//**
+ *   @file   main.cpp
+ *   @brief  Main application code for AD5933 firmware example program
+ *   @author ssmith (sean.smith@analog.com)
+******************************************************************************
+* Copyright (c) 2019-2021 Analog Devices, Inc.  
+* 
+* All rights reserved.
+* 
+* Redistribution and use in source and binary forms, with or without 
+* modification, are permitted provided that the following conditions are met:
+*   - Redistributions of source code must retain the above copyright notice, 
+*     this list of conditions and the following disclaimer.
+*   - Redistributions in binary form must reproduce the above copyright notice, 
+*     this list of conditions and the following disclaimer in the documentation 
+*     and/or other materials provided with the distribution.  
+*   - Modified versions of the software must be conspicuously marked as such.
+*   - This software is licensed solely and exclusively for use with 
+*     processors/products manufactured by or for Analog Devices, Inc.
+*   - This software may not be combined or merged with other code in any manner 
+*     that would cause the software to become subject to terms and 
+*     conditions which differ from those listed here.
+*   - Neither the name of Analog Devices, Inc. nor the names of its 
+*     contributors may be used to endorse or promote products derived 
+*     from this software without specific prior written permission.
+*   - The use of this software may or may not infringe the patent rights 
+*     of one or more patent holders. This license does not release you from 
+*     the requirement that you obtain separate licenses from these patent 
+*     holders to use this software.
+* 
+* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" 
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+* NON-INFRINGEMENT, TITLE, MERCHANTABILITY AND FITNESS FOR A 
+* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, 
+* INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+* SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES 
+* (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF 
+* INTELLECTUAL PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE 
+* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
+* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
+* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+* POSSIBILITY OF SUCH DAMAGE.
+* 
+* 20180927-7CBSD SLA
+*****************************************************************************/
+
+#include <mbed.h>
+#include <ctype.h>
+#include "i2c.h"
+#include "i2c_extra.h"
+#include "error.h"
+#include "app_config.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif //  _cplusplus 
+#include "delay.h"
+#ifdef __cplusplus  // Closing extern c
+}
+#endif //  _cplusplus
+
+//Lower this value if storage becomes a problem
+#define MAX_FREQ_INCREMENTS 511
+#define TEMP_LIMIT_MIN -40
+#define TEMP_LIMIT_MAX 125 
+#define MAX_SETTLING_CYCLES  511
+
+static void print_title(void);
+static void getMenuSelect(uint8_t *menuSelect);
+static void print_prompt();
+static uint8_t read_temperature();
+static uint8_t set_system_clock();
+static uint8_t set_vrange_and_pga_gain();
+static int32_t configure_system();
+static uint8_t calculate_gain_factor();
+static uint8_t guide();
+static uint8_t impedance_sweep();
+
+typedef struct ad5933_config_data {
+	float 	start_freq;
+	uint8_t pga_gain;
+	float 	output_voltage_range;
+	int32_t start_frequency;
+	int32_t frequency_increment;
+	int32_t number_increments;
+	int32_t number_settling_cycles;
+}ad5933_config_data;
+
+ad5933_config_data config_data;
+
+static double gain_factor = 0;
+static double temperature;
+
+
+/******************************************************************************/
+/************************** Variables Declarations ****************************/
+/******************************************************************************/
+
+// Initialize the extra parameters for I2C initialization
+mbed_i2c_init_param i2c_init_extra_params = {
+	.i2c_sda_pin = I2C_SDA,
+	.i2c_scl_pin = I2C_SCL
+};
+
+i2c_init_param i2c_params =
+{
+	.max_speed_hz = 100000,				// i2c max speed (hz)
+	.slave_address = AD5933_ADDRESS,	// i2c slave address //A0 tied high
+	.extra = &i2c_init_extra_params		// i2c extra initialization parameters
+};
+
+
+ad5933_init_param init_params = {
+	.i2c_init = i2c_params,								// I2C parameters 
+	.current_sys_clk = AD5933_INTERNAL_SYS_CLK,			//current_sys_clk frequency (16MHz)
+	.current_clock_source = AD5933_CONTROL_INT_SYSCLK,	//current_clock_source
+	.current_gain = AD5933_RANGE_1000mVpp,				//current_gain
+	.current_range = AD5933_GAIN_X1,					//current_range
+};
+
+ad5933_dev *device;
+int32_t connected = -1;
+
+int main()
+{
+	
+	uint8_t menu_select = 0;
+	print_title();
+	connected = ad5933_init(&device, init_params);
+
+
+	//Do a quick check to ensure basic connectivity is ok
+	temperature  = ad5933_get_temperature(device);
+	if (temperature >= TEMP_LIMIT_MIN && temperature <= TEMP_LIMIT_MAX) {
+		printf("\nTemperature: %f, AD5933 initialisation successful!\n",temperature);
+	}
+	else {
+		printf("AD5933 initialisation reported a bad temperature - recommend debug :\n");
+	}
+
+	while (connected == SUCCESS) {
+		print_prompt();
+		getMenuSelect(&menu_select);
+		config_data.start_freq = 10000;
+
+		if (menu_select > 12)
+			print_prompt();
+		else switch (menu_select)
+			{
+			case 0: 
+				guide();
+				mdelay(2000); 
+				break;
+
+			case 1:
+				read_temperature();
+				break;
+			case 2:
+				configure_system();
+				break;
+			case 3:
+				calculate_gain_factor();
+				break;
+			case 4:
+				impedance_sweep();
+				break;
+
+			default:
+				printf("Invalid option: Ignored.");
+				break;
+			}
+
+			mdelay(100);
+		}
+
+		return 0;
+}
+
+//! Prints the title block
+void print_title()
+{
+	printf("*****************************************************************\n");
+	printf("* AD5933 Demonstration Program                                  *\n");
+	printf("*                                                               *\n");
+	printf("* This program demonstrates communication with the AD5933       *\n");
+	printf("*                                                               *\n");
+	printf("* 1 MSPS, 12-Bit Impedance Converter, Network analyser          *\n");
+	printf("*                                                               *\n");
+	printf("* Set the baud rate to 115200 select the newline terminator.    *\n");
+	printf("*****************************************************************\n");
+}
+
+void print_prompt()
+{
+	printf("\n\n\rCommand Summary:\n\n");
+	printf("  0  -Software Guide\n");
+	printf("  1  -Read temperature\n");
+	printf("  2  -Configure voltage-range, PGA-Gain and sweep parameters\n");
+	printf("  3  -Calculate Gain-Factor\n");
+	printf("  4  -Do an impedance sweep\n");
+	printf("\n\rMake a selection...\n");
+
+}
+
+
+static void getMenuSelect(uint8_t *menuSelect) {
+	scanf("%d", (int *)menuSelect);
+}
+
+static uint8_t read_temperature()
+{
+	temperature = ad5933_get_temperature(device);
+
+	printf("Current temperature:%.3f C", temperature);
+	return SUCCESS;
+}
+
+static uint8_t set_system_clock()
+{
+	printf("  Select Internal (1) or external clock (2): ");
+
+	int input = 0;
+	scanf("%d", &input);
+	if (isdigit(input) == 0 && (input == 1 || input == 2))
+	{
+		input == 1 ? printf("\n  You selected Internal clock source\n") :
+			printf("  You selected external Source clock source\n");
+	}
+	else
+	{
+		printf("Invalid entry\n");
+		mdelay(2000);
+		return FAILURE;
+	}
+
+	if (input == 2)
+	{
+		
+		printf("  Enter external clock frequency in Hz ");
+		scanf("%d", &input);
+		if (isdigit(input) == 0  && input > 0 && input < 20000000)
+		{
+			printf("  External clk-source frequency set to %d \n", input);
+		}
+		else
+		{
+			printf("Invalid entry\n");
+			mdelay(2000);
+			return FAILURE;
+		}
+	}
+
+	ad5933_set_system_clk(device,
+		input == 1 ? AD5933_CONTROL_INT_SYSCLK : 
+									AD5933_CONTROL_EXT_SYSCLK,
+		input);
+
+	return 0;
+}
+
+static uint8_t set_vrange_and_pga_gain()
+{
+	int input;
+	uint8_t v_range = AD5933_RANGE_1000mVpp;
+
+	printf("  Select output voltage range:\n");
+	printf("    0: 2Vpp typical:\n");
+	printf("    1: 200mVpp typical:\n");
+	printf("    2: 400mVpp typical:\n");
+	printf("    3: 1Vpp typical:\n");
+
+
+	scanf("%d", &input);
+	if (input >= 0 && input < 4)
+	{
+		switch (input)
+		{
+		case AD5933_RANGE_2000mVpp: { 
+				printf("  Selected 2V pp typical.\n");
+				break;
+			}
+		case AD5933_RANGE_200mVpp: { 
+				printf("  Selected 200mV pp typical.\n");
+				break;
+			}
+		case AD5933_RANGE_400mVpp: { 
+				printf("  Selected 400mV pp typical.\n");
+				break;
+			}
+		case AD5933_RANGE_1000mVpp: { 
+				printf("  Selected 1V pp typical.\n");
+				break;
+			}
+		}
+		v_range = input;
+	}
+	else
+	{
+		printf("Invalid entry\n");
+		mdelay(2000);
+		return FAILURE;
+	}
+
+	printf("\n  Select PGA Gain (0=X5, 1=X1)\n");
+	scanf("%d", &input);
+	if (input >= 0 && input < 2)
+	{
+		config_data.pga_gain = input;
+		config_data.output_voltage_range = v_range;
+
+		printf("PGA gain set to : ");
+		input == AD5933_GAIN_X5 ? printf("X5\n\n") : printf("X1\n\n");
+		ad5933_set_range_and_gain(device, 
+			config_data.output_voltage_range,
+			config_data.pga_gain);
+	}
+	else
+	{
+		printf("Invalid entry: write aborted\n");
+		mdelay(2000);
+		return FAILURE;
+	}
+		
+
+	return SUCCESS;
+}
+
+static int32_t configure_system()
+{
+
+	printf("Configure the impedance meter\n\n");
+	set_vrange_and_pga_gain();
+	set_system_clock();
+
+	int start_freq;
+	int freq_inc;
+	int num_increments;
+	int num_settling_cycles;
+	int multiplier = AD5933_SETTLING_X1;
+
+	printf("\n  Enter start-frequency as a decimal number: ");
+	if (scanf("%d", &start_freq) == 1)
+	{
+		if (start_freq <= 0)
+		{
+			printf("  Invalid entry, write aborted: \n");
+			return FAILURE;
+		}
+	}
+
+
+	printf("\n  Enter frequency-increment as a decimal number: ");
+	scanf("%d", &freq_inc);
+	if (isdigit(freq_inc) != 0  || freq_inc <= 0)
+	{
+		printf("  Invalid entry, write aborted: \n");
+		return FAILURE;
+	}
+
+	printf("\n  Enter the number of increments as a decimal number: ");
+	printf("\n  Number of increments must be less than %d\n", MAX_FREQ_INCREMENTS);
+	scanf("%d", &num_increments);
+	if (isdigit(num_increments) != 0  || num_increments > MAX_FREQ_INCREMENTS)
+	{
+		printf("  Invalid entry, write aborted: \n");
+		return FAILURE;
+	}
+
+	printf("Enter the number of settling-time cycles before ADC is triggered.\n");
+	scanf("%d", &num_settling_cycles);
+	if (num_settling_cycles > MAX_SETTLING_CYCLES)
+	{
+		printf("  Invalid entry, write aborted: \n");
+		return FAILURE;
+	}
+
+	printf("Set the settling time multiplier (X1=0, X2=1, X4=2).\n");
+	scanf("%d", &multiplier);
+	if (multiplier > 2)
+	{
+		printf("  Invalid entry, write aborted: \n");
+		return FAILURE;
+	}
+	else
+	{   //adjust X4 option to match memory map
+		if (multiplier == 2) 
+			multiplier = AD5933_SETTLING_X4;
+	}
+
+	printf("\n    Setting start frequency to %d\n\r", (unsigned int)start_freq);
+	printf("    Setting frequency increment to %d\n\r", (unsigned int)freq_inc);
+	printf("    Setting the number of increments to %d\n\r", (unsigned int)num_increments);
+	printf("    Setting the number of settling-cycles to %d\n\r", (unsigned int)num_settling_cycles);
+	printf("    The multiplier for the settling-cycles %d\n\r", (unsigned int)multiplier+1);
+
+	//update device state
+	config_data.start_freq = start_freq;
+	config_data.frequency_increment = freq_inc;
+	config_data.number_increments = num_increments;
+	config_data.number_settling_cycles = num_settling_cycles;
+
+	ad5933_set_settling_time(device,multiplier,num_settling_cycles);
+	ad5933_set_range_and_gain(device, device->current_range, device->current_gain);
+	ad5933_config_sweep(device, start_freq, freq_inc, num_increments);
+
+	return SUCCESS;
+
+}
+
+static uint8_t calculate_gain_factor()
+{
+
+	double calibration_impedance;
+
+	printf("\n\nCalculate the gain-factor (see datasheet for information)\n");
+	printf("Calcualted gain-factor will be stored for impedance measurements and\n");
+	printf("displayed on the terminal screen.\n");
+	printf("Ensure that the system has been configured before\n");
+	printf("calculating the gain factor\n");
+              
+	ad5933_config_sweep(device,
+		config_data.start_freq, 
+		config_data.frequency_increment,
+		config_data.number_increments);
+
+    // Do standby, init-start freq, start the sweep, and wait for valid data
+	ad5933_start_sweep(device);
+   
+	printf("\nEnter calibration resistance in Ohms: ");
+	scanf("%le", &calibration_impedance);
+
+
+	printf("Calculating gain factor\n\r");
+
+	gain_factor = ad5933_calculate_gain_factor(device,
+		calibration_impedance,
+		AD5933_FUNCTION_REPEAT_FREQ);
+	printf("\n\r    Calculated gain factor %e\n\r", gain_factor);
+	
+	
+	return SUCCESS;
+}	
+
+
+
+
+static uint8_t guide()
+{
+
+	printf("\n\rAD5933-Demo quick-start guide: \n\n");
+	printf("This program can be used both as a demo of the AD5933 impedance \n");
+	printf("measurement system and as a starting point for developing a \n");
+	printf("more advanced program for prototyping. This program is not \n");
+	printf("provided as production-quality code, but as a helpful starting point.\n\n");
+
+	printf("As a quick start, the following steps can be implemented to ensure\n");
+	printf("firmware is communcating with the board and measurements taking place.\n\n");
+    
+	printf("Firstly - use menu option 1 to read the on-chip temperature.\n");
+	printf("If a realistic temperature comes back - you are good to go :)\n\n");
+    
+	printf("Step 1\tConnect a 200k Resistor across the SMA terminals of the PMOD 1A\n");
+	printf("Step 2\tSelect the 100k feedback resistor by pulling the SEL pin high\n");
+	printf("Step 2\tConfigure the impedance system with Menu Option 2\n");
+	printf("Step 3\tCalculate the gain factor with menu-item 3\n");
+	printf("Step 3\tReplace the 200k impedance across the SMA terminals with a \n");
+	printf("different 'unknown' impedance (300K perhaps)\n");
+	printf("Step 4\tRun the impedance measurement with menu-item 4\n");
+	printf("\tresults are dispayed on the terminal\n");
+    
+	return SUCCESS;
+}
+
+
+
+static uint8_t impedance_sweep() 
+{
+	printf("\nPerform a sweep to calculate an unknown impedance (see datasheet for information)\n");
+	printf("System should have been previously configured (Menu Option 2)\n");
+	printf("Impedance will be caculated and results shown.\n\r");
+
+	int32_t status = FAILURE;
+	double impedance;
+	float frequency = config_data.start_freq;
+
+	
+	ad5933_config_sweep(device,
+		config_data.start_freq, 
+		config_data.frequency_increment,
+		config_data.number_increments);
+
+	/*
+		> program frequency sweep parameters into relevant registerS
+		> place the ad5933 into standby mode.
+		> start frequency register
+		> number of increments register
+	*/
+	ad5933_start_sweep(device);
+	printf("\n  FREQUENCY MAGNITUDE   PHASE	IMPEDANCE\n");
+
+	do {
+
+		//Fill up the results struct with data
+		impedance = ad5933_calculate_impedance(device,
+			gain_factor,
+			AD5933_FUNCTION_INC_FREQ);
+
+		printf("  %.2f,", frequency);
+		printf("  %.2f\n", impedance);
+			
+		frequency += config_data.frequency_increment;
+
+		//poll the status register to check if frequency sweep is complete.
+		status = ad5933_get_register_value(device, AD5933_REG_STATUS, 1);
+		
+	} while ((status & AD5933_STAT_SWEEP_DONE) == 0);
+
+	return status;
+}
+
+
+
+	
diff -r 953fb3148f25 -r ca8fe90d3ab5 app/mbed_platform_drivers.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/mbed_platform_drivers.lib	Wed Oct 13 14:39:58 2021 +0530
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/AnalogDevices/code/platform_drivers/#5ae03a197e59
\ No newline at end of file
diff -r 953fb3148f25 -r ca8fe90d3ab5 app/no-OS.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/no-OS.lib	Wed Oct 13 14:39:58 2021 +0530
@@ -0,0 +1,1 @@
+https://github.com/analogdevicesinc/no-OS/#d14f824a6bee78881a277790310b12d9a3e822bd
\ No newline at end of file
diff -r 953fb3148f25 -r ca8fe90d3ab5 app_config.h
--- a/app_config.h	Tue Oct 29 21:42:57 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*************************************************************************//**
- *   @file   app_config.h
- *   @brief  Configuration file of AD5686 firmware example program
- *   @author ssmith (sean.smith@analog.com)
-******************************************************************************
-* Copyright (c) 2019 Analog Devices, Inc.  
-* 
-* All rights reserved.
-* 
-* Redistribution and use in source and binary forms, with or without 
-* modification, are permitted provided that the following conditions are met:
-*   - Redistributions of source code must retain the above copyright notice, 
-*     this list of conditions and the following disclaimer.
-*   - Redistributions in binary form must reproduce the above copyright notice, 
-*     this list of conditions and the following disclaimer in the documentation 
-*     and/or other materials provided with the distribution.  
-*   - Modified versions of the software must be conspicuously marked as such.
-*   - This software is licensed solely and exclusively for use with 
-*     processors/products manufactured by or for Analog Devices, Inc.
-*   - This software may not be combined or merged with other code in any manner 
-*     that would cause the software to become subject to terms and 
-*     conditions which differ from those listed here.
-*   - Neither the name of Analog Devices, Inc. nor the names of its 
-*     contributors may be used to endorse or promote products derived 
-*     from this software without specific prior written permission.
-*   - The use of this software may or may not infringe the patent rights 
-*     of one or more patent holders. This license does not release you from 
-*     the requirement that you obtain separate licenses from these patent 
-*     holders to use this software.
-* 
-* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" 
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-* NON-INFRINGEMENT, TITLE, MERCHANTABILITY AND FITNESS FOR A 
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, 
-* INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
-* SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES 
-* (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF 
-* INTELLECTUAL PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE 
-* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
-* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-* POSSIBILITY OF SUCH DAMAGE.
-* 
-* 20180927-7CBSD SLA
-*****************************************************************************/
-
-#ifndef _APP_CONFIG_H_
-#define _APP_CONFIG_H_
-
-#include <stdint.h>
-#include "platform_drivers.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-#ifdef __cplusplus
-#include "ad5933.h"
-}
-#endif
-
-
-#define  ARDUINO
-
-
-/**
-  The ADI SDP_K1 can be used with both arduino headers
-  or the 120-pin SDP connector found on ADI evaluation
-  boards. The default is the SDP connector
-
-  Uncomment the ARDUINO #define above to enable the ARDUINO connector
-
-*/
-//#warning  check this
-#ifdef ARDUINO
-	#define I2C_SCL     D15
-	#define I2C_SDA     D14
-
-	#define SPI_CS		D10
-	#define SPI_MISO	D12
-	#define SPI_MOSI	D11
-	#define SPI_SCK		D13
-
-	#define GAIN_PIN	D8 
-	#define RESET_PIN	D9 
-	#define LDAC_PIN	D7 
-	#define ADDR0_PIN	D6 
-#else
-	
-	#define I2C_SCL     SDP_I2C_SCL
-	#define I2C_SDA     SDP_I2C_SDA
-
-	#define SPI_CS		SDP_SPI_CS_A
-	#define SPI_MISO	SDP_SPI_MISO
-	#define SPI_MOSI	SDP_SPI_MOSI
-	#define SPI_SCK		SDP_SPI_SCK
-
-	#define GAIN_PIN	SDP_GPIO_0
-	#define RESET_PIN	SDP_GPIO_2
-	#define LDAC_PIN	SDP_GPIO_3
-	#define ADDR0_PIN	SDP_GPIO_4
-#endif
-
-#endif //_APP_CONFIG_H_
diff -r 953fb3148f25 -r ca8fe90d3ab5 main.cpp
--- a/main.cpp	Tue Oct 29 21:42:57 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,526 +0,0 @@
-/*************************************************************************//**
- *   @file   main.cpp
- *   @brief  Main application code for AD5686 firmware example program
- *   @author ssmith (sean.smith@analog.com)
-******************************************************************************
-* Copyright (c) 2019 Analog Devices, Inc.  
-* 
-* All rights reserved.
-* 
-* Redistribution and use in source and binary forms, with or without 
-* modification, are permitted provided that the following conditions are met:
-*   - Redistributions of source code must retain the above copyright notice, 
-*     this list of conditions and the following disclaimer.
-*   - Redistributions in binary form must reproduce the above copyright notice, 
-*     this list of conditions and the following disclaimer in the documentation 
-*     and/or other materials provided with the distribution.  
-*   - Modified versions of the software must be conspicuously marked as such.
-*   - This software is licensed solely and exclusively for use with 
-*     processors/products manufactured by or for Analog Devices, Inc.
-*   - This software may not be combined or merged with other code in any manner 
-*     that would cause the software to become subject to terms and 
-*     conditions which differ from those listed here.
-*   - Neither the name of Analog Devices, Inc. nor the names of its 
-*     contributors may be used to endorse or promote products derived 
-*     from this software without specific prior written permission.
-*   - The use of this software may or may not infringe the patent rights 
-*     of one or more patent holders. This license does not release you from 
-*     the requirement that you obtain separate licenses from these patent 
-*     holders to use this software.
-* 
-* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" 
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-* NON-INFRINGEMENT, TITLE, MERCHANTABILITY AND FITNESS FOR A 
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, 
-* INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
-* SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES 
-* (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF 
-* INTELLECTUAL PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE 
-* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
-* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-* POSSIBILITY OF SUCH DAMAGE.
-* 
-* 20180927-7CBSD SLA
-*****************************************************************************/
-
-#include <mbed.h>
-#include <ctype.h>
-#include "app_config.h"
-
-#define NOT_USED 0
-//Lower this value if storage becomes a problem
-#define MAX_FREQ_INCREMENTS 511
-#define TEMP_LIMIT_MIN -40
-#define TEMP_LIMIT_MAX 125 
-
-
-static void print_title(void);
-static void getMenuSelect(uint8_t *menuSelect);
-static void print_prompt();
-static uint8_t read_temperature();
-static uint8_t set_system_clock();
-static uint8_t set_vrange_and_pga_gain();
-static int32_t configure_system();
-static uint8_t calculate_gain_factor();
-static uint8_t guide();
-static uint8_t impedance_sweep();
-
-typedef struct ad5933_config_data {
-	float 	start_freq;
-	uint8_t pga_gain;
-	float 	output_voltage_range;
-	int32_t start_frequency;
-	int32_t frequency_increment;
-	int32_t number_increments;
-	int32_t number_settling_cycles;
-}ad5933_config_data;
-
-ad5933_config_data config_data;
-
-static double gain_factor = 0;
-static double temperature;
-
-
-/******************************************************************************/
-/************************** Variables Declarations ****************************/
-/******************************************************************************/
-
-/**
-	The following definitions are a requirement for the platform_driver
-	Pin are changed if required in the app_config.h file
- ***/
-mbed::SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS);
-mbed::I2C i2c(I2C_SDA, I2C_SCL);
-PinName slave_selects[MAX_SLAVE_SELECTS];
-
-i2c_init_param i2c_params =
-{
-	GENERIC_I2C,				// i2c type
-    0,							// i2c id
-	100000,						// i2c max speed (hz)
-	AD5933_ADDRESS << 1,		// i2c slave address //A0 tied high
-};
-
-
-ad5933_init_param init_params = {
-	i2c_params,					// I2C parameters 
-	AD5933_INTERNAL_SYS_CLK,	//current_sys_clk frequency (16MHz)
-	AD5933_CONTROL_INT_SYSCLK,	//current_clock_source
-	AD5933_RANGE_1000mVpp,		//current_gain
-	AD5933_GAIN_X1,				//current_range
-	AD5933_15_CYCLES,			//current_settling
-};
-
-ad5933_dev *device;
-int32_t connected = -1;
-Serial pc(USBTX, USBRX, 115200);
-
-
-int main()
-{
-	uint8_t menu_select = 0;
-	print_title();
-	connected = ad5933_init(&device, init_params);
-
-
-	//Do a quick check to ensure basic connectivity is ok
-	temperature  = ad5933_get_temperature(device);
-	if (temperature >= TEMP_LIMIT_MIN && temperature <= TEMP_LIMIT_MAX) {
-		pc.printf("\nTemperature: %f, AD5933 initialisation successful!\n",temperature);
-	}
-	else {
-		pc.printf("AD5933 initialisation reported a bad temperature - recommend debug :\n");
-	}
-
-	while (connected == SUCCESS) {
-		print_prompt();
-		getMenuSelect(&menu_select);
-		config_data.start_freq = 10000;
-
-		if (menu_select > 12)
-			print_prompt();
-		else switch (menu_select)
-			{
-			case 0: 
-				guide();
-				wait(2); 
-				break;
-
-			case 1:
-				read_temperature();
-				break;
-			case 2:
-				configure_system();
-				break;
-			case 3:
-				calculate_gain_factor();
-				break;
-			case 4:
-				impedance_sweep();
-				break;
-
-			default:
-				pc.printf("Invalid option: Ignored.");
-				break;
-			}
-
-			wait(0.1);
-		}
-
-		return 0;
-}
-
-//! Prints the title block
-void print_title()
-{
-	pc.printf("*****************************************************************\n");
-	pc.printf("* AD5933 Demonstration Program -- (mbed 1.0)                    *\n");
-	pc.printf("*                                                               *\n");
-	pc.printf("* This program demonstrates communication with the AD5933       *\n");
-	pc.printf("*                                                               *\n");
-	pc.printf("* 1 MSPS, 12-Bit Impedance Converter, Network analyser          *\n");
-	pc.printf("*                                                               *\n");
-	pc.printf("* Set the baud rate to 115200 select the newline terminator.    *\n");
-	pc.printf("*****************************************************************\n");
-}
-
-void print_prompt()
-{
-	pc.printf("\n\n\rCommand Summary:\n\n");
-	pc.printf("  0  -Software Guide\n");
-	pc.printf("  1  -Read temperature\n");
-	pc.printf("  2  -Configure voltage-range, PGA-Gain and sweep parameters\n");
-	pc.printf("  3  -Calculate Gain-Factor\n");
-	pc.printf("  4  -Do an impedance sweep\n");
-	pc.printf("\n\rMake a selection...\n");
-
-}
-
-
-static void getMenuSelect(uint8_t *menuSelect) {
-	pc.scanf("%d", (int *)menuSelect);
-}
-
-static uint8_t read_temperature()
-{
-	temperature = ad5933_get_temperature(device);
-
-	pc.printf("Current temperature:%.3f C", temperature);
-	return SUCCESS;
-}
-
-static uint8_t set_system_clock()
-{
-	pc.printf("  Select Internal (1) or external clock (2): ");
-
-	int input = 0;
-	pc.scanf("%d", &input);
-	if (isdigit(input) == 0 && (input == 1 || input == 2))
-	{
-		input == 1 ? pc.printf("\n  You selected Internal clock source\n") :
-			pc.printf("  You selected external Source clock source\n");
-	}
-	else
-	{
-		pc.printf("Invalid entry\n");
-		wait(2);
-		return FAILURE;
-	}
-
-	if (input == 2)
-	{
-		
-		pc.printf("  Enter external clock frequency in Hz ");
-		pc.scanf("%d", &input);
-		if (isdigit(input) == 0  && input > 0 && input < 20000000)
-		{
-			pc.printf("  External clk-source frequency set to %d \n", input);
-		}
-		else
-		{
-			pc.printf("Invalid entry\n");
-			wait(2);
-			return FAILURE;
-		}
-	}
-
-	ad5933_set_system_clk(device,
-		input == 1 ? AD5933_CONTROL_INT_SYSCLK : 
-									AD5933_CONTROL_EXT_SYSCLK,
-		input);
-
-	return 0;
-}
-
-static uint8_t set_vrange_and_pga_gain()
-{
-	int input;
-	uint8_t v_range = AD5933_RANGE_1000mVpp;
-
-	pc.printf("  Select output voltage range:\n");
-	pc.printf("    0: 2Vpp typical:\n");
-	pc.printf("    1: 200mVpp typical:\n");
-	pc.printf("    2: 400mVpp typical:\n");
-	pc.printf("    3: 1Vpp typical:\n");
-
-
-	pc.scanf("%d", &input);
-	if (input >= 0 && input < 4)
-	{
-		switch (input)
-		{
-		case AD5933_RANGE_2000mVpp: { 
-				pc.printf("  Selected 2V pp typical.\n");
-				break;
-			}
-		case AD5933_RANGE_200mVpp: { 
-				pc.printf("  Selected 200mV pp typical.\n");
-				break;
-			}
-		case AD5933_RANGE_400mVpp: { 
-				pc.printf("  Selected 400mV pp typical.\n");
-				break;
-			}
-		case AD5933_RANGE_1000mVpp: { 
-				pc.printf("  Selected 1V pp typical.\n");
-				break;
-			}
-		}
-		v_range = input;
-	}
-	else
-	{
-		pc.printf("Invalid entry\n");
-		wait(2);
-		return FAILURE;
-	}
-
-	pc.printf("\n  Select PGA Gain (0=X5, 1=X1)\n");
-	pc.scanf("%d", &input);
-	if (input >= 0 && input < 2)
-	{
-		config_data.pga_gain = input;
-		config_data.output_voltage_range = v_range;
-
-		pc.printf("PGA gain set to : ");
-		input == AD5933_GAIN_X5 ? printf("X5\n\n") : printf("X1\n\n");
-		ad5933_set_range_and_gain(device, 
-			config_data.output_voltage_range,
-			config_data.pga_gain);
-	}
-	else
-	{
-		pc.printf("Invalid entry: write aborted\n");
-		wait(2);
-		return FAILURE;
-	}
-		
-
-	return SUCCESS;
-}
-
-static int32_t configure_system()
-{
-
-	pc.printf("Configure the impedance meter\n\n");
-	set_vrange_and_pga_gain();
-	set_system_clock();
-
-	int start_freq;
-	int freq_inc;
-	int num_increments;
-	int num_settling_cycles;
-	int multiplier = AD5933_SETTLING_X1;
-
-	pc.printf("\n  Enter start-frequency as a decimal number: ");
-	if (pc.scanf("%d", &start_freq) == 1)
-	{
-		if (start_freq <= 0)
-		{
-			pc.printf("  Invalid entry, write aborted: \n");
-			return FAILURE;
-		}
-	}
-
-
-	pc.printf("\n  Enter frequency-increment as a decimal number: ");
-	pc.scanf("%d", &freq_inc);
-	if (isdigit(freq_inc) != 0  || freq_inc <= 0)
-	{
-		pc.printf("  Invalid entry, write aborted: \n");
-		return FAILURE;
-	}
-
-	pc.printf("\n  Enter the number of increments as a decimal number: ");
-	pc.printf("\n  Number of increments must be less than %d\n", MAX_FREQ_INCREMENTS);
-	pc.scanf("%d", &num_increments);
-	if (isdigit(num_increments) != 0  || num_increments > MAX_FREQ_INCREMENTS)
-	{
-		pc.printf("  Invalid entry, write aborted: \n");
-		return FAILURE;
-	}
-
-	pc.printf("Enter the number of settling-time cycles before ADC is triggered.\n");
-	pc.scanf("%d", &num_settling_cycles);
-	if (num_settling_cycles > AD5933_MAX_SETTLING_CYCLES )
-	{
-		pc.printf("  Invalid entry, write aborted: \n");
-		return FAILURE;
-	}
-
-	pc.printf("Set the settling time multiplier (X1=0, X2=1, X4=2).\n");
-	pc.scanf("%d", &multiplier);
-	if (multiplier > 2)
-	{
-		pc.printf("  Invalid entry, write aborted: \n");
-		return FAILURE;
-	}
-	else
-	{   //adjust X4 option to match memory map
-		if (multiplier == 2) 
-			multiplier = AD5933_SETTLING_X4;
-	}
-
-	pc.printf("\n    Setting start frequency to %d\n\r", (unsigned int)start_freq);
-	pc.printf("    Setting frequency increment to %d\n\r", (unsigned int)freq_inc);
-	pc.printf("    Setting the number of increments to %d\n\r", (unsigned int)num_increments);
-	pc.printf("    Setting the number of settling-cycles to %d\n\r", (unsigned int)num_settling_cycles);
-	pc.printf("    The multiplier for the settling-cycles %d\n\r", (unsigned int)multiplier+1);
-
-	//update device state
-	config_data.start_freq = start_freq;
-	config_data.frequency_increment = freq_inc;
-	config_data.number_increments = num_increments;
-	config_data.number_settling_cycles = num_settling_cycles;
-
-	ad5933_set_settling_time(device,multiplier,num_settling_cycles);
-	ad5933_set_range_and_gain(device, device->current_range, device->current_gain);
-	ad5933_config_sweep(device, start_freq, freq_inc, num_increments);
-
-	return SUCCESS;
-
-}
-
-static uint8_t calculate_gain_factor()
-{
-
-	double calibration_impedance;
-
-	pc.printf("\n\nCalculate the gain-factor (see datasheet for information)\n");
-	pc.printf("Calcualted gain-factor will be stored for impedance measurements and\n");
-	pc.printf("displayed on the terminal screen.\n");
-	pc.printf("Ensure that the system has been configured before\n");
-	pc.printf("calculating the gain factor\n");
-              
-	ad5933_config_sweep(device,
-		config_data.start_freq, 
-		config_data.frequency_increment,
-		config_data.number_increments);
-
-    // Do standby, init-start freq, start the sweep, and wait for valid data
-	ad5933_start_sweep(device);
-   
-	pc.printf("\nEnter calibration resistance in Ohms: ");
-	pc.scanf("%le", &calibration_impedance);
-
-
-	pc.printf("Calculating gain factor\n\r");
-
-	gain_factor = ad5933_calculate_gain_factor(device,
-		calibration_impedance,
-		AD5933_FUNCTION_REPEAT_FREQ);
-	pc.printf("\n\r    Calculated gain factor %e\n\r", gain_factor);
-	
-	
-	return SUCCESS;
-}	
-
-
-
-
-static uint8_t guide()
-{
-
-	pc.printf("\n\rAD5933-Demo quick-start guide: \n\n");
-	pc.printf("This program can be used both as a demo of the AD5933 impedance \n");
-	pc.printf("measurement system and as a starting point for developing a \n");
-	pc.printf("more advanced program for prototyping. This program is not \n");
-	pc.printf("provided as production-quality code, but as a helpful starting point.\n\n");
-
-	pc.printf("As a quick start, the following steps can be implemented to ensure\n");
-	pc.printf("firmware is communcating with the board and measurements taking place.\n\n");
-    
-	pc.printf("Firstly - use menu option 1 to read the on-chip temperature.\n");
-	pc.printf("If a realistic temperature comes back - you are good to go :)\n\n");
-    
-	pc.printf("Step 1\tConnect a 200k Resistor across the SMA terminals of the PMOD 1A\n");
-	pc.printf("Step 2\tSelect the 100k feedback resistor by pulling the SEL pin high\n");
-	pc.printf("Step 2\tConfigure the impedance system with Menu Option 2\n");
-	pc.printf("Step 3\tCalculate the gain factor with menu-item 3\n");
-	pc.printf("Step 3\tReplace the 200k impedance across the SMA terminals with a \n");
-	pc.printf("different 'unknown' impedance (300K perhaps)\n");
-	pc.printf("Step 4\tRun the impedance measurement with menu-item 4\n");
-	pc.printf("\tresults are dispayed on the terminal\n");
-    
-	return SUCCESS;
-}
-
-
-
-static uint8_t impedance_sweep() {
-
-	ad5933_result results;
-
-	pc.printf("\nPerform a sweep to calculate an unknown impedance (see datasheet for information)\n");
-	pc.printf("System should have been previously configured (Menu Option 2)\n");
-	pc.printf("Impedance will be caculated and results shown.\n\r");
-
-	int32_t status = FAILURE;
-	double impedance;
-	float frequency = config_data.start_freq;
-
-	
-	ad5933_config_sweep(device,
-		config_data.start_freq, 
-		config_data.frequency_increment,
-		config_data.number_increments);
-
-	/*
-		> program frequency sweep parameters into relevant registerS
-		> place the ad5933 into standby mode.
-		> start frequency register
-		> number of increments register
-	*/
-	ad5933_start_sweep(device);
-	pc.printf("\n  FREQUENCY MAGNITUDE   PHASE	IMPEDANCE\n");
-
-	do {
-
-		//Fill up the results struct with data
-		results = ad5933_calculate_impedance(device,
-			gain_factor,
-			AD5933_FUNCTION_INC_FREQ);
-
-		impedance =  1 / (results.magnitude * gain_factor);
-
-		pc.printf("  %.2f,", frequency);
-		pc.printf("  %.2f", results.magnitude);
-		pc.printf("  %.2f", results.phase);
-		pc.printf("  %.2f\n", impedance);
-			
-		frequency += config_data.frequency_increment;
-
-		//poll the status register to check if frequency sweep is complete.
-		status = ad5933_get_register_value(device, AD5933_REG_STATUS, 1);
-		
-	} while ((status & AD5933_STAT_SWEEP_DONE) == 0);
-
-	return status;
-}
-
-
-
-	
-
diff -r 953fb3148f25 -r ca8fe90d3ab5 mbed-os.lib
--- a/mbed-os.lib	Tue Oct 29 21:42:57 2019 +0000
+++ b/mbed-os.lib	Wed Oct 13 14:39:58 2021 +0530
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#9cab58358b338a3a7d7de258090bf0b500b2be97
+https://github.com/ARMmbed/mbed-os/#26606218ad9d1ee1c8781aa73774fd7ea3a7658e
\ No newline at end of file
diff -r 953fb3148f25 -r ca8fe90d3ab5 mbed_app.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Wed Oct 13 14:39:58 2021 +0530
@@ -0,0 +1,10 @@
+{
+    "requires": ["bare-metal"],
+    "target_overrides": {
+        "*": {
+            "platform.default-serial-baud-rate": 230400,
+            "target.printf_lib": "std",
+			"target.device_has_remove": ["CAN"]
+        }
+    }
+}
\ No newline at end of file
diff -r 953fb3148f25 -r ca8fe90d3ab5 platform_drivers.lib
--- a/platform_drivers.lib	Tue Oct 29 21:42:57 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/teams/AnalogDevices/code/platform_drivers/#efb143ea4191