본문으로 바로가기

[nRF52 ] gzll_ack_payload host 프로젝트

category Nordic_nRF52 2023. 1. 2. 19:45

목차

     

    0> 개요

      : device 에서 보낸 데이타에 대한 ACK 를 보내주는 프로젝트로 gazell 초기방법은 nrf_gzll_init()함수의 인자 값과

        nrf_gzll_enable() 함수만 사용하면 됩니다.

        device 프로젝트에서 사용하는 tx callback도 필요없고   대신 rx callback 함수를 작성해야 합니다.

         

      아래의 device 프로젝트도 참고하세요.

     https://leevisual.tistory.com/171

     

    [nRF52 ] gzll_ack_payload device 프로젝트

    목차 0> 개요 : gzll host 프로그램이 실행이 되어 있는 상태에서 동작합니다. 기능은 device에서 1바이트 데이타를 tx_fifo 로 전송을 하고 host 에서 ack 1바이트를 보내주는 프로그램으로 보내는 데이타

    leevisual.tistory.com

     

    1> 프로젝트위치

    <InstallFolder>\examples\proprietary_rf\gzll\gzll_ack_payload\host

     

     

    2> 노르딕 다큐먼트

    https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/gzll_examples_device_and_host.html

     

    nRF5 SDK v17.1.0: Device/Host example

    This example shows basic Gazell communication and demonstrates how to send payloads and acknowledgments. The example consists of two applications, one running on the device and one running on the host. The example also supports more advanced Gazell feature

    infocenter.nordicsemi.com

     

     

    3> 상세분석

      3-1> gazell 초기화

        // Initialize Gazell.
        nrf_gzll_init(NRF_GZLL_MODE_HOST);
        
        // Enable Gazell to start sending over the air.
        nrf_gzll_enable();

     

      3-2> callback 함수 분석

        : host 는 먼저 데이타를 보내야 할 이유가 없으므로 rx callback 만 작성하고 tx callback 함수는 더미로 만듭니다.

    // gazell 디바이스에서 데이타 전송시 호출되는 함수
    void nrf_gzll_host_rx_data_ready(uint32_t pipe, nrf_gzll_host_rx_info_t rx_info)
    {
        // Pop packet
        nrf_gzll_fetch_packet_from_rx_fifo(pipe,m_data_payload, &data_payload_length);
        
        // write first byte of the payload to the GPIO port.
        output_present(m_data_payload[0]);
        
        // Read buttons
        m_ack_payload[0] = input_get();
        
        // load ACK payload into TX queue.
        nrf_gzll_add_packet_to_tx_fifo(pipe, m_ack_payload, TX_PAYLOAD_LENGTH);    
        --> 정상적으로 위의 ACK가 보내지면 device 측에서 nrf_gzll_device_tx_success()함수가 호출됩니다.
    }
    
    void nrf_gzll_device_tx_success(uint32_t pipe, nrf_gzll_device_tx_info_t tx_info)
    {
    }
    
    void nrf_gzll_device_tx_failed(uint32_t pipe, nrf_gzll_device_tx_info_t tx_info)
    {
    }

     

     

     

     

     

     

    <기타>

    ▶ Serial log

    <info> app_timer: RTC: initialized.
    <info> app: Gazell ACK payload example. Host mode.
    <info> app: Gzll ack payload host example started.
    
    <info> app: Total received packets:   1000
    <info> app: Total CRC failures:       000
    
    <info> app: Channel 0: 1000 packets received, 000 CRC failures.
    <info> app: Channel 1: 000 packets received, 000 CRC failures.
    <info> app: Channel 2: 000 packets received, 000 CRC failures.
    <info> app: Channel 3: 000 packets received, 000 CRC failures.
    <info> app: Channel 4: 000 packets received, 000 CRC failures.
    
    <info> app: Total received packets:   1000
    <info> app: Total CRC failures:       000
    
    <info> app: Channel 0: 1000 packets received, 000 CRC failures.
    <info> app: Channel 1: 000 packets received, 000 CRC failures.
    <info> app: Channel 2: 000 packets received, 000 CRC failures.
    <info> app: Channel 3: 000 packets received, 000 CRC failures.
    <info> app: Channel 4: 000 packets received, 000 CRC failures.

     

     

     

    Gazell star network

       : 하나의 호스트에 8개의 디바이스와 통신 할수 있습니다.

     

     

     

    ▶ Gazell 라이브러리 위치  

          .emProject 파일 내 검색
        <folder Name="nRF_Properitary_RF">
          <file file_name="../../../../../../../../components/proprietary_rf/gzll/gcc/gzll_nrf52_sd_resources_gcc.a" />
        </folder>

     

     

    그럼 수고하세요.

    반응형