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.

IWR6843AOPEVM: Create RTOS Task for I2c

Part Number: IWR6843AOPEVM
Other Parts Discussed in Thread: MMWAVEICBOOST

Hello,

I'm working to implement an I2C interface on the IWR6843AOPEVM. I'm using the 3D people tracking code base. I have used the information in C:/ti/mmwave_sdk_03_06_01_00-LTS/packages/ti/drivers/i2c/docs/doxygen/html/_i2_c_master_driver.html.

I was having the same problem as on the related thread where the code stopped running when it reached the line:

ret = I2C_transfer(handle, &i2cTransaction);

I realized that I need to create the RTOS task for I2C before calling the I2C_tranfer function.I see in mss_main.c where tasks are created for other drivers such as DMA based UART data transfer. I also see in C:\ti\mmwave_sdk_03_06_01_00-LTS\packages\ti\drivers\i2c\test\master.c line 554 the task intialization as below: 

/* Initialize the Task Parameters. */
Task_Params_init(&taskParams);
taskParams.stackSize = 6*1024;
Task_create(Test_initTask, &taskParams, NULL);

I do not want to use the Test_initTask in my code because I don't want the test functionality, only the I2C driver functionality. 

Is there a driver function for I2C available that I can use in place of Test_initTask? 

Thanks,

David

  • Hi

    Thank you for your query. Please allow us a couple of days to respond

    Regards

  • Hi David,

    Why do you think you need a whole new task for the I2C interface? Are you able to run the unmodified I2C examples without blocking on the i2c transfer() call?

    Best,

    Nate

  • Hi Nate,

    Thanks for the reply. I think I need the new task for the I2C interface because the code seems to go into an endless loop when I call I2C_transfer(handle, &i2cTransaction);. I am connected to a logic analyzer and I see the I2C lines pulled high but I never see a scl or sda signal. 

    The only difference I can find in my implementation and the test implementation in C:\ti\mmwave_sdk_03_06_01_00-LTS\packages\ti\drivers\i2c\test\master.c is that I have not run the task initialization below.

    /* Initialize the Task Parameters. */
    Task_Params_init(&taskParams);
    taskParams.stackSize = 6*1024;
    Task_create(Test_initTask, &taskParams, NULL);

    For your second question, I have been working today to run the unmodified I2C examples. I am in debug mode using the MMWAVEICBOOST. I have loaded C:\ti\mmwave_sdk_03_06_01_00-LTS\packages\ti\drivers\i2c\test\xwr68xx\xwr68xx_i2c_mss_master.xer4f.

    I am running it and see the expected output on the console in CCS. I have also connected using TeraTerm to the XDS110 Class Application/User UART. I can enter 1 and 2 on the TeraTerm terminal to try to start the I2C tests, but I do not see the entries or the test status in the console and there is no output on the I2C lines. I have also tried Putty with the same results. My terminal settings are 115200, 8, N, 1, N. 

    Do you have any additional comments on why the I2C_transfer() call goes into an endless loop?

    Do you have any additional comments on why the unmodified I2C example does not seem to accept commands from the TeraTerm terminal?

    Thanks,

    David

  • Nate,

    I have now successfully tested the I2C example and I see the I2C signals on my logic analyzer as expected.

    I modified C:\ti\mmwave_sdk_03_06_01_00-LTS\packages\ti\drivers\i2c\test\master.c by adding the line below just after line 480. With this line I do not need to communicate through a terminal to start the I2C test. 

    testSelection = I2C_TEST_BLOCKING_MODE;

    My question regarding the endless loop when I call the I2C_transfer() function is still open. 

    FYI, here is another thread where this same issue with the I2C_transer function was identified. This thread is marked resolved, but the resolution was for a different problem and the I2C problem was not resolved.

    e2e.ti.com/.../iwr6843aopevm-questions-about-mmwave-sdk-i2c-driver

    Thanks,

    David

  • Hi David,

    Can you try reverting to the 3.5.0.4 MMWAVE SDK? There also some info in this thread you may find useful. It looks like you need to be in blocking mode to start an I2C transaction within a task context. Can you try to put the I2C in blocking mode in your code and see if it works? We can then brainstorm ways to get it working without blocking your application hopefully.

    https://e2e.ti.com/support/sensors-group/sensors/f/sensors-forum/1074626/iwr6843aop-i2c-transfer-fail

    Best,

    Nate

  • Hi Nate,

    I've been working this today. I don't have a solution yet but want to give you an update on what I've tried.

    I reverted to sdk 3.5.0.4 for 3D_people_track_6843_mss project and see exactly the same results. Note that for 3D_people_track_6843_dss project I'm still using sdk 3.6.1.0. The dss project would not build using the 3.5.0.4 sdk.

    All of my work to date has been with I2C in blocking mode. 

    I reviewed the other thread and it has some useful information but nothing that I could use on this problem. 

    I verified again today that the test code C:\ti\mmwave_sdk_03_06_01_00-LTS\packages\ti\drivers\i2c\test\master.c is working and I see the I2C signals on the logic analyzer. 

    I copied many of the functions from the test code into my working version of 3D_people_track_6843_mss. In mss_main.c, in the Pcount3DDemo_initTask function, I'm calling the equivalent of the Test_initTask function (this function is from ../test/master.c). I see the debug printf statements just as when I run the stand alone test code, and it appears to run, but there is no I2C signal on the logic analyzer. My code continues to run after the Test_initTask function call, and then when I set up the i2ctransaction and i2cHandle variables and try to call the I2C_transfer(i2cHandle, &i2cTransaction) function the code stops as it did before I added the test functionality. 

    I added some printf statements into the code for debug purposes. I see that it is executing into the I2C_transfer() function in the I2C.c code. Then it stops on this line:

    return (handle->fxnTablePtr->transferFxn(handle, transaction));

    I'm continuing to work on this. Please let me know if you have some additional ideas on possible solutions. 

    Thanks,

    David

  • Hi David,

    I'm getting more info now. In the meantime, you could also refer to our i2c docs here:

    C:/ti/mmwave_sdk_03_05_00_04/packages/ti/drivers/i2c/docs/doxygen/html/I2CMasterDriver.html

    Best,

    Nate

  • Nate,

    I was able to get the I2c communication working today. There were a couple of issues with the sequence of hardware platform initialization and I2C initialization. I went through the master.c test code again line by line and compared to my working code and found these sequencing issues.

    Thanks for your help on this item. 

    David