embeded/ARM2012. 4. 4. 10:04
stellarisware를 설치하면 기본적으로 추가되는 예제를 추려내서 테스트 해보면 되는데,
대부분의 장비들이 굳이 하이버네이트 모드로 들어가는 행동을 취할수 없을때가 있다.
항상 켜져있어야 하는 장비인데, 언제꺼질지 모르지만 시간은 유지해야 한다면
하이버네이트 모드를 들어갈수 있는 시점을 정할수 없기 때문에 항상 하이버네이트 모드를 켜주면 된다.

C:\StellarisWare\boards\ek-lm3s1968\hibernate\hibernate.c
파일을 참고해서 추려내자면
static void SetRTCFucntion(void)
{
//	time_t current_time;
//	struct tm struct_time = { 0, 0, 10, 26,2,2012 - 1900,0,0,0};
//	current_time = mktime(&struct_time);
	
	SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
		HibernateEnableExpClk(SysCtlClockGet());
		HibernateClockSelect(HIBERNATE_CLOCK_SEL_DIV128);
		HibernateRTCEnable();
//		HibernateRTCSet(current_time);
		HibernateWakeSet(HIBERNATE_WAKE_PIN);
		HibernateRequest();
}

일단 RTC를 사용하려면 무조건 하이버네이트 장치를 사용하도록 해야한다.
    SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);

하이버네이트 모듈에 들어갈 클럭을 지정해주는데, 32.768Khz가 들어가거나 4.194304Mhz를 /128 해서 넣어주도록 한다.
    HibernateEnableExpClk(SysCtlClockGet());
    HibernateClockSelect(HIBERNATE_CLOCK_SEL_DIV128); // 4.194304 Mhz input divider to 32.768kHz

 하이버네이트 모듈에 내장된 RTC 를 사용하도록 설정하고
    HibernateRTCEnable(); 

원인은 알수 없지만 wakeup 조건을 반드시 설정해 주어야 하이버네이트 모드가 작동한다.
WAKE 핀은 NC 처리해도 작동에 이상은 없는듯 하다.
    HibernateWakeSet(HIBERNATE_WAKE_PIN); 

마지막으로 하이버네이트 모드를 들어가도록 요청한다.
    HibernateRequest(); 


RTC 시간은 배터리가 소진된 시점의 마지막 시간이 다음 부팅시까지 유지된다.

'embeded > ARM' 카테고리의 다른 글

KEIL Program Size 항목별 의미  (0) 2012.04.19
타이머 핸들러 시간 충돌 안나게 조절하기?  (0) 2012.04.13
TI LM3S1607 time epoch  (0) 2012.03.27
H-JTAG 에러이유?  (0) 2012.03.23
KEIL MDK(ARM)에 H-JTAG 사용하기  (0) 2012.03.23
Posted by 구차니
embeded/ARM2012. 3. 6. 09:55
ATMEL AVR을 쓰면 EEPROM이 있어서 무언가 저장할 공간이 있었는데
TI LM3S 시리즈를 보니 스펙상으로는 EEPROM이 존재를 하지 않는다.
편법일수도 있고, 가능할진 모르겠지만, 256byte의 NV memory가 존재하니 대신 사용해도 될듯?

10 Hibernation Module
10.1 Introduction

The Hibernate API provides a set of functions for using the Hibernation module on the Stellaris
microcontroller. The Hibernation module allows the software application to cause power to be
removed from the microcontroller, and then be powered on later based on specific time or a signal
on the external WAKE pin. The API provides functions to configure wake conditions, manage
interrupts, read status, save and restore program state information, and request hibernation mode.
Some of the features of the Hibernation module are:

32-bit real time clock
Trim register for fine tuning the RTC rate
Two RTC match registers for generating RTC events
External WAKE pin to initiate a wake-up
Low-battery detection
64 32-bit words of non-volatile memory
Programmable interrupts for hibernation events
This driver is contained in driverlib/hibernate.c, with driverlib/hibernate.h containing the API definitions for use by applications.  


아무튼 NVRAM을 사용하기 위한 함수는 다음과 같다. 
void HibernateDataGet (unsigned long ∗pulData, unsigned long ulCount)
void HibernateDataSet (unsigned long ∗pulData, unsigned long ulCount) 

---
2012.3.7 추가


hibernate module이 없는 모델도 있으니 주의!

'embeded > ARM' 카테고리의 다른 글

KEIL MDK(ARM)에 H-JTAG 사용하기  (0) 2012.03.23
lm flash example  (0) 2012.03.13
arm-linux-gcc 와 arm-elf-gcc의 차이점  (2) 2012.01.16
winARM  (0) 2012.01.12
ARM infocenter  (0) 2011.12.10
Posted by 구차니