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

nRF52. Radio TX 구현.

by i.got.it 2019. 1. 16.



개요

- 타겟보드 nRF52840 동글 에서  Radio Tx  구현 . 


- nRF5 SDK 에서 예제로 제공되는 /example/peripheral/radio/transmitter (프로젝트 설명문) 의 소스코드를 참조하여 구현하면 된다. 간단해서 상세 구현과정은 생략하고 최종 작동 결과 동영상. 





타겟보드 : nRF52840 Dongle






프로젝트 IDE 환경 

SES(SEGGER Embedded Studio) 에서 프로젝트 템플릿 기반. 상세보기 -> https://igotit.tistory.com/2023





코드


static uint32_t                   packet = 0;

void send_packet()
{
    // send the packet:
    NRF_RADIO->EVENTS_READY = 0U;
    NRF_RADIO->TASKS_TXEN   = 1;
    while (NRF_RADIO->EVENTS_READY == 0U) ;

    NRF_RADIO->EVENTS_END  = 0U;
    NRF_RADIO->TASKS_START = 1U;
    while (NRF_RADIO->EVENTS_END == 0U) ;

    NRF_RADIO->EVENTS_DISABLED = 0U;
    NRF_RADIO->TASKS_DISABLE = 1U;     // Disable radio
    while (NRF_RADIO->EVENTS_DISABLED == 0U) ;

}



int main(void)
{

  bsp_board_init(BSP_INIT_LEDS);


  nrf_drv_clock_init();
  nrf_drv_clock_hfclk_request(NULL); // for HF 32MHz external X-tal
  while(!nrf_drv_clock_hfclk_is_running()) ; // Just waiting
  nrf_drv_clock_lfclk_request(NULL); // for LF 32.768kHz external X-tal
  while(!nrf_drv_clock_lfclk_is_running()) ; // Just waiting


  radio_configure();
  NRF_RADIO->PACKETPTR = (uint32_t)&packet;   // Set payload pointer

  while(true)
  {

    send_packet();

    packet++;

    if(packet == 64){ NRF_RADIO->FREQUENCY++; packet=0; }
    if(NRF_RADIO->FREQUENCY == 80) NRF_RADIO->FREQUENCY = 0;
  }





구현결과  동작 확인

- Radio 주파수를 스윕 시키면서 1m 정도 떨어진 수신측은 nRF Connect 의 RSSI Viewer 를 이용하여 정상적으로 Radio 출력 되는지 확인. 의도한 대로 작동함 확인. 








 본 글 포함된 상위 정리글


 https://igotit.tistory.com/244 의 nRF52





첫등록 : 2019년 1월 16일 

최종수정 : 


본 글 단축주소 : https://igotit.tistory.com/2053







댓글



 

비트코인




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