Skip to content

Commit e8354f1

Browse files
committed
Example using the no_os_rtc API
Signed-off-by: Francisroi-Manabat_adi <[email protected]>
1 parent 62632eb commit e8354f1

File tree

9 files changed

+572
-0
lines changed

9 files changed

+572
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
PLATFORM=maxim
2+
TARGET=max32690
3+
4+
5+
include ../../tools/scripts/generic_variables.mk
6+
7+
include src.mk
8+
9+
include ../../tools/scripts/generic.mk
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
AD-APARD32690-SL no-OS Example Project
2+
======================================
3+
4+
.. no-os-doxygen::
5+
6+
Prerequisites
7+
-------------
8+
9+
Prior to building the project, a couple steps are necessary in order to get the Maxim Micros SDK and setup the environment. These are presented in the ***Build Prerequisites*** section of no-OS build guide available here: https://wiki.analog.com/resources/no-os/build .
10+
11+
The MaximSDK provides distributions of `arm-none-eabi-` GCC compiler + utilities and `OpenOCD`, so you don't have to install these separately.
12+
13+
Building the project
14+
--------------------
15+
16+
The project includes 2 different examples:
17+
18+
1. basic_example - may be selected by setting the APARD32690_BASIC_EXAMPLE = y (and all the other examples to n) in the main Makefile.
19+
This example is meant to print "Hello world" over UART0. Make sure to have jumpers in the position 2-3 on headers P50 and P55.
20+
21+
2. tcp_echo_server (selected by default) - may be selected by setting the APARD32690_ECHO_SERVER_EXAMPLE = y (and all the other examples to n) in the main Makefile.
22+
This will start a TCP server using the interface ADIN1110 is connected to (the default settings are IP: 192.168.97.40 port: 10000). It will reply back to the connected client with the
23+
characters it receives. The actual IP address, netmask, and gateway used at runtime are printed on the serial port connected through the debug adapter.
24+
25+
The host running the client may require network settings in order to communicate with a device using the 192.168.97.40 IP. These usually include manually adding a static IP for the host's network interface. You may go though the following guide on how to do this: https://wiki.analog.com/resources/no-os/misc_guides/static_ip_setting?rev=1715173602 (choose an IP in the 192.168.97.x/24 range that's different from the board's address).
26+
27+
The project may be tested by using netcat on the host:
28+
29+
.. code-block:: bash
30+
31+
netcat 192.168.97.40 10000
32+
33+
#. Open a terminal and navigate to this project directory (if building on Windows, `Git Bash` has to be used).
34+
35+
#. Type `make RELEASE=y -j`, in order to build the project. The `RELEASE` flag adds `-O2` optimization. It should be omitted during debugging.
36+
37+
A successful build should end with the following terminal output:
38+
39+
.. code-block:: bash
40+
41+
[11:11:27] [HEX] apard32690.hex
42+
[11:11:27] apard32690.hex is ready
43+
rm /home/xvr/MaximSDK_new/Libraries/CMSIS/Device/Maxim/MAX32690/Source/GCC/startup_max32690.s
44+
[11:11:21] Done (build/apard32690.elf)
45+
46+
The binary and executable files are now available in the `build` directory (`apard32690.hex` and `apard32690.elf` files).
47+
48+
Programming the MCU
49+
-------------------
50+
51+
Before the MCU can be programmed a few steps are necessary:
52+
53+
#. Replace the DAPLINK firmware for the MAX32625PICO. This is only required to be done one time.
54+
55+
* Download the firmware image from the following link: https://github.com/MaximIntegrated/max32625pico-firmware-images/raw/master/bin/max32625_max32650fthr_if_crc_swd_v1.0.6.bin .
56+
57+
* Make sure the MAX32625PICO is not connected to the PC.
58+
59+
* Press the button on the MAX32625PICO, and keep it pressed while you plug the USB cable in the MAX32625PICO.
60+
61+
* Release the button once you can see a `MAINTENANCE` drive being mounted.
62+
63+
* Copy the firmware binary file to the `MAINTANANCE` drive. It should unmount and a `DAPLINK` drive should appear instead.
64+
65+
#. Connect the MAX32625PICO board to the PC and the APARD32690 board. If everything went well, you should see a mass storage device named `DAPLINK` in your filesystem.
66+
67+
#. Power on the APARD32690 board.
68+
69+
The microcontroller may be programmed in 2 ways:
70+
1. Drag-and-drop the binary (.hex) file in the `DAPLINK` directory. The drive should be unmounted and mounted again, once the programming is done.
71+
2. While in the project's root directory, type `make RELEASE=y run`. This method uses OpenOCD in order to load the binary file. If the programming is successful, you should see the following terminal output:
72+
73+
.. code-block:: bash
74+
75+
** Programming Started **
76+
** Programming Finished **
77+
** Verify Started **
78+
** Verified OK **
79+
** Resetting Target **
80+
shutdown command invoked
81+
[11:27:42] apard32690.elf uploaded to board

