Example program for EVAL-AD568x and EVAL-AD569x.

Dependencies:   adi_console_menu platform_drivers

EVAL-AD568x-AD569x

User Guide

This nanoDAC+ Mbed support software can be used as a starting point for developing your own firmware that targets Analog Devices nanoDAC+ products in your own environment. The software is configurable for your exact product within the nanoDAC+ family. See the user-guide for full instructions.

Files at this revision

API Documentation at this revision

Comitter:
Kjansen
Date:
Wed Jul 21 12:09:31 2021 +0100
Parent:
8:f38c1afe205b
Commit message:
Code improvement for EVAL-AD568x-AD569x

Changed in this revision

AD568x-AD569x.lib Show diff for this revision Revisions of this file
README.txt Show annotated file Show diff for this revision Revisions of this file
adi_console_menu.lib Show diff for this revision Revisions of this file
app/.mbedignore Show annotated file Show diff for this revision Revisions of this file
app/adi_console_menu.lib 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/nanodac_console_app.c 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
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 f38c1afe205b -r cce35eca2ab0 AD568x-AD569x.lib
--- a/AD568x-AD569x.lib	Mon Aug 03 10:39:17 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/teams/AnalogDevices/code/AD568x-AD569x/#ccb18842794d
diff -r f38c1afe205b -r cce35eca2ab0 README.txt
--- a/README.txt	Mon Aug 03 10:39:17 2020 +0000
+++ b/README.txt	Wed Jul 21 12:09:31 2021 +0100
@@ -52,31 +52,18 @@
 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-AD568x-AD569x/
-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. 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/nanodac-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 f38c1afe205b -r cce35eca2ab0 adi_console_menu.lib
--- a/adi_console_menu.lib	Mon Aug 03 10:39:17 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/teams/AnalogDevices/code/adi_console_menu/#dcc17e5a913f
diff -r f38c1afe205b -r cce35eca2ab0 app/.mbedignore
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/.mbedignore	Wed Jul 21 12:09:31 2021 +0100
@@ -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/
+no-OS/drivers/afe/
+no-OS/drivers/amplifiers/
+no-OS/drivers/axi_core/
+no-OS/drivers/cdc/
+no-OS/drivers/dac/ad54*
+no-OS/drivers/dac/ad562*
+no-OS/drivers/dac/ad57*
+no-OS/drivers/dac/ad7303/
+no-OS/drivers/dac/ad9*
+no-OS/drivers/dac/dac_demo/
+no-OS/drivers/ecg/
+no-OS/drivers/frequency/
+no-OS/drivers/gpio/
+no-OS/drivers/gyro/
+no-OS/drivers/i2c/
+no-OS/drivers/impedance-analyzer/
+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/
diff -r f38c1afe205b -r cce35eca2ab0 app/adi_console_menu.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/adi_console_menu.lib	Wed Jul 21 12:09:31 2021 +0100
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/AnalogDevices/code/adi_console_menu/#ced4fa6875ed
diff -r f38c1afe205b -r cce35eca2ab0 app/mbed_platform_drivers.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/mbed_platform_drivers.lib	Wed Jul 21 12:09:31 2021 +0100
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/AnalogDevices/code/platform_drivers/#af1f2416dd26
diff -r f38c1afe205b -r cce35eca2ab0 app/nanodac_console_app.c
--- a/app/nanodac_console_app.c	Mon Aug 03 10:39:17 2020 +0000
+++ b/app/nanodac_console_app.c	Wed Jul 21 12:09:31 2021 +0100
@@ -9,7 +9,7 @@
             The functions defined in this file performs the action
             based on user selected console menu.
  -----------------------------------------------------------------------------
- Copyright (c) 2020 Analog Devices, Inc.
+ Copyright (c) 2020-2021 Analog Devices, Inc.
  All rights reserved.
 
  This software is proprietary to Analog Devices, Inc. and its licensors.
@@ -29,7 +29,11 @@
 
 #include "ad5686.h"
 #include "platform_support.h"
-#include "platform_drivers.h"
+#include "delay.h"
+#include "error.h"
+#include "i2c.h"
+#include "spi.h"
+#include "gpio_extra.h"
 #include "i2c_extra.h"
 #include "spi_extra.h"
 
@@ -108,7 +112,7 @@
 /************************ Functions Declarations ******************************/
 /******************************************************************************/
 
-static void gpio_power_up_configuration(void);
+static int32_t gpio_power_up_configuration(void);
 
 /******************************************************************************/
 /************************ Functions Definitions *******************************/
