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.

MSPM0L1306: How to get polarity of I/O-pin if it is configured as capture-input for a timer

Part Number: MSPM0L1306
Other Parts Discussed in Thread: SYSCONFIG,

Hi,

I configured TIMG0_C1 as a capture input for pin PA13 to measure the duration between two signal edges on that pin.

TIMG0 is configured with Sysconfig and this works. I get capture-interrupts on each edge which occurs on pin PA13 (either rising and falling).

Now I need to read the polarity of pin PA13 if a capture-interrupt occurs.

How do I check if PA13 has high or low level? 

I tried to check    (GPIOA->DIN31_0 & DL_GPIO_PIN_13)  to be 0 or not, but here no change occured.

I think this is because PA13 is not configured as digital input but as input for timer.

How do I read the polarity high or low of this pin when it is used as input for a capture-timer? Or how do I check which edge caused the interrupt?

Thank you for some help.

  • Hi Matthias,

    You should use an interrupt to re-configure the IO pin function from Timer to I/O input and then detect the polarity. After detecting the polarity, you should re-configure it as Timer cpature mode.

    A more easy way is use EVENT module to finish the function. Use PA13 as a GPIO input, and trigger Timer capture by GPIO edge detection.

    See the configuration below (please modify according your requirements):

    B.R.

    Sal

  • Hi Sal,

    I now use PA13 interrupt on either edge and get a GPIO-interrupt as expected.
    Can you please provide an (code) example how to correctly configure TIMG0_Ch1 so that this timer runs continously (e.g. with 32MHz) and captures the counter value at each edge of PA13. A capture shall not stop the running the counter. It seems to me that using single mode capture does not produce this and multi mode capture does not allow for event trigger.
    Thank you for your help.

  • Hi Sal,

    one more question for my understanding:
    Is your suggested solution to get a GPIO-interrupt for PA13 in which the further processing of the captured timer value is done?
    Or should I get a Timer-Capture-Interrupt which was caused (in the background without software-intervention) by GPIO detecting an edge and sending an event to TIMG0 which then generates a Capture-interrupt?

  • Hi Jost,

    See the configuration below (please modify according your requirements):

    The screenshot is the configuration of the timer and gpio.

    You can use the code example in SDK: timx_timer_mode_capture_duty_and_period_LP_MSPM0L1306_nortos_ticlang, and then configure a gpio input and timer capture mode according to the picture.

    Is your suggested solution to get a GPIO-interrupt for PA13 in which the further processing of the captured timer value is done?

    The function is that you can read the capture period value in timer interrupt, while you can also read the gpio pin polarity anytime.

    B.R.

    Sal

  • Hi,

    sorry, it seems you did not test your proposed solution.

    Therefor I asked for a code example from you...

    Moreover, in SDK, there is no example "timx_timer_mode_capture_duty_and_period_LP_MSPM0L1306_nortos_ticlang".

  • I had to find a different workaround because I was not able to get running code using SDK 1.17.0 for that or from answers I tried to receive.

    it was unfortunately a try-and-error with MSPM0.

    Unluckily there are more things like that for other peripherals we are facing poblems with MSPM0.

  • Hi,

    Use the latest SDK version (1.20); and download the CCS 12.5 (Sysconfig 1.18 is included in CCS12.5).

    You can find the code example in the path "C:\ti\mspm0_sdk_1_20_00_05\examples\nortos\LP_MSPM0L1306\driverlib\timx_timer_mode_capture_duty_and_period".

    Therefor I asked for a code example from you...

    I am sorry that currently I have no time for testing, so please take a try.

    If anymore issues you meet, feel free to reply to the thread or file a new thread.

    B.R.

    Sal