PORTB2 GPIO effect on PORTA1 SPWM Output

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PORTB2 GPIO effect on PORTA1 SPWM Output

Jump to solution
1,379 Views
Rashmitha_Nair
Contributor III

Hi,

I have a project that generates SPWM Output on FTM0 CH6 and CH7 using sine samples from DMA.

Currently, I have a GPIO button that controls output ON & output OFF.

I would like this output to detect the GPIO BUTTON press and then check for the rising edge of a 16kHz signal received on GPIO Pin PTB2 from another board (Master).

The problem is that when I add the PTB2 initialization in boards/pin_mux.c as below

    /* PORTB2 (pin 55) is configured as PTB2 */
    PORT_SetPinMux(BOARD_PWM_SYCNH_TRG_PORT, BOARD_PWM_SYCNH_TRG_PIN, kPORT_MuxAsGpio);

    /* Interrupt configuration on PORTB2 (pin 55): Interrupt on rising edge */
    PORT_SetPinInterruptConfig(BOARD_PWM_SYCNH_TRG_PORT, BOARD_PWM_SYCNH_TRG_PIN, kPORT_InterruptRisingEdge);

    PORTB->PCR[2] = ((PORTB->PCR[2] &
                      /* Mask bits to zero which are setting */
                      (~(PORT_PCR_PE_MASK | PORT_PCR_PFE_MASK | PORT_PCR_ISF_MASK)))

                     /* Pull Enable: Internal pullup or pulldown resistor is enabled on the corresponding pin. */
                     | (uint32_t)(PORT_PCR_PE_MASK)

                     /* Passive Filter Enable: Passive input filter is disabled on the corresponding pin. */
                     | PORT_PCR_PFE(kPORT_PassiveFilterDisable));

 

And then when I connect the 16khz wire on PTB2 of slave, irrespective of the presence of ISR for PTB2, the PWM output is OFF. And there is no response to the GPIO button that is used for ON and OFF of SPWM.

 

Is there some coupling between PTB2 and PTA1 ?

Could you suggest some other way to implement the sync scheme that I mentioned above (detect button press & detect rising edge then turn ON output)?

 

Thanks & Regards,

Rashmitha

0 Kudos
Reply
1 Solution
1,357 Views
Rashmitha_Nair
Contributor III

Hi @Robin_Shen ,

Thanks for your response. Having some debug print statements in the ISR was causing problems with the SPWM generation.

 

Regards,

Rashmitha

View solution in original post

0 Kudos
Reply
2 Replies
1,366 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Rashmitha_Nair,

Did you enable the interrupt and Interrupt service function? You can refer the frdmk64f_gpio_input_interrupt SDK example.

EnableIRQ PORTA_IRQHandler.png

During debug, please check the Figure 11.5. Debug controls and Debug Call Stack

MCUX_Debug_controls.jpg

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
1,358 Views
Rashmitha_Nair
Contributor III

Hi @Robin_Shen ,

Thanks for your response. Having some debug print statements in the ISR was causing problems with the SPWM generation.

 

Regards,

Rashmitha

0 Kudos
Reply