projects/max32690_rtc_test/src.mk

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
include $(PROJECT)/src/examples/examples_src.mk
2+
3+
SRCS += $(PROJECT)/src/examples/main.c
4+
5+
INCS += $(PROJECT)/src/common/common_data.h
6+
SRCS += $(PROJECT)/src/common/common_data.c
7+
8+
INCS += $(PROJECT)/src/examples/basic_example/basic_example.h
9+
SRCS += $(PROJECT)/src/examples/basic_example/basic_example.c
10+
11+
SRCS += $(DRIVERS)/api/no_os_uart.c \
12+
$(DRIVERS)/api/no_os_irq.c \
13+
$(DRIVERS)/api/no_os_spi.c \
14+
$(DRIVERS)/api/no_os_gpio.c \
15+
$(DRIVERS)/api/no_os_timer.c \
16+
$(DRIVERS)/api/no_os_rtc.c \
17+
$(DRIVERS)/api/no_os_dma.c \
18+
$(NO-OS)/util/no_os_fifo.c \
19+
$(NO-OS)/util/no_os_list.c \
20+
$(NO-OS)/util/no_os_lf256fifo.c \
21+
$(NO-OS)/util/no_os_util.c \
22+
$(NO-OS)/util/no_os_alloc.c \
23+
$(NO-OS)/util/no_os_mutex.c
24+
25+
26+
INCS += $(INCLUDE)/no_os_delay.h \
27+
$(INCLUDE)/no_os_error.h \
28+
$(INCLUDE)/no_os_fifo.h \
29+
$(INCLUDE)/no_os_spi.h \
30+
$(INCLUDE)/no_os_init.h \
31+
$(INCLUDE)/no_os_timer.h \
32+
$(INCLUDE)/no_os_gpio.h \
33+
$(INCLUDE)/no_os_print_log.h \
34+
$(INCLUDE)/no_os_units.h \
35+
$(INCLUDE)/no_os_irq.h \
36+
$(INCLUDE)/no_os_dma.h \
37+
$(INCLUDE)/no_os_gpio.h \
38+
$(INCLUDE)/no_os_lf256fifo.h \
39+
$(INCLUDE)/no_os_list.h \
40+
$(INCLUDE)/no_os_uart.h \
41+
$(INCLUDE)/no_os_util.h \
42+
$(INCLUDE)/no_os_alloc.h \
43+
$(INCLUDE)/no_os_mutex.h \
44+
$(INCLUDE)/no_os_rtc.h
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/***************************************************************************//**
2+
* @file basic_example.c
3+
* @brief Implementation of the basic example for RTC.
4+
* @author Francis Roi Manabat ([email protected])
5+
********************************************************************************
6+
* Copyright 2023(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 "maxim_gpio.h"
36+
#include "maxim_spi.h"
37+
#include "maxim_uart.h"
38+
#include "maxim_irq.h"
39+
#include "no_os_rtc.h"
40+
#include "no_os_uart.h"
41+
#include "no_os_util.h"
42+
#include "no_os_error.h"
43+
#include "no_os_alloc.h"
44+
#include "no_os_gpio.h"
45+
#include "no_os_irq.h"
46+
#include "maxim_rtc.h"
47+
48+
struct max_uart_init_param uart_extra_ip = {
49+
.flow = MAX_UART_FLOW_DIS
50+
};
51+
52+
struct no_os_uart_init_param uart_ip = {
53+
.device_id = 2,
54+
.asynchronous_rx = false,
55+
.baud_rate = 115200,
56+
.size = NO_OS_UART_CS_8,
57+
.parity = NO_OS_UART_PAR_NO,
58+
.stop = NO_OS_UART_STOP_1_BIT,
59+
.extra = &uart_extra_ip,
60+
.platform_ops = &max_uart_ops,
61+
};
62+
63+
struct no_os_rtc_init_param rtc_ip = {
64+
.freq = 1,
65+
.load = 0,
66+
.platform_ops = &max_rtc_ops,
67+
.extra = NULL
68+
};
69+
70+
struct no_os_gpio_init_param led_ip = {
71+
.port = 0,
72+
.number = 14,
73+
.pull = NO_OS_PULL_UP,
74+
.platform_ops = &max_gpio_ops,
75+
.extra = &gpio_extra_ip,
76+
};
77+
struct no_os_gpio_init_param button_ip = {
78+
.port = 4,
79+
.number = 0,
80+
.pull = NO_OS_PULL_UP,
81+
.platform_ops = &max_gpio_ops,
82+
.extra = &gpio_extra_ip,
83+
};
84+
85+
struct max_gpio_init_param gpio_extra_ip = {
86+
.vssel = 1,
87+
};
88+
89+
struct no_os_irq_init_param rtc_irq_ip = {
90+
.irq_ctrl_id = 19,
91+
.platform_ops = &max_irq_ops,
92+
.extra = NULL,
93+
};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/***************************************************************************//**
2+
* @file basic_example.c
3+
* @brief Implementation of the basic example for RTC.
4+
* @author Francis Roi Manabat ([email protected])
5+
********************************************************************************
6+
* Copyright 2023(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 "no_os_uart.h"
37+
#include "no_os_util.h"
38+
#include "no_os_error.h"
39+
#include "maxim_uart.h"
40+
#include "maxim_uart_stdio.h"
41+
#include "maxim_gpio.h"
42+
#include "maxim_spi.h"
43+
44+
extern struct max_uart_init_param uart_extra_ip;
45+
extern struct no_os_uart_init_param uart_ip;
46+
extern struct no_os_rtc_init_param rtc_ip;
47+
extern struct no_os_gpio_init_param led_ip;
48+
extern struct no_os_gpio_init_param button_ip;
49+
extern struct no_os_irq_init_param rtc_irq_ip;
50+
extern struct max_gpio_init_param gpio_extra_ip;
51+
52+
53+
#endif /* __COMMON_DATA_H__ */

0 commit comments

Comments
 (0)