This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to set nRF24 PTX with ack payload

Hi,Nordic now, nRF52 as PRX, nRX24 as PTX.

App process

  1. PTX send data via ESB, PRX can receive

    But nRF24 can not receive event HAL_NRF_TX_DS, why?

  2. Then nRF52 send payload, but nRF24 can not receive

If nRF52 as PTX, nRF24 as PRX, it's OK.

Could you tell me how to set nRF24?

Thanks.

nrf52_esb_prx.rar

nRF24_usb_hid_rf.rar

Parents
  • Hi Chaw,

    We are suspecting it was the bug with the inverted NO_ACK bit on the nRF5 ESB library.

    Could you try this workaround file to replace the original one and let me know if it fixed. Two modification been made on line 482 and 694.

    nrf_esb_NOACK_Fix.c

    [update] Here is an example of using nRF24LU1 as PTX and nRF52 as PRX with ACK payload.

    ptx - Copy.zip

    esb_prx - NoAckFix - Legacy.zip

  • nRF52 configuration:

    err_code = esb_init();
    APP_ERROR_CHECK(err_code);
    err_code = nrf_esb_start_rx();
    APP_ERROR_CHECK(err_code);
    
    void nrf_esb_event_handler(nrf_esb_evt_t const * p_event)
    {
        case NRF_ESB_EVENT_RX_RECEIVED:
    NRF_LOG_DEBUG("RX RECEIVED EVENT\r\n");
        if (nrf_esb_read_rx_payload(&rx_payload) == NRF_SUCCESS)
        {
          tx_payload.noack = false;
          if (nrf_esb_write_payload(&tx_payload) == NRF_SUCCESS)
          {}
        }
    }
    

    nRF24 Configuration:

    static void rf_config(void)
    {
        hal_nrf_get_clear_irq_flags();
        hal_nrf_flush_rx();
        hal_nrf_flush_tx();
    
        hal_nrf_enable_ack_payload(true);
        hal_nrf_enable_dynamic_payload(true);
        hal_nrf_setup_dynamic_payload(0xff);
    
       hal_nrf_set_power_mode(HAL_NRF_PWR_UP);
       hal_nrf_set_operation_mode(HAL_NRF_PTX);
       CE_LOW();
    }
    
    static void rf_send_buffer()
    {
      CE_LOW();
      hal_nrf_set_operation_mode(HAL_NRF_PTX);
      transmitted = false;
      hal_nrf_write_tx_payload(usb_out_buf, 32);
      CE_PULSE();
      radio_busy = true;
      while(radio_busy);
    }
    
    static void rf_receive_ms(uint16_t time_ms)
    {
      packet_received = false;
      hal_nrf_set_operation_mode(HAL_NRF_PRX);
      CE_HIGH();
      while(time_ms--)
      {
        if (packet_received)
          break;
        delay_ms(1);
      }
      CE_LOW();
    }
    

    on main()

       while(true)
       {
         rf_send_buffer();
         if (transmitted)
         {
           rf_receive_ms(10);
         }
       }
    

    Plz help me check.

Reply
  • nRF52 configuration:

    err_code = esb_init();
    APP_ERROR_CHECK(err_code);
    err_code = nrf_esb_start_rx();
    APP_ERROR_CHECK(err_code);
    
    void nrf_esb_event_handler(nrf_esb_evt_t const * p_event)
    {
        case NRF_ESB_EVENT_RX_RECEIVED:
    NRF_LOG_DEBUG("RX RECEIVED EVENT\r\n");
        if (nrf_esb_read_rx_payload(&rx_payload) == NRF_SUCCESS)
        {
          tx_payload.noack = false;
          if (nrf_esb_write_payload(&tx_payload) == NRF_SUCCESS)
          {}
        }
    }
    

    nRF24 Configuration:

    static void rf_config(void)
    {
        hal_nrf_get_clear_irq_flags();
        hal_nrf_flush_rx();
        hal_nrf_flush_tx();
    
        hal_nrf_enable_ack_payload(true);
        hal_nrf_enable_dynamic_payload(true);
        hal_nrf_setup_dynamic_payload(0xff);
    
       hal_nrf_set_power_mode(HAL_NRF_PWR_UP);
       hal_nrf_set_operation_mode(HAL_NRF_PTX);
       CE_LOW();
    }
    
    static void rf_send_buffer()
    {
      CE_LOW();
      hal_nrf_set_operation_mode(HAL_NRF_PTX);
      transmitted = false;
      hal_nrf_write_tx_payload(usb_out_buf, 32);
      CE_PULSE();
      radio_busy = true;
      while(radio_busy);
    }
    
    static void rf_receive_ms(uint16_t time_ms)
    {
      packet_received = false;
      hal_nrf_set_operation_mode(HAL_NRF_PRX);
      CE_HIGH();
      while(time_ms--)
      {
        if (packet_received)
          break;
        delay_ms(1);
      }
      CE_LOW();
    }
    

    on main()

       while(true)
       {
         rf_send_buffer();
         if (transmitted)
         {
           rf_receive_ms(10);
         }
       }
    

    Plz help me check.

Children
No Data
Related