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.

MPU9150 demo on TI-RTOS

Greetings:

I'm trying to get the mpu9150 demo code called (Mpu9150 demo.zip)  from the wiki page (TI-RTOS MPU9150)  to run on a dk-tm4c123g board.  I have the device working fine without using rtos.  I'm gettng build errors mostly centered around the i2cmpu9150.c file.   In particular the GPIO_enableInt is flagged as too many arguments and the MPU9150_INT_FALLING is undefined.  Am I missing an updated file.  I running the latest version of RTOS.  There are other errors too but of the same general type.  

I'll provide more detail on the errors if that is helpful.

  • Yes, please provide details for the build errors.

    It seems there have been some GPIO driver API changes since that older version of TI-RTOS.

    What TI-RTOS version are you using now?  

    Thanks,
    Scott

  • Scott:

    Here are the error messages.
    "..\DK_TM4C123G.h", line 58: error #20: identifier "GPIO_Callbacks" is undefined
    "..\DK_TM4C123G.h", line 59: error #20: identifier "GPIO_Callbacks" is undefined
    "../i2cmpu9150.c", line 328: warning #225-D: function "GPIO_setupCallbacks" declared implicitly
    "../i2cmpu9150.c", line 333: error #20: identifier "GPIO_INT_FALLING" is undefined
    "../i2cmpu9150.c", line 333: error #141: too many arguments in function call
    "../i2cmpu9150.c", line 334: error #141: too many arguments in function call
    5 errors detected in the compilation of "../i2cmpu9150.c".

    Version is tirtos_tivac_2_14_04_31

    Thanks for your help.

    BTW: Are there any other examples of mpu9150 running under TI-RTOS?

    Dan
  • Dan,

    I think these errors are all covered in the TI-RTOS 2.12 migration guide: processors.wiki.ti.com/.../TI-RTOS_Migration_2_12

    I know you are using 2.14.04.31, but it seems that the 2.12 release is when those GPIO API changes occurred.

    [FYI, the general page for finding migration info is here: http://processors.wiki.ti.com/index.php/TI-RTOS_Support]

    I think if you make the changes as described in the 2.12 migration page the build errors should be resolved.

    No, sorry, I don’t know of any other examples for the MPU9150.

    Regards,
    Scott

  • Scott:

    Thanks, this was most helpful and I have been able to resolve most of the problems. However, I'm still confused about the gpioCallbackFunctions. I'm using the DK-TM4C123G so I defined this as:

    GPIO_CallbackFxn gpioCallbackFunctions[] = {
    NULL, /* DK_TM4C123G_Sw1(up) */
    NULL, /* DK_TM4C123G_Sw2(Down) */
    NULL, /* DK_TM4C123G_Sw3(Left) */
    NULL, /* DK_TM4C123G_Sw4(Right) */
    NULL, /* DK_TM4C123G_Sw5(Select/Wake) */
    NULL /* MPU9150_INT_PIN */
    };

    Is this correct?

    Also, I am confused in converting the old GPIOsetupCallbacks to GPIOsetCallback. The table says to associate a callback function with a particular GPIO pin interrupt. How - exactly - do I do this. I guess I'm not sure what "particular GPIO pin interrupt" refers to.

    The originals code is:
    GPIO_setupCallbacks(&DK_TM4C123G_gpioPortBCallbacks);
    GPIO_setupCallbacks(&Board_gpioCallbacks0);

    Please show me how to code the GPIOsetCallback functions for the TM4C123G for these two calls.

    Also, I'm getting a #20 identifier "gpioCallbackFunctions" is undefined error. Where/how should this be done. I didn't see anything in the instructions.

    I really appreciate your help on this. I would really like to get this running under RTOS.

    Dan
  • Dan,

    Sorry, I haven’t had a chance to get back to this.  Have you resolved this yet?  If not, I’ll look at this tomorrow and get back to you…

    Regards,
    Scott

  • Tomorrow is fine. Thanks for your help.

    Dan
  • Dan,

    Comments below:

    Thanks, this was most helpful and I have been able to resolve most of the problems. However, I'm still confused about the gpioCallbackFunctions. I'm using the DK-TM4C123G so I defined this as:

    GPIO_CallbackFxn gpioCallbackFunctions[] = {
    NULL, /* DK_TM4C123G_Sw1(up) */
    NULL, /* DK_TM4C123G_Sw2(Down) */
    NULL, /* DK_TM4C123G_Sw3(Left) */
    NULL, /* DK_TM4C123G_Sw4(Right) */
    NULL, /* DK_TM4C123G_Sw5(Select/Wake) */
    NULL /* MPU9150_INT_PIN */
    };

    Is this correct?

    This looks right.  You actually only need an entry here for a GPIO that can trigger an interrupt.  In this app only two are really needed (the button and the MPU9150), but if you have all the other GPIOs configured in the pin config array (since this board file is shared with other applications), then the array needs to be bigger (as you have it).

    Have you moved the output pin (for the LED) to the end of your GPIO_PinConfig array?


    Also, I am confused in converting the old GPIOsetupCallbacks to GPIOsetCallback. The table says to associate a callback function with a particular GPIO pin interrupt. How - exactly - do I do this. I guess I'm not sure what "particular GPIO pin interrupt" refers to.

    The originals code is:
    GPIO_setupCallbacks(&DK_TM4C123G_gpioPortBCallbacks);
    GPIO_setupCallbacks(&Board_gpioCallbacks0);

    Please show me how to code the GPIOsetCallback functions for the TM4C123G for these two calls.



    For the ordering in your list of callback functions, I think you want this:

        GPIO_setCallback(2, gpioStopSDlogging);
        GPIO_setCallback(5, gpioMPU9150DataReady);

    This will set the SW3 interrupt function (index 2 in your callback function array) to gpioStopSDlogging(), and the MPU9150 interrupt function (index 5) to gpioMPU9150DataReady().


    Also, I'm getting a #20 identifier "gpioCallbackFunctions" is undefined error. Where/how should this be done. I didn't see anything in the instructions.



    I’m guessing this is coming from the reference in your GPIOTiva_config structure.  If it is, you might just move the gpioCallbackFunctions[] array definition earlier in the file, before the GPIOTiva_config structure.  If it is coming from someplace else, that reference might not be necessary anymore.

    Hope this clears things up.

    Also, if you haven’t already looked at these, you might look at some of the gpiointerrupt examples that come with the newer TI-RTOS.


    Regards,
    Scott

  • Scott:
    Thanks, I'll give this a shot. Really appreciate your help.

    Dan