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.

CC2652R7: Logging the data of the peripheral device getting detected at central device.

Part Number: CC2652R7
Other Parts Discussed in Thread: SYSCONFIG

Is there a way I can save the information of the devices getting detected by the central device in a txt or csv file?

I tried adding the following piece of code under the case SC_EVT_ADV_REPORT of the SimpleCentral_processAppMsg() function - 

 char *filename = "test.txt";
FILE *fp = fopen(filename, "w");

fprintf(fp, "This is a number %d\n", 5);
fclose(fp);

The error I am getting is - unknown type name 'FILE' . 

If there is a better way to save the data for analysis purpose, please suggest that as well.

I want to detect few particular peripherals and count how many advertisements were received from them in a particular time frame and their other information like timestamps, RSSI value.

  • Hello Garvit, 

    Through CCS, you cannot use these functions to export data. If you are using the logging function within CCS, you can export data using the "Save data displayed in all current views" button. This button exports a .rod.json file containing the data to a desired folder. More information can be found at these links:

    SimpleLink MCU SDK Driver API Reference (ti.com)

    dev.ti.com/tirex/content/simplelink_cc13xx_cc26xx_sdk_7_10_00_98/examples/rtos/CC26X2R1_LAUNCHXL/drivers/log/README.html

    Thanks, 

    Isaac

  • Hello Issac,

    Is there some sample code for doing the same. I am new to this and an example would help me to grasp the concept faster. 

    Also, will the method I mentioned in question work with CCS-theia since it is based on visual studio code ?

    Thanks,

    Garvit

  • Hello Garvit, 

    First, the CC2652R7 is not supported on CCS-theia. You can find more information about which devices are supported currently by CCS-theia here, under Supported Products and Hardware. Lastly, if you would still like to use the log on CCS, this link will provide an example for the log within CCS. The example is under Examples>CC2652R7>TI Drivers>Log. Additionally, the readme presented in the last response can help with setup. 

    Thanks, 

    Isaac

  • Hi Isaac,

    I have imported the Log project in the CCS but I am still not able to configure it to work with the simple central project. Can you guide me how to combine these 2 projects?

    Thanks,

    Garvit

  • Hello Garvit, 

    Please refer to this FAQ. This FAQ is for the CC23XX but will work for the CC2652R7. When following these steps, do not add the file search path. This path is for the CC23XX specifically and will prevent your program from compiling. For more information, visit the API descriptions within the BLE 5 stack users guide and the readme within the log driver example

  • Hi Issac,

    Thanks for sharing the detailed process. I am getting error as shown in image below

    I have added the predefined symbol as suggested

    and the search path I gave is as follows

    I also tried adding the path of log folder under properties > Build > Arm Compiler> Include Options

    Thanks,

    Garvit

  • Hello Garvit, 

    I'm unable to replicate the error you are receiving. To summarize the steps, I am taking:


    1) I added the ti_log_Log_ENABLE to the Predefined Symbols section within the project Properties.

    2) I add the two log modules to the SysConfig, located at SysConfig->Logging->Log Modules. Additionally, I added the same Log Level Configurations to the Global Parameters within the SysConfig->Logging->Log Modules -> Global Parameters.

    3) Added the Includes into main.c and simple_peripheral.c.

    4) Added the log_printf into the main.c file, within the main function. 

    5) Debugged and started running the project. Opened Runtime Object View (ROV), navigated to LogSinkBuf, and refreshed the feed to see the log entries. 

    (I also added the file search path, and the include option you provided, the log feature worked with these included and without). 

    Could you please provide me with the steps you took leading up to the error? Additionally, can you provide me the SDK version you are using? 

    Thanks, 

    Isaac

  • Hello Garvit, 

    The file below is my working log example for the simple_peripheral project. This is on SDK 7.10. All the log function does for this project is output "Hello World!" onto the log. 

    5672.simple_peripheral_CC26X2R1_LAUNCHXL_tirtos7_ticlang.zip

    Thanks, 

    Isaac 

  • Hello Issac, 

    I am unable to decode the reason for the error - fatal error: 'ti/log/Log.h' file not found. I am still receiving the same error after repeating all the steps as suggested.

    Another thing I want to confirm is, in step 2 the log module are added in the log.syscfg so do we need to link it to simple_peripheral.syscfg file in some way because I don't see any log module in it.

    Is there any other way to include the log.h header file to the project ?

    I am working with ccs version 12.2.0.00009 and sdk version 7.10. Since the simple peripheral project attached is for different development board, it is not working with the CC2652R7 boards I have.

    Thanks,

    Garvit

  • Hello Garvit, 

    The logging feature started being supported on CCS 12.3. Can you update to the newest CCS version and then attempt using the logging feature? 

    Thanks, 

    Isaac

  • Hello Isaac,

    I am getting following error after updating CCS.

    Thanks,

    Garvit

  • Hello Garvit, 

    Can you double check the name of the log module in SysConfig matches the name of the log module in the Log_printf functions? 

     If this doesn't work, can you reply with pictures of everything you changed in SysConfig, your programs, and the properties of the project?

    Thanks, 

    Isaac

  • Hello Issac,

    I have checked the name for log modules - 

    The is still persisting. 

    SysConfig and properties changes - 

    I am working with the simple peripheral project example for CC2652R7 and I haven't made any other changes in the scripts than the ones suggested for activating the logging.

    Thanks,

    Garvit

  • Hello Garvit, 

    I am looking into the problem on the 7.10 SDK. I will get back to you sometime tomorrow. Sorry for the inconvenience. 

    Thanks, 

    Isaac

  • Hello Garvit, 

    Just for additional clarification are you on SDK version 7.10.01.24, or SDK version 7.10.00.98? Let me know!

    Thanks, 

    Isaac

  • Hello Issac,

    Thanks for all the efforts you are making. I am working with 7.10.00.98 SDK version.

    Regards,

    Garvit

  • Hello Garvit, 

    I have implemented the log driver on the simple peripheral project on your SDK and on the CC2652R7. I will attach it here. Please try importing the project and running it. 

    simpleperipheralCC2652R7.zip

    Thanks, 

    Isaac

  • Hello Issac,

    The project you shared is working with the logging activity but I am still not able to figure out the reason why it was not working earlier. I have tried implementing the steps in the simple_central code but I am still receiving same error.

    Did you implement it in a different way for this device? Also, I don't see any additional path added in the "File search path" option in the simple peripheral project you shared.

    Thanks,

    Garvit 

  • Hello Garvit, 

    Here is my logging example for simple central. simple_centralCC2652R7Log.zip

    Please try this project and let me know if it clears up your problem. 

    Additionally, can you send me the project you are attempting to implement the logging on, so I can look through it and see what was going wrong? 

    Thanks, 

    Isaac

  • Hello Issac, 

    Here is the project I was working on.

    simple_central_LP_CC2652R7_tirtos7_ticlang.zip

    Thanks,

    Garvit

  • Hello Garvit, 

    Thanks for sending me your project. Let me know if the project I sent works for you!

    Thanks, 

    Isaac

  • Hello Issac,

    First of all thanks a lot for all the help you have provided till now.

    The central project you sent is able to log the hello world but I am struggling to modify the syntax to capture the device address and RSSI values for the discovered devices in central project.

    I have added following piece of code under  "case SC_EVT_ADV_REPORT:" in "static void SimpleCentral_processAppMsg(scEvt_t *pMsg)" function of central project - 

    {
    GapScan_Evt_AdvRpt_t* pAdvRpt = (GapScan_Evt_AdvRpt_t*) (pMsg->pData);

    // === SOLUTION [Print scan results] ===
    //Print scan response data or advertising data
    if (pAdvRpt->evtType &= ADV_RPT_EVT_TYPE_SCAN_RSP)
    {
    Display_print1(dispHandle, 4, 0, "ScanResponseAddr: %s",
    Util_convertBdAddr2Str(pAdvRpt->addr));
    Display_print1(dispHandle, 5, 0, "ScanResponseData: %s",
    Util_convertBytes2Str(pAdvRpt->pData, pAdvRpt->dataLen));
    }
    else
    {
    Display_print2(dispHandle, 6, 0, "Advertising Addr: %s RSSI: %d",
    Util_convertBdAddr2Str(pAdvRpt->addr), pAdvRpt->rssi);

     Log_printf(LogModule_App1, Log_INFO, "RSSI = %d Address = %s ",pAdvRpt->rssi,Util_convertBdAddr2Str(pAdvRpt->addr));

    Display_print1(dispHandle, 7, 0, "Advertising Data: %s",
    Util_convertBytes2Str(pAdvRpt->pData, pAdvRpt->dataLen));

    }

    The code builds without error but the values logged in ROV are random and not equal to the ones displayed on terminal

    Thanks,

    Garvit

  • Hello Issac,

    Waiting for your response.

    Thanks,

    Garvit

  • Hello Garvit, 

    Sorry for the delay. The log driver does not currently allow for strings to be outputted by using %d and/or %s. For outputting large strings, please reference the Log_Buf feature. Let me know if you have any questions. 

    Thanks, 

    Isaac

  • Hello Issac,

    I am unable to locate the Log_Buf feature you are talking about. The link you shared takes to the BLE5 stack user guide and I tried finding the logging related information in various sub headings but I am not able to locate it. Can you mention the heading and sub heading as well for locating the information?

    Thanks,

    Garvit

  • Hello Garvit, 

    Sorry about that. Here is an updated link for the API. Again, let me know if you have any questions. 

    TI Utilities API: Log Interface

    Thanks, 

    Isaac

  • Hello Issac,

    I am still not able to log the rssi values and address of device using the Log_Buf . I tried adding the following piece of code -

    int8_t rssiValues = {pAdvRpt->rssi};
    Log_buf(LogModule_App1, Log_DEBUG, "The contents of bufferToLog are: ",rssiValues, sizeof(rssiValues));

    This syntax is also not able to log the RSSI values.

    Also, you mentioned - " The log driver does not currently allow for strings to be outputted by using %d and/or %s." but rssi is of int8_t data type. Why does the code Log_printf(LogModule_App1, Log_INFO, "RSSI = %d",pAdvRpt->rssi); doesn't work for logging the rssi values?.

    Thanks,

    Garvit

  • Hi Garvit,

    I hope you are doing well. I will be taking over this thread going forward. My apologies if I ask a question that has been asked previously in this thread as I am still catching up on this thread. Lets take a step back and check if the Log_printf() works with any variable. Could you ty to do something along the lines of the code shown below and let me know if you can see the output or not? I would like to make sure the printf function is working as expected before moving onto the RSSI functionality.

    Fullscreen
    1
    2
    int myVar = 5;
    Log_printf(LogModule_App1, Log_DEBUG, "The contents of myVar is %d ",myVar);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Best Regards,

    Jan

  • Hi Jan,

    Log_printf is working as expected. I can see the output as 5. Issue is I am not able to print the elements of structure "pAdvRpt"  like RSSI and device address in the "SimpleCentral_processAppMsg"  function of simple central code.

    Thanks,

    Garvit

  • Hi Garvit,

    Log_printf is working as expected.

    Very good! Thank you for confirming.

    Issue is I am not able to print the elements of structure "pAdvRpt"  like RSSI and device address in the "SimpleCentral_processAppMsg"  function of simple central code.

    Can you please open a new thread explaining your issue so we can have other team members commenting? In general, to help the quality of the discussion, it is best to limit each thread to one question.

    Thank you for your understanding.

    Best regards,

  • Sure, I can do that.

    Here is the updated link - Logging Issue

    Thanks,

    Garvit