Skip to main content
Visitor II
June 30, 2023
Solved

stm32mp135 PA10 as tim1 ch3 pwm

  • June 30, 2023
  • 5 replies
  • 2314 views

Hi,

I have a problem with the configuration of PA10 of stm32mp135 to work as pwm of TIM1_CH3. I also make an experiment to disable completely timer and PWM and I also can't control this pin using gpioset. In the documentation I saw that this pin is dedicated to USB "...OTG_HS_ID is on PA10 (EXTI10)". My question is simple how to disconnect PA10 from USB completely? CubeMx doesn't do that.

    This topic has been closed for replies.
    Best answer by MWoło.2

    I find a bit similar problem to my

    https://community.st.com/t5/stm32-mpu-products/120-369992-dwc2-49000000-usb-otg-overcurrent-change-detected/td-p/168914

    and finally, I created something like

    &usbotg_hs{
    	status = "okay";
    
    	/* USER CODE BEGIN usbotg_hs */
    	dr_mode = "peripheral";
    	usb-role-switch;
    	role-switch-default-mode = "peripheral"; 
    	phys = <&usbphyc_port1 0>;
    	phy-names = "usb2-phy";
    	/* USER CODE END usbotg_hs */
    };

     Now my gadget ethernet is working and backlight pwm also. Topic can be closed.

    5 replies

    MWoło.2Author
    Visitor II
    June 30, 2023

    I forgot to add that I try to do this on my custom board which has no physical connection with any USB lines.

    MWoło.2Author
    Visitor II
    June 30, 2023

    The voltage on this PA10 pin is 3.17V, and my VDD is 3.3V.

    Command

    gpioset gpiochip0 '10'=0

    don't change this value

    this one

    gpioset gpiochip0 '10'=1

    also. This pin has to be somewhere configured to USB or another function.

    In the system I have

    MWoo2_0-1688118340848.png

     

    Technical Moderator
    June 30, 2023

    Hi @MWoło.2 ,

    Maybe have a look to "u-boot,force-b-session-valid" property in order to disable usage of ID pin.

    https://wiki.st.com/stm32mpu/wiki/How_to_configure_U-Boot_for_your_board#USB_OTG_node

    Regards.

    MWoło.2Author
    Visitor II
    July 3, 2023

    Hi Patrick,

    Unfortunately, additional record in the U-Boot DTS does not help. I discover something new. The 3.17V voltage on PA10 appears not in the U-Boot but after kernel start. So in my opinion the problem is not in the U-Boot but in the Kernel.

    Records like 'force-vbus-detection' do not exist in any Kernel files.

    How should look the Kernel DTS related to &usbotg_hs to disable the OTG_HS_ID function of PA10?

    BR

    Michal

    MWoło.2Author
    Visitor II
    June 30, 2023

    My usbotg_hs section has no 'u-boot,force-vbus-detection;'. I check it and give feedback. Thanks, BR Michal

    MWoło.2Author
    Visitor II
    July 3, 2023

    I made a teenth of experiments with different parameters in the Kernel dts. The backlight PWM on PA10 works only in the configuration where the added parameter 'usb-role-switch'. Unfortunately in such a configuration gadget ethernet not working. I think it is impossible to set 'peripheral' without involving PA10.

    So currently my kernel dts looks

    &usbotg_hs{
    	status = "okay";
    
    	/* USER CODE BEGIN usbotg_hs */
    	dr_mode = "usb-role-switch";
    	usb-role-switch;
    	phys = <&usbphyc_port1 0>;
    	phy-names = "usb2-phy";
    	/* USER CODE END usbotg_hs */
    };

     I discover also that changing 'dr_mode = ...' to anything does nothing.

    Finally, my question is, does it possible to set 'peripheral' and get PWM on PA10?

    MWoło.2AuthorAnswer
    Visitor II
    July 3, 2023

    I find a bit similar problem to my

    https://community.st.com/t5/stm32-mpu-products/120-369992-dwc2-49000000-usb-otg-overcurrent-change-detected/td-p/168914

    and finally, I created something like

    &usbotg_hs{
    	status = "okay";
    
    	/* USER CODE BEGIN usbotg_hs */
    	dr_mode = "peripheral";
    	usb-role-switch;
    	role-switch-default-mode = "peripheral"; 
    	phys = <&usbphyc_port1 0>;
    	phy-names = "usb2-phy";
    	/* USER CODE END usbotg_hs */
    };

     Now my gadget ethernet is working and backlight pwm also. Topic can be closed.