본문 바로가기
임베디드.일렉트로닉스/nRF52

nRF52. Timer

by i.got.it 2018. 6. 11.

 

 

타이머수량. 

 

nRF52840 인 경우 5개 : Timer0, Timer1, Timer2, Timer3, Timer4. 

 

 

타이머 기능블럭.

 

타이머는 HFCLK (high frequency clock source) 와 4비트 프리스케일러로 구동된다. 

 

 

 

PCLK1M, PCLK16M 

- Timer 내부 Prescaler 의 설정값이 1MHz 이하인 경우 자동으로 PCLK1M 이 선택된다. (전력 절감목적)

 

PRESCALER

- 10비트폭. /2^n  의 n 값 설정에 해당. 예. 4를 설정하면 /2^4 = /16

 

START, STOP.

START 에 의하여 시작되고, STOP 에서 포즈된다. STOP 이후 다시 START 하면 이전 상태(STOP 시점의 상태)이후 부터 타이머 재개한다. 

 

BITMODE 

timer bit width 최대값 설정 

레지스터 주소 : 0x58 , 0 : 16bit , 1: 8bit, 2 : 24bit, 3: 32bit. 

 

 

CAPTURE, COMPARE

- 레지스터 CAPTURE[n] 트리거되면 카운터 값이 레지스터 CC[n] 에 복사된다. 

- 카운터값이 CC[n] 과 동일하면 COMPARE[n] 이벤팅 된다. 

 

PPI

- Timer event 로 다른 Peripheral 의 task 트리거 가능. 

- Timer event/task 로 GPIO 로 주기적인 출력 혹은 PWM 생성시 활용가능. 동시 사용가능한 수량은 GPIOTE 채널 수량에 준한다.

 

 

활용상 주의사항. 

PRESCALER , BITMODE 값 설정시 STOP 상태에서 해야 정확한 동작을 보장하며, START 상태에서 값 설정시 확정적 작동 보장안됨.

 

 

 

from : http://infocenter.nordicsemi.com/pdf/nRF52840_PS_v1.0.pdf  페이지 420

 

 

 

Timer Example Codes

 

 

 

nRF5 SDK v17.1.0: Timer Example

The Timer Example demonstrates the use of the timer peripherals. This example replaces the less accurate busy delay in the Blinky Example with a more accurate hardware timer based delay. When the application starts, some GPIO pins are configured as outputs

infocenter.nordicsemi.com

 

 

nRF5 SDK v17.1.0: Simple Timer Example

The Simple Timer Example demonstrates the usage of the Simple timer. It demonstrates the two modes of the module (single shot mode and repeated mode) to blink two LEDs. When the application starts, the GPIO pins are configured as outputs to drive the LEDs.

infocenter.nordicsemi.com

 

 

 

 

 


첫등록 : 2018년 6월 11일.

최종수정 : 2023.01.24

 

단축주소 : https://igotit.tistory.com/1698

 




 

댓글



 

비트코인




암호화폐       외환/나스닥/골드       암호화폐/외환/나스닥/골드 암호화폐/외환/나스닥/골드   암호화폐/외환/나스닥/골드
     
현물 |선물 인버스 |선물 USDT       전략매니저(카피트레이딩)     롤오버 이자 없는 스왑프리계좌
( 스왑프리 암호화폐도 거래 가능 )    
MT4, MT5 , cTrader 모두 지원     FTMO 계좌 매매운용. MT4,MT5