@@ -139,33 +143,54 @@
 	struct ad5686_init_param nanodac_init_params = {
 		// i2c_init_param
 		{
-			100000,				// I2C max speed (Hz)
-			I2C_SLAVE_ADDRESS,	// I2C slave address
-			&i2c_init_extra_params	// I2C extra init parameters
+            .max_speed_hz = 100000,             // I2C max speed (Hz)
+            .slave_address = I2C_SLAVE_ADDRESS, // I2C slave address
+            .extra = &i2c_init_extra_params     // I2C extra init parameters
 		},
 
 		// spi_init_param
 		{
-			2000000, 			// SPI max speed (Hz)
-			SPI_SS, 			// Chip select
-			SPI_MODE_2,			// SPI Mode
-			&spi_init_extra_params	// SPI extra init parameters
+            .max_speed_hz = 2000000,        // SPI max speed (Hz)
+            .chip_select = SPI_SS,          // Chip select
+            .mode = SPI_MODE_2,             // SPI Mode
+            .extra = &spi_init_extra_params // SPI extra init parameters
 		},
 
 		// gpio_init_param
-		{ RESET_PIN, NULL }, 	// gpio_reset
-		{ LDAC_PIN, NULL },   	// gpio_ldac
-		{ GAIN_PIN, NULL },  	// gpio_gain
+        { 
+            .number = RESET_PIN,            // Reset GPIO Pin
+            .platform_ops = NULL, 
+            .extra =  NULL                  
+        },  
+        { 
+            .number = LDAC_PIN,             // LDAC GPIO Pin
+            .platform_ops = NULL, 
+            .extra =  NULL
+        },      
+        { 
+            .number = GAIN_PIN,             // Gain GPIO Pin
+            .platform_ops = NULL, 
+            .extra =  NULL
+        },
 
-		ACTIVE_DEVICE			// Active device
+        .act_device  = ACTIVE_DEVICE       // Active device
 	};
 
 	// Initialize the device
-	device_init_status = ad5686_init(&nanodac_dev, nanodac_init_params);
-
-	// Configure the GPIOs specific to application upon power-up
-	gpio_power_up_configuration();
-
+	do
+    {   
+        // Initialize the device
+        if((device_init_status = ad5686_init(&nanodac_dev, 
+            nanodac_init_params)) != SUCCESS)
+            break;
+        // Configure the GPIOs specific to application upon power-up
+        if((device_init_status = gpio_power_up_configuration()) != SUCCESS)
+            break;
+            
+        return device_init_status;
+    } while (0);
+    
+    ad5686_remove(&nanodac_dev);
 	return device_init_status;
 }
 
@@ -174,17 +199,16 @@
  * @brief      Set the power-up GPIO configurations
  * @return     None
  */
-static void gpio_power_up_configuration(void)
+static int32_t gpio_power_up_configuration(void)
 {
-	// Set the directions for GPIO pins
-	(void)gpio_direction_output(nanodac_dev->gpio_gain, GPIO_OUT);
-	(void)gpio_direction_output(nanodac_dev->gpio_ldac, GPIO_OUT);
-	(void)gpio_direction_output(nanodac_dev->gpio_reset, GPIO_OUT);
+	int32_t gpio_power_up_status = 0;   
 
 	// Set the GPIO values
-	gpio_set_value(nanodac_dev->gpio_reset, GPIO_HIGH);
-	gpio_set_value(nanodac_dev->gpio_gain, GPIO_LOW);
-	gpio_set_value(nanodac_dev->gpio_ldac, GPIO_HIGH);
+    gpio_power_up_status |= gpio_set_value(nanodac_dev->gpio_reset, GPIO_HIGH);
+    gpio_power_up_status |= gpio_set_value(nanodac_dev->gpio_gain, GPIO_LOW);
+    gpio_power_up_status |= gpio_set_value(nanodac_dev->gpio_ldac, GPIO_HIGH);
+    
+    return gpio_power_up_status;
 }
 
 
diff -r f38c1afe205b -r cce35eca2ab0 app/no-OS.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/no-OS.lib	Wed Jul 21 12:09:31 2021 +0100
@@ -0,0 +1,1 @@
+https://github.com/analogdevicesinc/no-OS/#d14f824a6bee78881a277790310b12d9a3e822bd
\ No newline at end of file
diff -r f38c1afe205b -r cce35eca2ab0 mbed-os.lib
--- a/mbed-os.lib	Mon Aug 03 10:39:17 2020 +0000
+++ b/mbed-os.lib	Wed Jul 21 12:09:31 2021 +0100
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#5941d1718339116cd12914238ec331c84da3d08f
+https://github.com/ARMmbed/mbed-os/#26606218ad9d1ee1c8781aa73774fd7ea3a7658e
diff -r f38c1afe205b -r cce35eca2ab0 mbed_app.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Wed Jul 21 12:09:31 2021 +0100
@@ -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 f38c1afe205b -r cce35eca2ab0 platform_drivers.lib
--- a/platform_drivers.lib	Mon Aug 03 10:39:17 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/teams/AnalogDevices/code/platform_drivers/#70fc373a5f46