Modified fomat and add low power
This commit is contained in:
parent
0266967898
commit
e8eaaed1fe
|
@ -1,5 +1,45 @@
|
||||||
Apollo2 MCU是基于Ambiq Micro的Apollo MCU产品系列的第二代控制器。
|
Apollo2 MCU是基于Ambiq Micro的Apollo MCU产品系列的第二代控制器。
|
||||||
Ambiq使用专利亚阈值功率优化技术(Subthreshold Power Optimized Technology, SPOT)平台来实现惊人的功耗降低,其功耗通常比性能相近的其它MCU产品降低5至10倍。
|
Ambiq使用专利亚阈值功率优化技术(Subthreshold Power Optimized Technology, SPOT)平台来实现惊人的功耗降低,其功耗通常比性能相近的其它MCU产品降低5至10倍。
|
||||||
Apollo2 MCU采用32位ARM Cortex-M4F微控制器,集成了高达1 MB的闪存和256 KB的RAM,以适应无线电和传感器开销,同时仍留有足够的应用代码空间。
|
Apollo2 MCU采用32位ARM Cortex-M4F微控制器,集成了高达1 MB的闪存和256 KB的RAM,以适应无线电和传感器开销,同时仍留有足够的应用代码空间。该微控制器还包括串行主机和UART端口,用于与无线电和传感器通信,包括加速度计,陀螺仪和磁力计。
|
||||||
|
|
||||||
board info:Apollo2 Evaluation Board(http://ambiqmicro.com/apollo-ultra-low-power-mcu/apollo2-mcu-20170703/)
|
Features
|
||||||
|
Ultra-low supply current
|
||||||
|
10 μA/MHz executing from flash at 3.3 V
|
||||||
|
10 μA/MHz executing from RAM at 3.3 V
|
||||||
|
|
||||||
|
High-performance ARM Cortex-M4 Processor
|
||||||
|
Up to 48 MHz clock frequency
|
||||||
|
Floating point unit
|
||||||
|
Memory protection unit
|
||||||
|
Wake-up interrupt controller with 32 interrupts
|
||||||
|
|
||||||
|
Ultra-low power memory:
|
||||||
|
Up to 1 MB of flash memory for code/data
|
||||||
|
Up to 256 KB of low leakage RAM for code/data
|
||||||
|
16kB 1 or 2-way Associative Cache
|
||||||
|
|
||||||
|
Ultra-low power interface for off-chip sensors:
|
||||||
|
14 bit, 15-channel, up to 1.2 MS/s ADC
|
||||||
|
Voltage Comparator
|
||||||
|
Temperature sensor with +/-2C accuracy
|
||||||
|
|
||||||
|
Flexible serial peripherals:
|
||||||
|
6x I2C/SPI master for communication with sensors,?radios, and other peripherals
|
||||||
|
1x I2C/SPI slave for host communications
|
||||||
|
2x UART for communication with peripherals and?legacy devices
|
||||||
|
PDM for mono and stereo audio microphone
|
||||||
|
|
||||||
|
Rich set of clock sources:
|
||||||
|
32.768 kHz XTAL oscillator
|
||||||
|
Low frequency RC oscillator – 1.024 kHz
|
||||||
|
High frequency RC oscillator – 48 MHz
|
||||||
|
RTC based on Ambiq’s AM08X5/18X5 families
|
||||||
|
|
||||||
|
Wide operating range: 1.8-3.6 V, –40 to 85°C
|
||||||
|
|
||||||
|
Compact package options:
|
||||||
|
2.5 x 2.5 mm 49-pin CSP with 34 GPIO
|
||||||
|
4.5 x 4.5 mm 64-pin BGA with 50 GPIO
|
||||||
|
|
||||||
|
Board info
|
||||||
|
Apollo2 Evaluation Board(http://ambiqmicro.com/apollo-ultra-low-power-mcu/apollo2-mcu-20170703/)
|
Binary file not shown.
After Width: | Height: | Size: 291 KiB |
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* File : application.c
|
* File : main.c
|
||||||
* This file is part of RT-Thread RTOS
|
* This file is part of RT-Thread RTOS
|
||||||
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include <stdint.h>
|
|
||||||
#ifdef RT_USING_FINSH
|
#ifdef RT_USING_FINSH
|
||||||
#include <finsh.h>
|
#include <finsh.h>
|
||||||
#include <shell.h>
|
#include <shell.h>
|
||||||
|
|
|
@ -1,11 +1,21 @@
|
||||||
/*
|
/*
|
||||||
* File : board.c
|
* File : board.c
|
||||||
* This file is part of RT-Thread RTOS
|
* This file is part of RT-Thread RTOS
|
||||||
* COPYRIGHT (C) 2009 RT-Thread Develop Team
|
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* found in the file LICENSE in this distribution or at
|
* it under the terms of the GNU General Public License as published by
|
||||||
* http://www.rt-thread.org/license/LICENSE
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
@ -19,11 +29,23 @@
|
||||||
#include "am_mcu_apollo.h"
|
#include "am_mcu_apollo.h"
|
||||||
#include "hal/am_hal_clkgen.h"
|
#include "hal/am_hal_clkgen.h"
|
||||||
#include "hal/am_hal_cachectrl.h"
|
#include "hal/am_hal_cachectrl.h"
|
||||||
#include "hw_uart.h"
|
#include "uart.h"
|
||||||
|
#include "led.h"
|
||||||
|
|
||||||
|
#ifdef __CC_ARM
|
||||||
|
extern int Image$$RW_IRAM1$$ZI$$Limit;
|
||||||
|
#define AM_SRAM_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit)
|
||||||
|
#elif __ICCARM__
|
||||||
|
#pragma section="HEAP"
|
||||||
|
#define AM_SRAM_BEGIN (__segment_end("HEAP"))
|
||||||
|
#else
|
||||||
|
extern int __bss_end;
|
||||||
|
#define NRF_SRAM_BEGIN (&__bss_end)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TICK_RATE_HZ RT_TICK_PER_SECOND
|
#define TICK_RATE_HZ RT_TICK_PER_SECOND
|
||||||
#define SYSTICK_CLOCK_HZ ( 32768UL )
|
#define SYSTICK_CLOCK_HZ ( 32768UL )
|
||||||
#define WAKE_INTERVAL ( (uint32_t) ((SYSTICK_CLOCK_HZ / TICK_RATE_HZ)) )
|
#define WAKE_INTERVAL ( (uint32_t) ((SYSTICK_CLOCK_HZ / TICK_RATE_HZ)))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the timer interrupt service routine.
|
* This is the timer interrupt service routine.
|
||||||
|
@ -53,13 +75,10 @@ void am_stimer_cmpr0_isr(void)
|
||||||
*/
|
*/
|
||||||
void SysTick_Configuration(void)
|
void SysTick_Configuration(void)
|
||||||
{
|
{
|
||||||
/* Set the main clk */
|
|
||||||
am_hal_clkgen_sysclk_select(AM_HAL_CLKGEN_SYSCLK_MAX);
|
|
||||||
|
|
||||||
/* Enable compare A interrupt in STIMER */
|
/* Enable compare A interrupt in STIMER */
|
||||||
am_hal_stimer_int_enable(AM_HAL_STIMER_INT_COMPAREA);
|
am_hal_stimer_int_enable(AM_HAL_STIMER_INT_COMPAREA);
|
||||||
|
|
||||||
/* Enable the timer interrupt in the NVIC */
|
/* Enable the timer interrupt in the NVIC, making sure to use the appropriate priority level */
|
||||||
am_hal_interrupt_enable(AM_HAL_INTERRUPT_STIMER_CMPR0);
|
am_hal_interrupt_enable(AM_HAL_INTERRUPT_STIMER_CMPR0);
|
||||||
|
|
||||||
/* Configure the STIMER and run */
|
/* Configure the STIMER and run */
|
||||||
|
@ -69,15 +88,6 @@ void SysTick_Configuration(void)
|
||||||
AM_HAL_STIMER_CFG_COMPARE_A_ENABLE);
|
AM_HAL_STIMER_CFG_COMPARE_A_ENABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the CacheCtrl Enable.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void CacheCtrl_Enable(void)
|
|
||||||
{
|
|
||||||
am_hal_cachectrl_enable(&am_hal_cachectrl_defaults);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the low power operation.
|
* This is the low power operation.
|
||||||
* This function enables several power-saving features of the MCU, and
|
* This function enables several power-saving features of the MCU, and
|
||||||
|
@ -100,7 +110,7 @@ void am_low_power_init(void)
|
||||||
|
|
||||||
/* Stop the XT and LFRC */
|
/* Stop the XT and LFRC */
|
||||||
am_hal_clkgen_osc_stop(AM_HAL_CLKGEN_OSC_XT);
|
am_hal_clkgen_osc_stop(AM_HAL_CLKGEN_OSC_XT);
|
||||||
// am_hal_clkgen_osc_stop(AM_HAL_CLKGEN_OSC_LFRC);
|
am_hal_clkgen_osc_stop(AM_HAL_CLKGEN_OSC_LFRC);
|
||||||
|
|
||||||
/* Disable the RTC */
|
/* Disable the RTC */
|
||||||
am_hal_rtc_osc_disable();
|
am_hal_rtc_osc_disable();
|
||||||
|
@ -112,7 +122,11 @@ void am_low_power_init(void)
|
||||||
*/
|
*/
|
||||||
void deep_power_save(void)
|
void deep_power_save(void)
|
||||||
{
|
{
|
||||||
|
am_hal_interrupt_master_disable();
|
||||||
|
|
||||||
am_hal_sysctrl_sleep(AM_HAL_SYSCTRL_SLEEP_DEEP);
|
am_hal_sysctrl_sleep(AM_HAL_SYSCTRL_SLEEP_DEEP);
|
||||||
|
|
||||||
|
am_hal_interrupt_master_enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,17 +134,34 @@ void deep_power_save(void)
|
||||||
*/
|
*/
|
||||||
void rt_hw_board_init(void)
|
void rt_hw_board_init(void)
|
||||||
{
|
{
|
||||||
/* Set the clock frequency */
|
/* Set the system clock to maximum frequency */
|
||||||
SysTick_Configuration();
|
am_hal_clkgen_sysclk_select(AM_HAL_CLKGEN_SYSCLK_MAX);
|
||||||
|
|
||||||
/* Set the default cache configuration */
|
/* Set the default cache configuration */
|
||||||
CacheCtrl_Enable();
|
am_hal_cachectrl_enable(&am_hal_cachectrl_defaults);
|
||||||
|
|
||||||
/* Configure the board for low power operation */
|
/* Configure the board for low power operation */
|
||||||
//am_low_power_init();
|
am_low_power_init();
|
||||||
|
|
||||||
|
/* Config SysTick */
|
||||||
|
SysTick_Configuration();
|
||||||
|
|
||||||
#ifdef RT_USING_IDLE_HOOK
|
#ifdef RT_USING_IDLE_HOOK
|
||||||
|
/* Set sleep deep mode */
|
||||||
rt_thread_idle_sethook(deep_power_save);
|
rt_thread_idle_sethook(deep_power_save);
|
||||||
|
|
||||||
|
#ifndef NO_FPU
|
||||||
|
/* Enable the floating point module, and configure the core for lazy stacking */
|
||||||
|
am_hal_sysctrl_fpu_enable();
|
||||||
|
am_hal_sysctrl_fpu_stacking_enable(true);
|
||||||
|
#else
|
||||||
|
am_hal_sysctrl_fpu_disable();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Turn off unused Flash & SRAM */
|
||||||
|
am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_FLASH512K);
|
||||||
|
am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_SRAM32K);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RT_USING_CONSOLE
|
#ifdef RT_USING_CONSOLE
|
||||||
|
@ -141,6 +172,10 @@ void rt_hw_board_init(void)
|
||||||
#ifdef RT_USING_COMPONENTS_INIT
|
#ifdef RT_USING_COMPONENTS_INIT
|
||||||
rt_components_board_init();
|
rt_components_board_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef RT_USING_HEAP
|
||||||
|
rt_system_heap_init((void*)AM_SRAM_BEGIN, (void*)AM_SRAM_END);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
|
@ -1,3 +1,26 @@
|
||||||
|
/*
|
||||||
|
* File : board.h
|
||||||
|
* This file is part of RT-Thread RTOS
|
||||||
|
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2017-09-14 Haley first implementation
|
||||||
|
*/
|
||||||
#ifndef __BOARD_H_
|
#ifndef __BOARD_H_
|
||||||
#define __BOARD_H_
|
#define __BOARD_H_
|
||||||
|
|
||||||
|
@ -10,7 +33,13 @@
|
||||||
|
|
||||||
/* USART driver select. */
|
/* USART driver select. */
|
||||||
#define RT_USING_UART0
|
#define RT_USING_UART0
|
||||||
#define RT_USING_UART1
|
//#define RT_USING_UART1
|
||||||
|
|
||||||
|
/* LED driver select. */
|
||||||
|
#define RT_USING_LED0
|
||||||
|
//#define RT_USING_LED1
|
||||||
|
//#define RT_USING_LED2
|
||||||
|
//#define RT_USING_LED3
|
||||||
|
|
||||||
void rt_hw_board_init(void);
|
void rt_hw_board_init(void);
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
*/
|
*/
|
||||||
void rt_hw_led_on(rt_uint8_t LEDNum)
|
void rt_hw_led_on(rt_uint8_t LEDNum)
|
||||||
{
|
{
|
||||||
|
#ifdef RT_USING_PIN
|
||||||
if(LEDNum == 0)
|
if(LEDNum == 0)
|
||||||
rt_pin_write(AM_GPIO_LED0, PIN_LOW);
|
rt_pin_write(AM_GPIO_LED0, PIN_LOW);
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ void rt_hw_led_on(rt_uint8_t LEDNum)
|
||||||
|
|
||||||
else if(LEDNum == 3)
|
else if(LEDNum == 3)
|
||||||
rt_pin_write(AM_GPIO_LED3, PIN_LOW);
|
rt_pin_write(AM_GPIO_LED3, PIN_LOW);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,6 +69,7 @@ void rt_hw_led_on(rt_uint8_t LEDNum)
|
||||||
*/
|
*/
|
||||||
void rt_hw_led_off(rt_uint8_t LEDNum)
|
void rt_hw_led_off(rt_uint8_t LEDNum)
|
||||||
{
|
{
|
||||||
|
#ifdef RT_USING_PIN
|
||||||
if(LEDNum == 0)
|
if(LEDNum == 0)
|
||||||
rt_pin_write(AM_GPIO_LED0, PIN_HIGH);
|
rt_pin_write(AM_GPIO_LED0, PIN_HIGH);
|
||||||
|
|
||||||
|
@ -78,6 +81,7 @@ void rt_hw_led_off(rt_uint8_t LEDNum)
|
||||||
|
|
||||||
else if(LEDNum == 3)
|
else if(LEDNum == 3)
|
||||||
rt_pin_write(AM_GPIO_LED3, PIN_HIGH);
|
rt_pin_write(AM_GPIO_LED3, PIN_HIGH);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,6 +95,7 @@ void rt_hw_led_off(rt_uint8_t LEDNum)
|
||||||
*/
|
*/
|
||||||
int rt_hw_led_init(void)
|
int rt_hw_led_init(void)
|
||||||
{
|
{
|
||||||
|
#ifdef RT_USING_PIN
|
||||||
#if defined(RT_USING_LED0)
|
#if defined(RT_USING_LED0)
|
||||||
/* config led */
|
/* config led */
|
||||||
rt_pin_mode(AM_GPIO_LED0, PIN_MODE_OUTPUT);
|
rt_pin_mode(AM_GPIO_LED0, PIN_MODE_OUTPUT);
|
||||||
|
@ -122,10 +127,10 @@ int rt_hw_led_init(void)
|
||||||
/* turns off the led */
|
/* turns off the led */
|
||||||
rt_hw_led_off(3);
|
rt_hw_led_off(3);
|
||||||
#endif /* RT_USING_LED1 */
|
#endif /* RT_USING_LED1 */
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef RT_USING_PIN
|
#ifdef RT_USING_COMPONENTS_INIT
|
||||||
INIT_BOARD_EXPORT(rt_hw_led_init);
|
INIT_BOARD_EXPORT(rt_hw_led_init);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
|
|
||||||
/* SECTION: RT_DEBUG */
|
/* SECTION: RT_DEBUG */
|
||||||
/* Thread Debug */
|
/* Thread Debug */
|
||||||
#define RT_DEBUG
|
//#define RT_DEBUG
|
||||||
//#define RT_DEBUG_INIT 1
|
//#define RT_DEBUG_INIT 1
|
||||||
#define RT_USING_OVERFLOW_CHECK
|
//#define RT_USING_OVERFLOW_CHECK
|
||||||
|
|
||||||
/* Using Hook */
|
/* Using Hook */
|
||||||
//#define RT_USING_HOOK
|
//#define RT_USING_HOOK
|
||||||
|
|
||||||
//#define RT_USING_IDLE_HOOK
|
#define RT_USING_IDLE_HOOK
|
||||||
|
|
||||||
#define IDLE_THREAD_STACK_SIZE 384
|
#define IDLE_THREAD_STACK_SIZE 384
|
||||||
|
|
||||||
|
@ -60,6 +60,9 @@
|
||||||
#define RT_USING_SMALL_MEM
|
#define RT_USING_SMALL_MEM
|
||||||
#define RT_USING_TINY_SIZE
|
#define RT_USING_TINY_SIZE
|
||||||
|
|
||||||
|
/* Using USER MAIN */
|
||||||
|
#define RT_USING_USER_MAIN
|
||||||
|
|
||||||
// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
|
// <bool name="RT_USING_COMPONENTS_INIT" description="Using RT-Thread components initialization" default="true" />
|
||||||
#define RT_USING_COMPONENTS_INIT
|
#define RT_USING_COMPONENTS_INIT
|
||||||
|
|
||||||
|
@ -78,13 +81,16 @@
|
||||||
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart1" />
|
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart1" />
|
||||||
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
||||||
|
|
||||||
|
/* Using GPIO pin framework */
|
||||||
|
#define RT_USING_PIN
|
||||||
|
|
||||||
// #define RT_USING_SPI
|
// #define RT_USING_SPI
|
||||||
|
|
||||||
/* SECTION: finsh, a C-Express shell */
|
/* SECTION: finsh, a C-Express shell */
|
||||||
#define RT_USING_FINSH
|
#define RT_USING_FINSH
|
||||||
/* configure finsh parameters */
|
/* configure finsh parameters */
|
||||||
#define FINSH_THREAD_PRIORITY 6
|
#define FINSH_THREAD_PRIORITY 6
|
||||||
#define FINSH_THREAD_STACK_SIZE 512
|
#define FINSH_THREAD_STACK_SIZE 1024
|
||||||
#define FINSH_HISTORY_LINES 1
|
#define FINSH_HISTORY_LINES 1
|
||||||
/* Using symbol table */
|
/* Using symbol table */
|
||||||
#define FINSH_USING_SYMTAB
|
#define FINSH_USING_SYMTAB
|
||||||
|
|
Loading…
Reference in New Issue