This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How can i read all CC2541 LLE counters?

Hi

I referenced the function(void PHY_ReadCounters( uint8 *cntPtr )) in phy.c to read all LLE counters. the code as following.

#define BLE_REG_BASE_ADDR     (0x6000)

#define BLE_NTXDONE        XREG((BLE_REG_BASE_ADDR  + 84))  // BLE_L_NTXDONE
#define BLE_NTXACK         XREG((BLE_REG_BASE_ADDR  + 85))  // BLE_L_NTXACK
#define BLE_NTXCTRLACK     XREG((BLE_REG_BASE_ADDR  + 86))  // BLE_L_NTXCTRLACK
#define BLE_NTXCTRL        XREG((BLE_REG_BASE_ADDR  + 87))  // BLE_L_NTXCTRL
#define BLE_NTXRETRANS     XREG((BLE_REG_BASE_ADDR  + 88))  // BLE_L_NTXRETRANS
#define BLE_NTX            XREG((BLE_REG_BASE_ADDR  + 89))  // BLE_NTX

...................

uint8 LLECnt[6] = {0};

 LLECnt[0] = BLE_NTXDONE;
 LLECnt[1] = BLE_NTXACK;
 LLECnt[2] = BLE_NTXCTRLACK;
 LLECnt[3] = BLE_NTXCTRL;
 LLECnt[4] = BLE_NTXRETRANS;
 LLECnt[5] = BLE_NTX;

...................

After sending out data to master, the value of array LLECnt doesn't change,is zero. i got the value of RFRAMCFG, is 0x08. so i should can access those registers. are there somethings i missed?  the BLE stack i used is 1.4.1. thanks in advance.

  • Hello Sword,

    This routines are used by the link layer. The counters are cleared by the task scheduler. Also note that the array is 12 bytes long:

    #define PHY_READ_COUNTERS( ptr ) \
    st( (*((ptr)+0)) = BLE_NTXDONE; \
    (*((ptr)+1)) = BLE_NTXACK; \
    (*((ptr)+2)) = BLE_NTXCTRLACK; \
    (*((ptr)+3)) = BLE_NTXCTRL; \
    (*((ptr)+4)) = BLE_NTXRETRANS; \
    (*((ptr)+5)) = BLE_NTX; \
    (*((ptr)+6)) = BLE_NRXOK; \
    (*((ptr)+7)) = BLE_NRXCTRL; \
    (*((ptr)+8)) = BLE_NRXNOK; \
    (*((ptr)+9)) = BLE_NRXIGNORED; \
    (*((ptr)+10)) = BLE_NRXEMPTY; \
    (*((ptr)+11)) = BLE_NRXFIFOFULL; \
    )

  • Hi

    Thanks for your reply. how can i get the value of them before they were cleared. thanks.

  • Hello Sword,
    There is not any easy way of doing this. What are you trying to achieve?
  • Hi Eirik V,

    i need to achive this situation:the slave sent out a lot of data to master(via notification,not indication).during data communication, the maste can't recive the data sent out by slave for some reasion(go beyond vaild range,distraction,etc)causing the connection is drop(the Tx FIFO will be freed).then when reconnection,the slave need to know the number of data that master had been recived successfully.so the slave can locate the rest of data that not successfully recived by master and retransmited the rest of data. in general, achive the data recovery.

    Is there a method to achive that. thanks.
  • Hello,
    Indications would do this for you, but it takes more time as you have to wait for the confirmation of each packet to propagat up the stack layers to your application. You could implement a characteristic that is written by the the Master to indicate how many packets that is received. Then the Slave can read this information to figure out which packets can be freed and which to send again. If you have to receive every packet successfully you could for example add a counter to the notification payload and use a bit array characteristic to indicate from the master which of the packets that is received successfully.
  • Hi Eirik V,

    Thank you very much, i am sorry to forget something. i can't use Indications. because the project i used is based on HIDEmuKbd, HOGP only support notification. what's more, i can't change the code of master, the master is the tablet (support HOGP)in the market. so, the information that can tell me master have been successfully recived the packet is the BLE_NTXACK, i can't think of other method.