Tool/software: TI-RTOS
Hi everyone
It's my firts post here, from Argentina.
The point is:
I have a CC2650 Launchpad developemt board. I want to use the I2C driver, with an Arduino Mega as a slave. But I can't get it. So, I decided that I want to debbug to find the problem.
Reading the TI-RTOS User Guide, I found:
"The instrumented I2C library contains Log_print() statements that help to debug I2C transfers. The I2C driver logs the following actions using the Log_print() APIs provided by SYS/BIOS:
• I2C object opened or closed.
• Data written or read in the interrupt handler.
• Transfer results.
Logging is controlled by the Diags_USER1 and Diags_USER2 masks. Diags_USER1 is for general
information and Diags_USER2 is for more detailed information. Diags_USER2 provides detailed logs
intended to help determine where a problem may lie in the I2C transaction. This level of diagnostics will
generate a significant amount of Log entries. Use this mask when granular transfer details are needed."
So, my question is:
How can I activate the Diags_USER2 logging? I didn't find any option in my .cfg file
Thanks
Here you have my code:
/*
* ======== empty_min.c ========
*/
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/runtime/System.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Clock.h>
/* TI-RTOS Header files */
#include <ti/drivers/I2C.h>
#include <ti/drivers/i2c/I2CCC26XX.h>
#include <ti/drivers/PIN.h>
// #include <ti/drivers/SPI.h>
// #include <ti/drivers/UART.h>
// #include <ti/drivers/Watchdog.h>
/* Board Header files */
#include "Board.h"
#define TASKSTACKSIZE 512
Task_Struct task0Struct;
Char task0Stack[TASKSTACKSIZE];
/* Pin driver handle */
static PIN_Handle ledPinHandle;
static PIN_State ledPinState;
/*
* Application LED pin configuration table:
* - All LEDs board LEDs are off.
*/
PIN_Config ledPinTable[] = {
Board_LED0 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
PIN_TERMINATE
};
/* I2C */
I2C_Handle handle;
I2C_Params params;
I2C_Transaction i2cTrans;
uint8_t rxBuffer[32]; // Receive buffer
uint8_t txBuffer[32]; // Transmit buffer
bool transferDone = false;
Void Create_i2c(void){
//Inicializamos
I2C_init();
// Configure I2C parameters.
I2C_Params_init(¶ms);
params.transferMode = I2C_MODE_BLOCKING;
params.transferCallbackFxn = NULL;
// Prepare data to send, send 0x00, 0x01, 0x02, ...0xFF, 0x00, 0x01...
int i;
for(i = 0; i < 32; i++)
txBuffer[i] = (uint8_t) i;
//txBuffer[0] = 1;
// Initialize master I2C transaction structure
i2cTrans.writeCount = 16;
i2cTrans.writeBuf = txBuffer;
i2cTrans.readCount = 0;
i2cTrans.readBuf = rxBuffer;
i2cTrans.slaveAddress = 8;
// Open I2C
handle = I2C_open(Board_I2C, ¶ms);
}
Void Transmit_dataFxn(UArg arg0, UArg arg1)
{
Create_i2c();
for(;;){
// Do I2C transfer (in callback mode)
if(I2C_transfer(handle, &i2cTrans)){PIN_setOutputValue(ledPinHandle, Board_LED0, 1);}
else{PIN_setOutputValue(ledPinHandle, Board_LED1, 1);}
}
}
/*
* ======== main ========
*/
int main(void)
{
Task_Params taskParams;
/* Call board init functions */
Board_initGeneral();
//Board_initI2C();
// Board_initSPI();
// Board_initUART();
// Board_initWatchdog();
/* Construct heartBeat Task thread */
Task_Params_init(&taskParams);
taskParams.arg0 = 1000000 / Clock_tickPeriod;
taskParams.stackSize = TASKSTACKSIZE;
taskParams.stack = &task0Stack;
Task_construct(&task0Struct, (Task_FuncPtr)Transmit_dataFxn, &taskParams, NULL);
/* Open LED pins */
ledPinHandle = PIN_open(&ledPinState, ledPinTable);
if(!ledPinHandle) {
System_abort("Error initializing board LED pins\n");
}
/* Start BIOS */
BIOS_start();
return (0);
}