TIDUF67 April 2024 – December 2024
The DATALOG module stores the real-time values of user selectable software variables (by default four variables) in the data RAM provided on the TI MCU as shown in Figure 4-29. The four variables are selected by configuring the module inputs to the address of the four variables. The starting addresses of the four RAM buffer locations are &((datalog).datalogBuff)[0], &((datalog).datalogBuff)[1], &((datalog).datalogBuff)[2] and &((datalog).datalogBuff)[3]. These Datalog buffers are large arrays that contain value-triggered data that can then be displayed to a graph. The datalog prescalar is configurable, which allows the data log function to only log one out of every prescalar samples. The number of data log buffers, buffer size and data type can be selected in the datalog_input.h file.
To enable the datalog functionality, the predefine symbol DATALOG_EN must be added in the project properties as shown in Figure 4-2.
The following code shows the declaration of one DATALOG object and handle. This code is located in the datalog.c file.
__attribute__ ((section("datalog_data"))) DATALOG_Obj datalog;
DATALOG_Handle datalogHandle; //!< the handle for the Datalog object
This puts data log object in the datalog_data section of memory. This section can be either TCM or OCRAM. Generally, we recommend to use OCRAM as TCM has limited size and needed by time critical part of software. Disable Data Cache to be able logging data in OCRAM in CCS12.6. To disable the data cache, Data Cache Enabled must be unchecked in the Tools > ARM Advanced Features as shown in Figure 4-30.
The following code shows the initialization and setting up of the datalog object, handle and parameters. This code is located in the sys_main.c file.
// Initialize Datalog
datalogHandle = DATALOG_init(&datalog, sizeof(datalog), manual, 0, 1);
DATALOG_Obj *datalogObj = (DATALOG_Obj *)datalogHandle;
The following code shows the configuration of the module inputs to point to the address of variables. The datalog module inputs point to different system variables depending on the build level. This code is located in the sys_main.c file:
datalogObj->iptr[0] = (float32_t*) &motorVars_M1.adcData.V_V.value[0];
datalogObj->iptr[1] = (float32_t*) &motorVars_M1.adcData.I_A.value[0];
datalogObj->iptr[2] = (float32_t*) &motorVars_M1.adcData.I_A.value[1];
datalogObj->iptr[3] = (float32_t*) &motorVars_M1.angleFOC_rad;
The following code shows the periodic updating of the datalog buffer with the new data during the execution of the motor1ctrlISR() interrupt. This code is located in the motor1_drive.c file.
#if defined(DATALOG_EN)
DATALOG_update(datalogHandle);
#endif // DATALOG_EN
The datalog module is used with the graph tool, which provides a means to visually inspect the variables and judge system performance. The graph tool is available in CCS, which can display arrays of data in various graphical types. The arrays of data are stored in a device’s memory in various formats.
While the project is in debug mode, open and setup time graph windows to plot the data log buffers as shown in Figure 4-31. Alternatively, the user can import the graph configurations files that are located in the project folder. To import them, Click: Tools -> Graph -> Single Time… and select import and browse to the following location <workspace>\universal_motorcontrol_am263x_r5fss0-0_nortos_ti-arm-clang\src_control\debug\ and select datalog.graphProp file. Hit OK, this adds the Graphs to your debug perspective. Click on Continuous Refresh button on the top left corner of the graph tab.