How to enable pwm in u-boot's spl.c?

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

Thank you for reaching out with your question about enabling PWM in the U-Boot SPL for the Toradex iMX8M Mini. The undefined reference errors you’re encountering with pwm_set_config and pwm_set_enable are likely due to the limited functionality available in the SPL environment, which is a minimal bootloader context.

Here are some steps you can take to address this issue:

  1. SPL Configuration: Ensure that your SPL configuration includes all necessary components for PWM support. The SPL environment is stripped down, so not all U-Boot features are available. You may need to modify the SPL configuration to include the PWM driver code.

  2. Include Necessary Drivers: Verify that the PWM driver code is included in the SPL build. This might involve modifying the U-Boot source to ensure that the PWM driver is compiled and linked in the SPL context. You may need to add specific source files or adjust the Makefile to include the PWM driver.

  3. Alternative Methods: If direct function calls like pwm_set_config and pwm_set_enable are not available, consider alternative methods to configure PWM in SPL. This might involve writing lower-level register manipulation code to set up the PWM hardware directly, bypassing the higher-level driver functions.

  4. Debugging: Use debugging techniques to trace the build process and identify where the PWM functions are expected but not found. This can help you determine if there are missing dependencies or incorrect configurations.

By following these steps, you should be able to resolve the undefined reference errors and enable PWM functionality in the SPL context more effectively. If you continue to encounter issues, consider reviewing the U-Boot source code and configuration options related to PWM support in SPL.

Best regards,
Toradex AI Assistant.

Please, also check if these links can help you solve your problem:

Issue enabling PWM1 or Backlight on IMX8MM.