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.

CCS/MSP432P401R: Issue with integration of tachometers using MSP432SDK in RTOS (Posix thread)

Part Number: MSP432P401R

Tool/software: Code Composer Studio

Hello TI experts,

I am trying to integrate Tachometer module inside RTOS using Posix Thread. I initially referred to the training and implemented tachometer using tirslkmaze project using the video in the link https://training.ti.com/ti-rslk-module-16-lecture-video-part-i-tachometer-input-capture?context=1135347-1139307-1134815.  I used the TimerA3 as the Interrupt to capture to control speed of the motor. Both tachometers are under the same timer A3 (TA3_N_IRQHandler and TA3_0_IRQHandler). Everything is working before changing to RTOS platform.

Due to incompatibility issue, I redirected implementation to MSP432SDK library. But the library only defines one pin only in each timer (unlike the previous library). I refer to the program in this link and modify from one input capture to two. http://dev.ti.com/tirex/explore/node?node=AJnos0yvE0MmjXvUYxHYhQ__z-lQYNj__LATEST

Now it has insufficient pins for my tachometers to work as tachometers are supposed to work without preempting each other. I modified additional timer pin to capture the input. However, it didn't work and seems it is incompatible to define additional pin on the same timerA3. Then I changed to different pin on the other timerA1. It is also not working; only one side is working and preempting other side resulting issue during integration. May I know whether I can add additional pin on timerA3 so that it can work well or other ideas that can make both tachometers working? I am seeking suggestion from you so that I am able to complete this on time by this week. Thank you so much for help.

#include <ti/drivers/Capture.h>
#include <ti/drivers/capture/CaptureMSP432.h>

CaptureMSP432_Object captureMSP432Objects[MSP_EXP432P401R_CAPTURECOUNT];

const CaptureMSP432_HWAttrs captureMSP432HWAttrs[MSP_EXP432P401R_CAPTURECOUNT]
    = {
    /* Timer_A1 */
    {
        .timerBaseAddress = TIMER_A1_BASE,
        .clockSource = TIMER_A_CLOCKSOURCE_SMCLK,
        .clockDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1,
        .capturePort = CaptureMSP432_P7_7_TA1,
        .intPriority = ~0
    },
    /* Timer_A2 */
    {
        .timerBaseAddress = TIMER_A2_BASE,
        .clockSource = TIMER_A_CLOCKSOURCE_ACLK,
        .clockDivider = TIMER_A_CLOCKSOURCE_DIVIDER_64,
        .capturePort = CaptureMSP432_P6_7_TA2,
        .intPriority = ~0
    },
    /* Timer_A3 */
    {
        .timerBaseAddress = TIMER_A3_BASE,
        .clockSource = TIMER_A_CLOCKSOURCE_SMCLK,
        .clockDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1,
        .capturePort = CaptureMSP432_P10_4_TA3,
        .intPriority = ~0
    }

    };

const Capture_Config Capture_config[MSP_EXP432P401R_CAPTURECOUNT] = {
    {
        .fxnTablePtr = &CaptureMSP432_captureFxnTable,
        .object = &captureMSP432Objects[MSP_EXP432P401R_CAPTURE_TA1],
        .hwAttrs = &captureMSP432HWAttrs[MSP_EXP432P401R_CAPTURE_TA1]
    },
    {
        .fxnTablePtr = &CaptureMSP432_captureFxnTable,
        .object = &captureMSP432Objects[MSP_EXP432P401R_CAPTURE_TA2],
        .hwAttrs = &captureMSP432HWAttrs[MSP_EXP432P401R_CAPTURE_TA2]
    },
    {
        .fxnTablePtr = &CaptureMSP432_captureFxnTable,
        .object = &captureMSP432Objects[MSP_EXP432P401R_CAPTURE_TA3],
        .hwAttrs = &captureMSP432HWAttrs[MSP_EXP432P401R_CAPTURE_TA3]
    }

};

const uint_least8_t Capture_count = MSP_EXP432P401R_CAPTURECOUNT;

