nRF52 WDT
WDT 활용 코드
- WDT 에서 지정한 시간 이내에 main while 문 내의 마지막 에 추가한 WDT리로드 함수 실행 되지 않으면 리셋된다. 즉, 어떤 사유이든 cpu 먹통 된 경우 WDT 가 자동 리셋 해준다.
#include "nrf_drv_wdt.h"
nrf_drv_wdt_channel_id m_channel_id;
static void wdt_event_handler(void)
{
//NOTE: The max amount of time we can spend in WDT interrupt is two cycles of 32768[Hz] clock - after that, reset occurs
}
static void init_wdt()
{
uint32_t err_code = NRF_SUCCESS;
//Configure WDT.
nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
config.reload_value = 5000 ; // in msec unit. 15-4294967295
err_code = nrf_drv_wdt_init(&config, wdt_event_handler);
APP_ERROR_CHECK(err_code);
err_code = nrf_drv_wdt_channel_alloc(&m_channel_id);
APP_ERROR_CHECK(err_code);
nrf_drv_wdt_enable();
}
main()
{
init_wdt(); //while 진입 직전에 wdt 활성화.
while(1){
nrf_drv_wdt_channel_feed(m_channel_id);// WDT reload 하여 WDT 리셋안되게 한다.
}
}
연관
nRF52 . reset
Reset Reason - nRF52 는 총12개의 리셋 요인 있고, 레지스터 RESETREAS 에서 어떤 요인에 의하여 리셋되었는지 확인 가능. - 레지스터에는 9개의 리셋요인만 있고, 9개 중 어느 것도 아닌 경우에는 파워온
igotit.tistory.com
상위 정리
https://igotit.tistory.com/244 의 nRF52
STM32. nRF52. ESP32. EFM8. EFM32. PSoC 활용 정리.
STM32. nRF52. ESP32. EFM8. EFM32. PSoC 총정리 제조사 칩 주요특징 실리콘랩 8bit MCU EFM8 시리즈 32bit EFM32 시리즈 EFM8 싸다. STM STM32 . 최고 항상 만족. Cypress pSoC pSoC6 은 기대해볼만. NORDIC nRF52 블투 무선솔루
igotit.tistory.com
첫 등록 : 2023.10.31
최종 수정 :
단축 주소 : https://igotit.tistory.com/4981
'임베디드.일렉트로닉스 > nRF52' 카테고리의 다른 글
nRF5 SDK . NRF_LOG_INFO 고속 출력시 표현 누락 해결책 (0) | 2023.08.24 |
---|---|
nRF5 SDK . sdk_config.h 엉망 체계. 해결 방법 (0) | 2023.08.05 |
nRF52 . 컴파일 에러 해결 . unknown type name 'nrf_dfu_set_adv_name_svci_async_t' (0) | 2023.08.04 |
SES . 해결 . #error "libc++ does not support using GCC with C++03. Please enable C++11" (0) | 2023.07.27 |
nRF52 . 코드에서 핀 리셋 용 GPIO 핀 연결 설정 . CONFIG_GPIO_AS_PINRESET (0) | 2023.07.26 |
댓글