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 Reply Children
  • Hi, it doesn't work. same to without modification.

    my app is this:

    1. nRF24 as PTX, nRF52 as PRX

    2. nRF24 send data to nRF52, it work well.

    3. nRF24 change to PRX mode, nRF52 send data to nRF24 (via nrf_esb_write_payload)

    this time, nRF52 nrf_esb_write_payload return success, can not receive TX Successful or TX Failed event.

    nRF24 can not receive data from nRF52.

  • @Chaw: If you actually don't receive data on nRF24 then it's not the bug with NO_ACK bit. We need to see how you configured on both side. Please base on the example in the SDK to add your configuration and send us your projects (both sides).

  • 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.

  • Hi Chaw,

    Are you sure it's correct, in your code it's nRF52 works as PRX.

    Also please upload the full project.

    Have you made sure you use NRF_ESB_LEGACY_CONFIG instead of NRF_ESB_DEFAULT_CONFIG in esb_init() ?

  • Hi,I have upload full project, nRF52 and nRF24

Related