Regards
Min Min

  • Hi,

    We will look into it and get back to you ASAP. Please bear with us.

    Thanks,

    PM

  • Hi PM

    I have spent a lot of unnecessary time solving on that incompatibility issue.Can you guys expedite the process by coming out at a solution whether can add additional pin on the same timer for capture etc. please? It has been two days since I posted this problem. So need you guys respond the solution asap. Thanks

    Regards

    Min Min

  • Hi Ti Experts

    It has been 1 week now. Have you guys been busy? Can you guys please give any suggestion? Thanks.

    Regards

    Min Min

  • Hi TI experts

    I might consider buying TI products twice if you show this kind of customer service (not bothering to reply). I will give feedback to the respective department. What a bad experience!!!

  • Hello Min Min,

    Apologize for the delay in response!

    Myo Min Min Paing said:
    Due to incompatibility issue, I redirected implementation to MSP432SDK library. But the library only defines one pin only in each timer (unlike the previous library).

    From this statement I understand that you are currently using the TI-Drivers library in SimpleLink MSP432P4 SDK (./source/ti/drivers/).

    Myo Min Min Paing said:
    I refer to the program in this link and modify from one input capture to two. http://dev.ti.com/tirex/explore/node?node=AJnos0yvE0MmjXvUYxHYhQ__z-lQYNj__LATEST

    So looks like you are using the Capture TI-Driver (./source/ti/drivers/Capture.c). According to the TI-Driver documentation of Capture module for MSP432P4 MCU, it looks like for each instance of the capture driver only one capturePort definition is allowed.

    Myo Min Min Paing said:
    Then I changed to different pin on the other timerA1. It is also not working; only one side is working and preempting other side resulting issue during integration.

    According to the documentation this should work.

    Capture_open() should be called once per capture instance. In your case since you need two capture pins, you will have to call Capture_open() twice. Are you doing this?

    Also looks like you are using an older version of the SDK. Please upgrade to the 3.30 version as it comes with support for SysConfig. SysConfig makes the configuration of the TI-Drivers very easy when compared to updating the older board files (board.h, MSP_EXP432P401R.c and MSP_EXP432P401R.h).

    The SysConfig Basics SimpleLink Academy lab will provide a good overview on using SysConfig.

    Thanks,

    Sai

  • Hi fellow RSLK enthusiast, I also wanted to use the TI-RTOS with my RSLK (I really wanted to learn ti-rtos).

    I managed to get it working by 

    a) configuring the syscfg file to use P10.4 pin with timer 3.

    b) excluding the syscfg file from the build and hacking the generated ti_drivers_config.c file and manually including them (I believe this is quite normal to do this).... 

    const CaptureMSP432_HWAttrs captureMSP432HWAttrs[CONFIG_CAPTURE_COUNT] = {
        /* CONFIG_CAPTURE_TACHO_0 */
        {
            .timerBaseAddress = TIMER_A3_BASE,
            .clockSource      = TIMER_A_CLOCKSOURCE_SMCLK,
            .clockDivider     = TIMER_A_CLOCKSOURCE_DIVIDER_1,
            .capturePort      = CaptureMSP432_P10_4_TA3,
            .intPriority      = (~0),
        },
        {
            .timerBaseAddress = TIMER_A3_BASE,
            .clockSource      = TIMER_A_CLOCKSOURCE_SMCLK,
            .clockDivider     = TIMER_A_CLOCKSOURCE_DIVIDER_1,
            .capturePort      = CaptureMSP432_P10_5_TA3,
            .intPriority      = 2,
        },
    };
    
    /*
     *  ======== Capture_config ========
     */
    const Capture_Config Capture_config[CONFIG_CAPTURE_COUNT] = {
        /* CONFIG_CAPTURE_TACHO_0 */
        {
            .fxnTablePtr = &CaptureMSP432_captureFxnTable,
            .object = &captureMSP432Objects[CONFIG_CAPTURE_TACHO_0],
            .hwAttrs = &captureMSP432HWAttrs[CONFIG_CAPTURE_TACHO_0]
        },
        {
             .fxnTablePtr = &CaptureMSP432_captureFxnTable,
             .object = &captureMSP432Objects[CONFIG_CAPTURE_TACHO_N],
             .hwAttrs = &captureMSP432HWAttrs[CONFIG_CAPTURE_TACHO_N]
        },
    };

    c) fixed up the define CaptureMSP432_P10_5_TA3 (it has an obvious bug)

    d) when I actually go to open the capture, my code looks like this....

    int tachoOpen()
    {
        Capture_Params    params;
        Capture_Params_init(&params);
        params.mode  = Capture_RISING_EDGE;
        params.callbackFxn = TA2_0_Callback;
        params.periodUnit = Capture_PERIOD_COUNTS;
        _tachoHandle0 = Capture_open(CONFIG_CAPTURE_TACHO_0, &params);
    
        if (_tachoHandle0 == NULL) {
            System_abort("Error Initializing capture P10.4 (right)\n");
            return -1;
        }
    
        TimerMSP432_HWAttrs const *hwAttrs = _tachoHandle0->hwAttrs;
        TimerMSP432_freeTimerResource(hwAttrs->timerBaseAddress);
    
        params.callbackFxn = TA2_N_Callback;
        _tachoHandleN = Capture_open(CONFIG_CAPTURE_TACHO_N, &params);
    
        if (_tachoHandleN == NULL) {
            System_abort("Error Initializing capture P10.5 (left)\n");
            return -1;
        }
    
        return 0;
    }
    int tachoStart()
    {
        int32_t status = Capture_start(_tachoHandle0);
        if (status == Capture_STATUS_ERROR) {
            return -1;
        }
        status = Capture_start(_tachoHandleN);
        if (status == Capture_STATUS_ERROR) {
            return -1;
        }
    
        return 0;
    }

    I hope this helps (it works for me;) )

    I thought I might add that if you use linear interpolation on the sin/cosine look up table, you get very good results for calculating odometry.

    Can I also add that this is a fantastic little robot for all sorts of endeavours. I love the breadboard on top and the wifi interface - that means I can off load compute to my PC. Can I suggest maybe the next version includes an gyro/accelerometer so you can also do a lesson on the Kalman filter. 

  • Hi Myo, just to let you know I've done it! I've completely being able to use ti-rtos with rslk with all sensors including the cc3120boost and IR. I'm just streaming over tcp the bno-055, bmx-055 and tacho sensors to my pc at 100 Hz. I'm using the latest sdk 3.300.00.13.  This is an awesome affordable robotics kit. I'll probably post something to Hackster if I get the sensor fusion working.

**Attention** This is a public forum