Other Parts Discussed in Thread: TMDSEVM6657, , SYSBIOS
Dear Sirs,
I need some aclarations regarding CCS, examples and firmware development. Maybe my questions are simple and basic, but could help to other people.
My experience on this field is limited and I have a lot of confussion on this.
We have bought TMDSEVM6657 evaluation board for TMS320C6657.
I am tryng to create my own test for I2C on the eeprom of the board. Once I understand how it works I will try to use the I2C bus
to control other external I2C chips on a custom board plug on the 80 pins expansion conector of the evaluation board.
I have installed CCS 9.3.0 and processor_sdk_rtos_c665x_6_03_106. I have generated the PDk examples. I am able to run "platform_test_evmc6657l" project successfully.
(1)
I have imported to my workspace the example "I2C_BasicExample_C6657_Evm_c66xExampleProject".
This example has the main file "main_eeprom_read.c"
From my other experience on C development, the code start to execute on the main function. In this example,
the main is:
********
int main(void)
{
if (Board_initI2C() == false)
{
return (0);
}
/* Start BIOS */
BIOS_start();
return (0);
}
*****
Revising the code, it seems that the test in this example is executed on the function "void i2c_test(UArg arg0, UArg arg1)".
I am tryng to find BIOS_start() function to see how this function call to "i2c_test" but I was not able to find it. Please could
you tell me where I can find it? Does Bios_start() call i2c_test()? or How it works?
(2) in my tests, I have change some code of this project but I would like to keep a copy of original project.
I have delete the project from CCS and inport again the examples to have the original project but without success: changes still are there.
What is the best method to keep a original copy of the project and have my own projec to make changes and tests?
(3) to test the eeprom by my own project, I am thinking on something like this:
*********
#define I2C_ADDR 0x0300 // Read and write test start address for Cerro project
#define I2C_SIZE_TEST 10
/*
* ======== test function Cerro========
* Write 10 bytes on eeprom position 0x0300 and then read those bytes
*
/*
void i2c_own_test(UArg arg0, UArg arg1)
{
UART_printf("\n first line of my test program\n");//write this sentece on serial port, connector USB1, a 115200.
I2C_Params i2cParams;
I2C_Handle handle = NULL;
I2C_Transaction i2cTransaction;
char txBuf_cerro[10] = {0x0f,0x1f,0x2f,0x3f,0x4f,0x5f,0x6f,0x7f,0x8f,0x9f};//ten data to be written
char rxBuf_cerro[10] = {0x00, };//buffer to read the data
bool status,test_pass=FALSE;
int16_t transferStatus;
// Set the I2C EEPROM write/read address
txBuf_cerro[0] = (I2C_ADDR >> 8) & 0xff; // EEPROM memory high address byte
txBuf_cerro[1] = I2C_ADDR & 0xff; // EEPROM memory low address byte
I2C_init();
I2C_Params_init(&i2cParams);
handle = I2C_open(I2C_EEPROM_INSTANCE, &i2cParams);
I2C_transactionInit(&i2cTransaction);
i2cTransaction.slaveAddress = I2C_EEPROM_ADDR;
i2cTransaction.writeBuf = (uint8_t *)&txBuf_cerro[0];
i2cTransaction.writeCount = I2C_SIZE_TEST;
i2cTransaction.readBuf = (uint8_t *)&rxBuf_cerro[0];
i2cTransaction.readCount = I2C_SIZE_TEST;
i2cTransaction.timeout = I2C_TRANSACTION_TIMEOUT;
transferStatus = I2C_transfer(handle, &i2cTransaction);
if(I2C_STS_SUCCESS != transferStatus)
{
I2C_log("\n Data Transfer failed with transfer status %d \n",transferStatus);
test_pass=FALSE;
}
else {
I2C_log("\n Write and read successes %d \n",transferStatus);
UART_printf("\n Write and read successes\n");
}
I2C_close(handle);
}
**********************
I would check if the test is correct on the "Variables" window for comparing the transmit and received buffers or maybe printing the buffers on the screen to compare.
How/where should I add the previous code on the project?
Could I use this code to write/read to other I2C devices just changing the slaveadress and data to be transmitted?
If I had to change the "speed" or other I2c parameters, where is the place to do it?
Thanks in advance,
Joaquin.