Skip to content

Commit de60736

Browse files
Voc94amiclaus
authored andcommitted
projects: eval-adg1736: Add project for EVAL-ADG1736
Add no-OS project for the EVAL-ADG1736 evaluation board with MAX32655FTHR platform support. The project tests the ADG1736 dual SPDT analog switch routing using GPIO signals. Signed-off-by: Alexandru Vasile Popa <Alexandruvasile.Popa@analog.com>
1 parent 7af77dd commit de60736

File tree

10 files changed

+512
-0
lines changed

10 files changed

+512
-0
lines changed

projects/eval-adg1736/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
EXAMPLE ?= basic
2+
3+
include ../../tools/scripts/generic_variables.mk
4+
5+
include ../../tools/scripts/examples.mk
6+
7+
include src.mk
8+
9+
include ../../tools/scripts/generic.mk

projects/eval-adg1736/builds.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"maxim": {
3+
"basic_example": {
4+
"flags": "EXAMPLE=basic TARGET=max32655"
5+
}
6+
}
7+
}

projects/eval-adg1736/src.mk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
NO_OS_INC_DIRS += $(INCLUDE) \
2+
$(DRIVERS)/switch/adg1736
3+
4+
SRCS += $(DRIVERS)/api/no_os_gpio.c \
5+
$(DRIVERS)/api/no_os_irq.c \
6+
$(DRIVERS)/api/no_os_uart.c \
7+
$(DRIVERS)/api/no_os_dma.c \
8+
$(NO-OS)/util/no_os_lf256fifo.c \
9+
$(NO-OS)/util/no_os_util.c \
10+
$(NO-OS)/util/no_os_alloc.c \
11+
$(NO-OS)/util/no_os_mutex.c \
12+
$(NO-OS)/util/no_os_list.c
13+
14+
SRCS += $(DRIVERS)/switch/adg1736/adg1736.c
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/***************************************************************************//**
2+
* @file common_data.c
3+
* @brief Defines common data to be used by eval-adg1736 project.
4+
* @author Alexandru Vasile Popa (Alexandruvasile.Popa@analog.com)
5+
********************************************************************************
6+
* Copyright 2026(c) Analog Devices, Inc.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions are met:
10+
*
11+
* 1. Redistributions of source code must retain the above copyright notice,
12+
* this list of conditions and the following disclaimer.
13+
*
14+
* 2. Redistributions in binary form must reproduce the above copyright notice,
15+
* this list of conditions and the following disclaimer in the documentation
16+
* and/or other materials provided with the distribution.
17+
*
18+
* 3. Neither the name of Analog Devices, Inc. nor the names of its
19+
* contributors may be used to endorse or promote products derived from this
20+
* software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. "AS IS" AND ANY EXPRESS OR
23+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25+
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31+
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
*******************************************************************************/
33+
#include "common_data.h"
34+
35+
struct no_os_uart_init_param adg1736_uart_ip = {
36+
.device_id = UART_DEVICE_ID,
37+
.baud_rate = UART_BAUDRATE,
38+
.size = NO_OS_UART_CS_8,
39+
.parity = NO_OS_UART_PAR_NO,
40+
.stop = NO_OS_UART_STOP_1_BIT,
41+
.platform_ops = UART_OPS,
42+
.extra = UART_EXTRA,
43+
};
44+
45+
static struct no_os_gpio_init_param gpio_en_ip = {
46+
.port = GPIO_EN_PORT,
47+
.number = GPIO_EN_PIN,
48+
.pull = NO_OS_PULL_NONE,
49+
.platform_ops = GPIO_OPS,
50+
.extra = GPIO_EXTRA,
51+
};
52+
53+
struct adg1736_init_param adg1736_ip = {
54+
.type = ADG1736,
55+
.gpio_in1 = {
56+
.port = GPIO_IN1_PORT,
57+
.number = GPIO_IN1_PIN,
58+
.pull = NO_OS_PULL_NONE,
59+
.platform_ops = GPIO_OPS,
60+
.extra = GPIO_EXTRA,
61+
},
62+
.gpio_in2 = {
63+
.port = GPIO_IN2_PORT,
64+
.number = GPIO_IN2_PIN,
65+
.pull = NO_OS_PULL_NONE,
66+
.platform_ops = GPIO_OPS,
67+
.extra = GPIO_EXTRA,
68+
},
69+
.gpio_en = &gpio_en_ip,
70+
};
71+
72+
/* LEDs */
73+
struct no_os_gpio_init_param led_red_ip = {
74+
.port = LED_RED_PORT,
75+
.number = LED_RED_PIN,
76+
.pull = NO_OS_PULL_NONE,
77+
.platform_ops = GPIO_OPS,
78+
.extra = GPIO_EXTRA,
79+
};
80+
81+
struct no_os_gpio_init_param led_green_ip = {
82+
.port = LED_GREEN_PORT,
83+
.number = LED_GREEN_PIN,
84+
.pull = NO_OS_PULL_NONE,
85+
.platform_ops = GPIO_OPS,
86+
.extra = GPIO_EXTRA,
87+
};
88+
89+
/* Test signal GPIOs */
90+
struct no_os_gpio_init_param gpio_d_ip = {
91+
.port = GPIO_D_PORT,
92+
.number = GPIO_D_PIN,
93+
.pull = NO_OS_PULL_NONE,
94+
.platform_ops = GPIO_OPS,
95+
.extra = GPIO_EXTRA,
96+
};
97+
98+
struct no_os_gpio_init_param gpio_s_ip = {
99+
.port = GPIO_S_PORT,
100+
.number = GPIO_S_PIN,
101+
.pull = NO_OS_PULL_DOWN,
102+
.platform_ops = GPIO_OPS,
103+
.extra = GPIO_EXTRA,
104+
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/***************************************************************************//**
2+
* @file common_data.h
3+
* @brief Defines common data to be used by eval-adg1736 project.
4+
* @author Alexandru Vasile Popa (Alexandruvasile.Popa@analog.com)
5+
********************************************************************************
6+
* Copyright 2026(c) Analog Devices, Inc.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions are met:
10+
*
11+
* 1. Redistributions of source code must retain the above copyright notice,
12+
* this list of conditions and the following disclaimer.
13+
*
14+
* 2. Redistributions in binary form must reproduce the above copyright notice,
15+
* this list of conditions and the following disclaimer in the documentation
16+
* and/or other materials provided with the distribution.
17+
*
18+
* 3. Neither the name of Analog Devices, Inc. nor the names of its
19+
* contributors may be used to endorse or promote products derived from this
20+
* software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. "AS IS" AND ANY EXPRESS OR
23+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25+
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31+
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
*******************************************************************************/
33+
#ifndef __COMMON_DATA_H__
34+
#define __COMMON_DATA_H__
35+
36+
#include "parameters.h"
37+
#include "no_os_uart.h"
38+
#include "no_os_gpio.h"
39+
#include "adg1736.h"
40+
41+
extern struct no_os_uart_init_param adg1736_uart_ip;
42+
extern struct adg1736_init_param adg1736_ip;
43+
44+
/* LEDs */
45+
extern struct no_os_gpio_init_param led_red_ip;
46+
extern struct no_os_gpio_init_param led_green_ip;
47+
48+
/* Test signals */
49+
extern struct no_os_gpio_init_param gpio_d_ip;
50+
extern struct no_os_gpio_init_param gpio_s_ip;
51+
52+
#endif /* __COMMON_DATA_H__ */
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
/***************************************************************************//**
2+
* @file basic_example.c
3+
* @brief Basic example source file for eval-adg1736 project.
4+
* @author Alexandru Vasile Popa (Alexandruvasile.Popa@analog.com)
5+
********************************************************************************
6+
* Copyright 2026(c) Analog Devices, Inc.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions are met:
10+
*
11+
* 1. Redistributions of source code must retain the above copyright notice,
12+
* this list of conditions and the following disclaimer.
13+
*
14+
* 2. Redistributions in binary form must reproduce the above copyright notice,
15+
* this list of conditions and the following disclaimer in the documentation
16+
* and/or other materials provided with the distribution.
17+
*
18+
* 3. Neither the name of Analog Devices, Inc. nor the names of its
19+
* contributors may be used to endorse or promote products derived from this
20+
* software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. "AS IS" AND ANY EXPRESS OR
23+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25+
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31+
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
*******************************************************************************/
33+
34+
#include "common_data.h"
35+
#include "no_os_delay.h"
36+
#include "no_os_print_log.h"
37+
#include "no_os_gpio.h"
38+
#include "adg1736.h"
39+
40+
int example_main(void)
41+
{
42+
struct adg1736_dev *dev;
43+
struct no_os_uart_desc *uart;
44+
struct no_os_gpio_desc *led_green, *led_red;
45+
struct no_os_gpio_desc *gpio_d, *gpio_s;
46+
enum adg1736_state target_state;
47+
enum adg1736_switch test_sw;
48+
uint8_t s_val;
49+
int pass;
50+
int ret;
51+
52+
ret = no_os_uart_init(&uart, &adg1736_uart_ip);
53+
if (ret)
54+
return ret;
55+
no_os_uart_stdio(uart);
56+
57+
pr_info("\r\n=== ADG1736 Switch Test ===\r\n");
58+
pr_info("Testing SW%d, %s side\r\n", TEST_SWITCH + 1,
59+
TEST_SIDE == 0 ? "A" : "B");
60+
pr_info("Pins: IN=P1.6, EN=P1.7, D=P1.8, S=P1.9\r\n\r\n");
61+
62+
/* Initialize LEDs */
63+
ret = no_os_gpio_get(&led_green, &led_green_ip);
64+
if (ret)
65+
goto err_uart;
66+
ret = no_os_gpio_direction_output(led_green, NO_OS_GPIO_HIGH);
67+
if (ret)
68+
goto err_led_green;
69+
70+
ret = no_os_gpio_get(&led_red, &led_red_ip);
71+
if (ret)
72+
goto err_led_green;
73+
ret = no_os_gpio_direction_output(led_red, NO_OS_GPIO_HIGH);
74+
if (ret)
75+
goto err_led_red;
76+
77+
/* Initialize test GPIOs */
78+
ret = no_os_gpio_get(&gpio_d, &gpio_d_ip);
79+
if (ret)
80+
goto err_led_red;
81+
ret = no_os_gpio_direction_output(gpio_d, NO_OS_GPIO_HIGH);
82+
if (ret)
83+
goto err_d;
84+
85+
ret = no_os_gpio_get(&gpio_s, &gpio_s_ip);
86+
if (ret)
87+
goto err_d;
88+
ret = no_os_gpio_direction_input(gpio_s);
89+
if (ret)
90+
goto err_s;
91+
92+
/* Initialize ADG1736 driver */
93+
ret = adg1736_init(&dev, &adg1736_ip);
94+
if (ret)
95+
goto err_s;
96+
97+
/* Determine target state and switch based on TEST_SIDE and TEST_SWITCH */
98+
target_state = (TEST_SIDE == 0) ? ADG1736_CONNECT_A : ADG1736_CONNECT_B;
99+
test_sw = (TEST_SWITCH == 0) ? ADG1736_SW1 : ADG1736_SW2;
100+
101+
pr_info("Running continuous test...\r\n\r\n");
102+
103+
while (1) {
104+
/* Test 1: Set to target position, S should see D (HIGH) */
105+
ret = adg1736_set_switch_state(dev, test_sw, target_state);
106+
if (ret)
107+
break;
108+
no_os_mdelay(10);
109+
ret = no_os_gpio_get_value(gpio_s, &s_val);
110+
if (ret)
111+
break;
112+
pr_info("IN->%c: S=%d (expect 1) %s\r\n",
113+
TEST_SIDE == 0 ? 'A' : 'B',
114+
s_val, s_val == 1 ? "[PASS]" : "[FAIL]");
115+
pass = (s_val == 1);
116+
117+
no_os_mdelay(1000);
118+
119+
/* Test 2: Set to opposite position, S should be disconnected */
120+
ret = adg1736_set_switch_state(dev, test_sw,
121+
target_state == ADG1736_CONNECT_A ?
122+
ADG1736_CONNECT_B : ADG1736_CONNECT_A);
123+
if (ret)
124+
break;
125+
no_os_mdelay(10);
126+
ret = no_os_gpio_get_value(gpio_s, &s_val);
127+
if (ret)
128+
break;
129+
pr_info("IN->%c: S=%d (expect 0) %s\r\n",
130+
TEST_SIDE == 0 ? 'B' : 'A',
131+
s_val, s_val == 0 ? "[PASS]" : "[FAIL]");
132+
pass = pass && (s_val == 0);
133+
134+
/* Update LEDs */
135+
if (pass) {
136+
no_os_gpio_set_value(led_green, NO_OS_GPIO_LOW);
137+
no_os_gpio_set_value(led_red, NO_OS_GPIO_HIGH);
138+
pr_info("=== PASS ===\r\n\r\n");
139+
} else {
140+
no_os_gpio_set_value(led_green, NO_OS_GPIO_HIGH);
141+
no_os_gpio_set_value(led_red, NO_OS_GPIO_LOW);
142+
pr_info("=== FAIL ===\r\n\r\n");
143+
}
144+
145+
no_os_mdelay(2000);
146+
}
147+
148+
adg1736_remove(dev);
149+
err_s:
150+
no_os_gpio_remove(gpio_s);
151+
err_d:
152+
no_os_gpio_remove(gpio_d);
153+
err_led_red:
154+
no_os_gpio_remove(led_red);
155+
err_led_green:
156+
no_os_gpio_remove(led_green);
157+
err_uart:
158+
no_os_uart_remove(uart);
159+
return ret;
160+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/***************************************************************************//**
2+
* @file main.c
3+
* @brief Main file for eval-adg1736 project.
4+
* @author Alexandru Vasile Popa (Alexandruvasile.Popa@analog.com)
5+
********************************************************************************
6+
* Copyright 2026(c) Analog Devices, Inc.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions are met:
10+
*
11+
* 1. Redistributions of source code must retain the above copyright notice,
12+
* this list of conditions and the following disclaimer.
13+
*
14+
* 2. Redistributions in binary form must reproduce the above copyright notice,
15+
* this list of conditions and the following disclaimer in the documentation
16+
* and/or other materials provided with the distribution.
17+
*
18+
* 3. Neither the name of Analog Devices, Inc. nor the names of its
19+
* contributors may be used to endorse or promote products derived from this
20+
* software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. "AS IS" AND ANY EXPRESS OR
23+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25+
* EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28+
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31+
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
*******************************************************************************/
33+
34+
extern int example_main(void);
35+
36+
int main(void)
37+
{
38+
return example_main();
39+
}

0 commit comments

Comments
 (0)