Tool/software: TI-RTOS
Hi everyone
Like title says, I want to see my log in an uart terminal, like this: http://processors.wiki.ti.com/index.php/CC26xx_Ouput_TI-RTOS_Log_statements_over_UART
But, I can't see anything on Putty:
So, as the image shows, I can establish the conection with the board, but I can't see anything.
Here are my codes:
main.c
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Log.h>
#include <xdc/runtime/Diags.h>
//Logs
#include <ti/uia/events/UIAEvt.h>
#include <ti/uia/events/UIAErr.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/knl/Semaphore.h>
/* TI-RTOS Header files */
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#include <ti/drivers/PIN.h>
/* Board Header files */
#include "Board.h"
/* External Files */
#include "display_balanza.h"
#include "uart_logs.h"
int main(void)
{
/* Call board init functions */
Board_initGeneral();
//Board_initI2C();
Log_info0("Board Initialized");
//UART PARA LOG
Board_initUART();
UART_init(); //Test
UART_Params uartParams;
UART_Params_init(&uartParams);
uartParams.baudRate = 115200;
UART_Handle hUart = UART_open(Board_UART, &uartParams);
// Initialize the logger output
UartLog_init(hUart);
Log_info0("UART Logger initialized");
//Inicializamos tarea I2C Slave
display_balanza_createTask();
Log_info0("Task 'display_balanza' created with success");
/* Start BIOS */
Log_info0("Starting BIOS");
BIOS_start();
return (0);
}
uart_logs.c and uart_logs.h were downloaded from here: http://processors.wiki.ti.com/index.php/File:Cc26xx_uart_log_loggercallback_example.zip
config.cfg
/* ================ TI-RTOS drivers' configuration ================ */
var driversConfig = xdc.useModule('ti.drivers.Config');
/*
* Include TI-RTOS drivers
*
* Pick one:
* - driversConfig.LibType_NonInstrumented (default)
* Use TI-RTOS drivers library optimized for footprint and performance
* without asserts or logs.
* - driversConfig.LibType_Instrumented
* Use TI-RTOS drivers library for debugging with asserts and logs enabled.
*/
driversConfig.libType = driversConfig.LibType_Instrumented;
//driversConfig.libType = driversConfig.LibType_Instrumented;
/* LOG CONFIGURATION */
// Remaining Modules
var Diags = xdc.useModule('xdc.runtime.Diags');
var Main = xdc.useModule('xdc.runtime.Main');
var Reset = xdc.useModule('xdc.runtime.Reset');
var UIAEvt = xdc.useModule('ti.uia.events.UIAEvt');
var UIAErr = xdc.useModule('ti.uia.events.UIAErr');
// Need Text loaded for formatting of Log_info/warning/error, but not for Log_print.
Text.isLoaded = true;
// Logging
var Log = xdc.useModule('xdc.runtime.Log');
// Override error output color with ANSI codes, and use shorter (file.c:line) format.
Log.L_error = {
mask: Diags.STATUS,
level: Diags.ERROR,
msg: "\x1b[31;1mERROR:\x1b[0m (%s:%d) %$S"
};
Log.L_info = {
mask: Diags.INFO,
msg: "\x1b[32;1mINFO:\x1b[0m (%s:%d) %$S"
};
Log.L_warning = {
mask: Diags.STATUS,
level: Diags.WARNING,
msg: "\x1b[33;1mWARNING:\x1b[0m (%s:%d) %$S"
};
// Pull in LoggerCallback
var LoggerCallback = xdc.useModule('xdc.runtime.LoggerCallback');
// Tell LoggerCallback to call our output function
LoggerCallback.outputFxn = "&uartLog_outputFxn";
// Tell the Idle module to add our flush() function to the idle loop (before Power)
//var Idle = xdc.useModule('ti.sysbios.knl.Idle'); // Add if Idle isn't already imported.
Idle.addFunc('&uartLog_flush');
// Create a static instance of LoggerCallback and set as default Main logger
var loggerParams = new LoggerCallback.Params();
loggerParams.arg = 1;
// Only for Main (code that's not in an rtsc module)
Main.common$.logger = LoggerCallback.create(loggerParams);
//Defaults.common$.logger = LoggerCallback.create(loggerParams); // Use for all log events
// Turn on USER1 logs and INFO in Main module (user code). Turn off USER2 for fun.
Main.common$.diags_USER1 = Diags.ALWAYS_ON;
Main.common$.diags_USER2 = Diags.ALWAYS_ON;
Main.common$.diags_USER3 = Diags.ALWAYS_ON;
Main.common$.diags_USER4 = Diags.ALWAYS_ON;
Main.common$.diags_USER5 = Diags.ALWAYS_ON;
Main.common$.diags_USER6 = Diags.ALWAYS_ON;
Main.common$.diags_INFO = Diags.ALWAYS_ON;
/* ================ UIA LOG ================ */
/*var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE;
LoggingSetup.sysbiosSwiLogging = true;
LoggingSetup.sysbiosHwiLogging = true;
LoggingSetup.sysbiosSemaphoreLogging = true;*/
And there are some things to print in my task's file, like this:
display_balanza.c
void display_balanza_taskFxn(UArg a0, UArg a1){
//Inicializamos todas las variables de la tarea
display_balanza_init();
Log_info0("Inicializated success");
//Loop infinito de la tarea
while(1){
while(I2CSlaveStatus(I2C0_BASE) != I2C_SLAVE_ACT_RREQ_FBR);
//I2CSlaveIntClear(I2C0_BASE, I2C_SLAVE_INT_START);
Log_info0("Recibiendo FBR");
break_fbr = false;
PIN_setOutputValue(ledPinHandle, Board_LED0, 1);
i2cDataArray[0] = I2CSlaveDataGet(I2C0_BASE);
//I2CSlaveIntClear(I2C0_BASE, I2C_SLAVE_INT_DATA);
for (i = 1; i < ARRAYDATA_SIZE; i++){
while(I2CSlaveStatus(I2C0_BASE) != I2C_SLAVE_ACT_RREQ){
if(I2CSlaveStatus(I2C0_BASE) == I2C_SLAVE_ACT_RREQ_FBR){
Log_info0("Break, FBR Again");
break_fbr = true;
break;
}
}
if(break_fbr){
break;
}
Log_info0("Recibiendo Byte");
i2cDataArray[i] = I2CSlaveDataGet(I2C0_BASE);
//I2CSlaveIntClear(I2C0_BASE, I2C_SLAVE_INT_DATA);
}
//Log_info3("Recibido: %d - %d - %d", (IArg) i2cDataArray[0], (IArg) i2cDataArray[1], (IArg) i2cDataArray[2]);
//Log_print1(Diags_USER1, "Recibido: %d", (IArg)i2cDataArray);
Log_info0("Recibido");
display_balanza_getData(i2cDataArray);
//I2CSlaveIntClear(I2C0_BASE, I2C_SLAVE_INT_STOP);
}
}
Thank you in advance for your response!
PD:
In the link of the tutorial above, says this:
---------------------------------
Remove global Log disable
If it's present, change predefined symbol below (or remove entirely) to avoid removing all Log statements from the code, which we don't want now.
xdc_runtime_Log_DISABLE_ALL --> X_xdc_runtime_Log_DISABLE_ALL
---------------------------------
I don't know if that is necesary, because, when I active the UIA logger, I can see the logs (going to Tools-->RTOS Analyzer--> Printf and error logs).
Moreover, if it would need, I don't know how to desactivate the log disable statement (I am using CCSv6)