This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

gzll:host tx fail,but rx success

hi all:

       My project need 4 devices communicat with 1 host ,all use nrf51822 chip,is it possible?Now i  have a problem ,when the third device communicate with the host ,will cause the host tx fail,and rx is ok .Then all device cant receive the host message!  Why does it happen?How to solve the problem?When two devices communicate with the host ,it works fine.

Parents
  • My project need 4 devices communicat with 1 host ,all use nrf51822 chip,is it possible?Now i  have a problem ,when the third device communicate with the host ,will cause the host tx fail,and rx is ok .Then all device cant receive the host message!  Why does it happen?How to solve the problem?When two devices communicate with the host ,it works fine.

     Communicating with 4 devices on one host should be possible, as long as you are using one device per RF pipe.

    Could you post a more detailed problem description, preferably with source code as well?

  • hi hakon ,thanks for your reply.

    My gazell parameter is


    handle->config.timeslot_period = 900;
    handle->config.gzll_mode = NRF_GZLL_MODE_DEVICE;
    handle->config.timeslots_per_channel = 2;
    handle->config.channel_table_size = 3;
    handle->config.tx_power = NRF_GZLL_TX_POWER_4_DBM;
    handle->config.data_rate = NRF_GZLL_DATARATE_1MBIT;
    handle->config.max_tx_attempts = 7;
    handle->config.base_address1 = MAC1;
    handle->config.prefix_byte = PREFIX_BYTE;

    void m_configure_next_event_init(void)
    {
    m_slot_length = 16000;//10000;
    m_timeslot_request.request_type = NRF_RADIO_REQ_TYPE_EARLIEST;
    m_timeslot_request.params.earliest.hfclk = NRF_RADIO_HFCLK_CFG_DEFAULT;//use DEFAULT more saving power than FORCE_XTAL
    m_timeslot_request.params.earliest.priority = NRF_RADIO_PRIORITY_HIGH;
    m_timeslot_request.params.earliest.length_us = m_slot_length; //ranges from 100 us to 100 ms.
    m_timeslot_request.params.earliest.timeout_us = 20000;//10000; //max(128000000UL - 1UL)us

    }
    void m_configure_next_event(void)
    {
    m_slot_length = 16000;//10000; //us
    m_timeslot_request.request_type = NRF_RADIO_REQ_TYPE_EARLIEST;
    m_timeslot_request.params.earliest.hfclk = NRF_RADIO_HFCLK_CFG_DEFAULT;//use DEFAULT more saving power than FORCE_XTAL
    m_timeslot_request.params.earliest.priority = NRF_RADIO_PRIORITY_HIGH;//NRF_RADIO_PRIORITY_NORMAL;
    m_timeslot_request.params.earliest.length_us = m_slot_length; //ranges from 100 us to 100 ms.
    m_timeslot_request.params.earliest.timeout_us = 20000; //15000max(128000000UL - 1UL)us

    }

    in devices ,I send message in function m_radio_callback():

    nrf_radio_signal_callback_return_param_t * m_radio_callback(uint8_t signal_type)
    {
    switch(signal_type)
    {
    case NRF_RADIO_CALLBACK_SIGNAL_TYPE_START: //0
    m_on_start();
    Comm_GzllModeSend(&Comm_Handle);//send message to host
    if(GZLL_Handle.GZLL_addr_change == true)
    {
    static uint8_t change_count;
    change_count++;
    if(change_count > 5)//make sure the address sent to the host
    {
    GZLL_Handle.GZLL_addr_change = false;
    m_gzll_initialized = false;
    change_count = 0;
    }
    }
    break;

    .....

    then device get ACK from nrf_gzll_device_tx_success() calling function nrf_gzll_fetch_packet_from_rx_fifo();

    Every device has a prefix byte .

    In host ,parameter is the same with devices.

    The host get devices message process like this:I have already disable crypt function.

     uint8_t   rx_data[6][NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH];

    nrf_gzll_host_rx_data_ready(uint32_t pipe, nrf_gzll_host_rx_info_t rx_info )
    {
    // uint8_t rx_data[NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH];
    uint32_t len = NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH;
    bool ack;

    GZLL_Handle.rssi = -rx_info.rssi;

    ack = nrf_gzll_fetch_packet_from_rx_fifo(pipe,rx_data[pipe],&len);
    if(true == ack)
    {
          g_pipe = pipe;

          if(pipe != PIPE)//pipe 5
         {
                //CRYPT_RxData_Decode(pipe,rx_data[pipe]);
               memcpy(&commKeyObj.Rec.Raw[0],&rx_data[pipe][2], GZP_CRYPT_USER_DATA_LENTH);//no crypt
               Gzll_SetState(GZLL_State_Connected);
               Gzll_CommFailCountClear();

               Comm_ReomteKeyDecode(pipe,&commKeyObj);
         }
        else
        {
               if(CRYPT_ENABLE == true)
                      CRYPT_RxData_Decode(PIPE,&rx_data[5][0]);
               else
               {
                     memcpy(&commObj.Rec.Raw[0],&rx_data[pipe][2], GZP_CRYPT_USER_DATA_LENTH);//no crypt
                     Gzll_SetState(GZLL_State_Connected);
                     Gzll_CommFailCountClear();
                }
               Comm_Decode(PIPE,&commObj);//answer the device
         }
       }
    }

    I call this function to answer the device.

    NOCRYPT_UserData_TX(uint32_t pipe,uint8_t *user_data)
    {
        uint8_t tx_packet[GZP_CRYPT_USER_DATA_REAL_LENTH];

        memcpy(&tx_packet[GZP_CMD_ENCRYPTED_USER_DATA_PAYLOAD], (uint8_t*)user_data,                           GZP_CRYPT_USER_DATA_LENTH);//45678 user data
       nrf_gzll_add_packet_to_tx_fifo(pipe,tx_packet,GZP_CRYPT_USER_DATA_REAL_LENTH);
    }

    now i found that my system can only have two devices communicat with host ,one more device will cause device fail,(every device has comm faill conut ),when this happen ,the fail device can call 

    nrf_gzll_device_tx_success()   function to fetch fifo,but 

    nrf_gzll_fetch_packet_from_rx_fifo()    return fall.

    The host receive is ok.

  • lilong said:

    now i found that my system can only have two devices communicat with host ,one more device will cause device fail,(every device has comm faill conut ),when this happen ,the fail device can call 

    nrf_gzll_device_tx_success()   function to fetch fifo,but 

    nrf_gzll_fetch_packet_from_rx_fifo()    return fall.

    Have you checked if the add_packet_to_tx_fifo() on the host side succeeds? Depending on how you add packets to the hosts TX FIFO, it may be full. It's 3 packets deep.

     

    Kind regards,

    Håkon

  • Have you checked if the add_packet_to_tx_fifo() on the host side succeeds? Depending on how you add packets to the hosts TX FIFO, it may be full. It's 3 packets deep.

    what can i do if the host side add_packet_to_fifo() fail ?Call nrf_gzll_flush_tx_fifo() function before  adding packets to the host TX FIFO?

  • I found that the host side add_packet_to_tx_fifo() fail,and the error code is 

    NRF_GZLL_ERROR_CODE_INSUFFICIENT_PACKETS_AVAILABLE 
  • Calling nrf_gzll_ok_to_add_packet_to_tx_fifo() and nrf_gzll_flush_tx_fifo before nrf_gzll_add_packet_to_tx_fifo will still return false.

Reply Children
No Data
Related