Pulse-width modulation (PWM) is a technique that modifies the duty cycle of a pulsing signal to encode information or to control the amount of energy provided to a charge. The MCA implements pulse-width modulation in its firmware.

The MCA on the ConnectCore 8X system-on-module provides tree PWM controllers. Each controller has several channels and each channel maps to one MCA IO pin:

PWM controller Number of channels Channel IO

PWM0

6

0

MCA_IO0

1

MCA_IO12

2

MCA_IO15

3

MCA_IO16

4

MCA_IO17

5

MCA_IO18

PWM1

2

0

MCA_IO5

1

MCA_IO6

PWM2

2

0

MCA_IO7

1

MCA_IO8

On the ConnectCore 8X:

  • All MCA PWM channels are available on the LGA pads.

  • PWM0 channel 0 is available on the castellated pads.

  • PWM1 channels 0 and 1 are available on the castellated pads.

  • PWM2 channels 0 and 1 are available on the castellated pads.

On the ConnectCore 8X SBC Pro:

  • PWM0 channel 1 is available on the expansion header but shared with BT_WAKEUP_HOST signal so it can only be used with non-wireless versions of the SOM.

  • PWM0 channel 4 is available on the expansion header.

  • PWM0 channel 5 is routed to USER_LED0.

  • PWM1 channels 0 and 1 are available on the expansion header.

  • PWM2 channels 0 and 1 are available on the expansion header.

Kernel configuration

You can manage the ConnectCore 8X MCA PWM driver support through the following kernel configuration option:

  • Digi MCA PWM support (CONFIG_PWM_MCA)

This option is enabled as built-in on the default ConnectCore 8X kernel configuration file.

Kernel driver

The driver for the ConnectCore 8X MCA PWM is located at:

File Description

drivers/pwm/pwm-mca.c

MCA PWM driver

Device tree bindings and customization

The ConnectCore 8X MCA PWM interface is documented at Documentation/devicetree/bindings/pwm/digi,mca-pwm.txt.

ConnectCore 8X MCA PWM interfaces

The common ConnectCore 8X device tree file contains entries for all the MCA PWM controllers:

ConnectCore 8X device tree
mca_cc8x: mca@63 {
	pwms {
		compatible = "digi,mca-pwm";
		#address-cells = <1>;
		#size-cells = <0>;

		mca_pwm0: pwm@0 {
			reg = <0>;
			pwm-channels = <6>;
			#pwm-cells = <3>;
		};

		mca_pwm1: pwm@1 {
			reg = <1>;
			pwm-channels = <2>;
			#pwm-cells = <3>;
		};

		mca_pwm2: pwm@2 {
			reg = <2>;
			pwm-channels = <2>;
			#pwm-cells = <3>;
		};
	};
};

Using the MCA PWM channels

You can access PWM channels from your Android application. See PWM API for more information about the PWM APIx.

Sample application

The PWM Sample Application demonstrates the usage of the PWM API. In this example you can list all the available PWM chips and channels and configure the different PWM parameters.

Go to GitHub to see the application instructions and source code.

See also