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.

Trouble getting UART and I2C working together

Microprocessor: MSP430F5529LP, compiler TI v15.12.3.LTS, XDC 3.320.06_core. CCS App Center tells me I'm up to date. I think.

I'm something of a newbie, hoping TI_RTOS will protect me from most of the fiddly bits of microprocessor programming.

I used the uartecho demo project for my MSP430F5529LP to get UART communication working, and I used the i2ctmp006 demo to get I2C communcation working. Both projects work fine on their own.

When I try to add the I2C capability to my UART project the I2C does 8 clock pulses and fails at the first I2C_transfer() call, and when I try to add UART to my I2C project the UART fails at the first UART_write() call.

I narrowed it down so that now I'm using a single common *.c file for both, and if I use the UART cfg file the UART works but not the I2C, and if I use the I2C cfg file the I2C works but not the UART (though sometimes I have to cycle power on the LaunchPad board to get it going). I tried to make the two cfg files as similar as I know how, but the problem persists.

Any insight on how to get both peripherals to work simultaneously? Is there something that usually causes this problem? An example project using both UART and I2C might be even more help.

I'd attach the common c file and the two cfg files but I can't seem to figure out how to do that without pasting the whole thing in. Let me know if that would be useful for anyone.

Thanks

Joel

  • Hi Joel,

    Can you share your source files ? You can click on "Use rich formatting" when replying. It will cause a toolbar to show up. The toolbar has an option to attach files.

    In general, you should be able to use USCI_A0/A1 for UART and USCI_B0/B1 for I2C.

    Best,

    Ashish

  • Thanks, Ashish. I'm using the paperclip "Insert File" button; I hope that's the right one to use.

    Do you know how to switch from USCI_A to USCI_B in a TI-RTOS context?

    Joel

    1376.common_main.c8540.common_mutating.cfg7536.main_mutating.cfg

  • Push a little harder and sometimes the answer comes...

    The two cfg files were identical except for this:

    In common_mutating.cfg, there were these lines at the bottom:

    var hwiParams = new halHwi.Params();
    hwiParams.arg = 0;
    halHwi.create(46, "&UARTUSCIA_hwiIntFxn", hwiParams);

    In main_mutating.cfg there were these lines on the bottom:

    /* I2C Hwi for the USCI driver */
    hwiParams.arg = 0;
    halHwi.create(55, "&I2CUSCIB_hwiIntFxn", hwiParams);
    Idle.idleFxns[0] = null;
    System.extendedFormats = "%$L%$S%$F";

    I made a new cfg file with these lines:

    hwiParams.arg = 0;
    halHwi.create(55, "&I2CUSCIB_hwiIntFxn", hwiParams);
    halHwi.create(46, "&UARTUSCIA_hwiIntFxn", hwiParams);

    and now UART and I2C are trucking away happily with each other.

    It seems like an obvious thing, except I don't see any way in the TI-RTOS view of the cfg file (using CCS) to specify these interrupt parameters, and nothing in the Outline window to suggest that these HWI settings exist.

    So it works, and that's great, but for someone who doesn't want to break things by messing with the cfg file manually, here's the question: is there a way to get TI-RTOS to specify these without having to manually edit the cfg file?

  • Hi Joel,

    Glad to know that you got the app working. I will need to check with XGCONF (GUI config tool) experts whether it is a bug that the tool does not recognize a Hwi create call in the cfg file or is it a known limitation of the tool. I will get back to you once I learn more.

    Best,
    Ashish
  • Hi Joel,

    It looks like there is a bug in our GUI tool which prevents it from detecting a manually created Hwi instance in the cfg file. I have filed a bug to track this (SYSBIOS-305).

    Best,
    Ashish