How many PWM channels available in BCM20732S ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello

how many PWM channels are available in BCM20732S ?

I saw number "3" in some post but Table 2. Pin Description table in datasheet mentions about "PWM0", "PWM1", "PWM2", "PWM3".

Is it possible to run them all at a time ?

I'm asking because my customer is not successfully with it.

Thank you for help

Best regards

Mariusz

0 Likes
1 Solution
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

The module supports 3 PWM channels (4 are supported on the 20732 SOC)

While 4 of these distinct PWMs are mentioned in the 20732S module datasheet, only 3 can be used at one time.

View solution in original post

13 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

The module supports 3 PWM channels (4 are supported on the 20732 SOC)

While 4 of these distinct PWMs are mentioned in the 20732S module datasheet, only 3 can be used at one time.

Does that mean any 3 PWM channels, or is one specific PWM channel disallowed?

And out of curiosity, where does this limitation come from? On the SoC (20736), you can configure physical pin 1 for PWM1, physical pin 32 for PWM0, physical pin 29 for PWM3 and physical pin 30 for PWM2.

On the SiP (20736S) you could configure physical pin 1 for PWM1, physical pin 42 for PWM0, physical pin 39 for PWM3 and physical pin 40 for PWM2. So why can we run 4 PWM channels on the SoC, but only 3 on the SiP?

0 Likes

I was told by the gentleman that designed the firmware and the internal muxing between the SOC and the SIP Module that only 3 out of the 4 at any one time can be used.

Which three will of course depend on how you are using the other GPIO/alternate functionality on the same pins.

4 PWMs on the SoC

3 PWMs on the SIP Module

0 Likes

but that's just it - if I configure pin 1 for PWM1 (delivered by P27), pin 42 for PMW0 (delivered by P26), pin 39 for PWM3 (delivered by P13) and pin 40 for PWM2 (delivered by P14), which one of those four won't work?

I don't want to use any other functionality on those pins, only an output driver for a PWM channel.

0 Likes

My understanding was always that there are 4 on the SoC, and just 3 at a time on the SIP Module.

This information is propogated everywhere, both within our internal training material and througout the website.

However, I looked into this topic this afternoon and cannot explain why.

Per the SIP Datasheet, the 4 PMMs appear to be available on the follow physical/logical pins.

  • Pin 42/P26 = PWM0
  • Pin 1/P27  = PWM1
  • Pin 40/P14 = PWM2
  • Pin 39/P13 = PWM3
    • P28 = PWM2

We then know the following about the associated dual bonded pins:

  • P13/P28 (Dual bonded, only one of two is available.) <-Not using P28, Pick P13/PWM3
  • P14/P38 (Dual bonded, only one of two is available.) <-Not using P38, select P14/PWM2
  • P12/P26 (Dual bonded, only one of two is available.) <-Not using P12, select P26/PWM0
    • P12 if not using as P26 or external 32KHz LPO.  If using as 32KHz LPO then P12 and P26 are unavailable
  • P11/P27 (available on 20732S) (Dual bonded, only one of two is available.) <-Not using P11, select P27/PWM1
    • P11 if not using as P27 or external 32KHz LPO.  If using as 32KHz LPO then P11 and P27 are unavailable

At this point, it looks like you should be able to use P26/P27/P14/P13 for PWM0/PWM1/PWM2/PWM3 respectively.

P26/P27/P13 all appear to be able to source/sink 16mA, but it appears P14 can only source/sink 2mA, but that may be ok for some.

I even consulted an internal mux matrix document that shows the internal muxing between the SoC and SIP, but it agrees with my/our findings as well.

I'm not sure at this point why it shouldn't work on the SIP the same way it works on the SoC (both use the same firmware).

mariusz.lacina janusw dmiya

0 Likes

this poster: Re: How to get all 4 PWMs working at the same time on BCM20736S

had difficulty getting all of them working.

Many many thanks for looking into this closer for us. Your post BCM2073XS GPIO Basics is also helpful. It does seem as though pin 1 and pin 44 of the SiP are connected together (to pin 1 of the SoC), and so are pin 42 and 43 of the SiP (to pin 32 of the SoC). The redundancy is curious, and undocumented.

Also, if you want to use a crystal oscillator you lose two PWM channels (this is a limitation of the SoC).

0 Likes
lock attach
Attachments are accessible only for community members.

mariusz.lacina stuart_sf hsontag@sontagtech.com janusw


Good news.  I was able to find someone internally that was able to get 4 PWMs working.

The attached code demonstrates 4 PWM support through a modified version of the automation_io application.


At a high level, here is the GPIO init code used to enable this functionality:

    gpio_configurePin((AIO_PWM0) / 16, (AIO_PWM0) % 16, GPIO_OUTPUT_ENABLE, 0);
    gpio_configurePin((AIO_PWM1) / 16, (AIO_PWM1) % 16, GPIO_OUTPUT_ENABLE, 0);
    gpio_configurePin((AIO_PWM2) / 16, (AIO_PWM2) % 16, (2 << 4), 0);
   gpio_configurePin((AIO_PWM3) / 16, (AIO_PWM3) % 16, (2 << 4), 0);

They used the following code to set parameters for the PWM:


    aclk_configure(24000000, ACLK1, ACLK_FREQ_24_MHZ); // base clock 23.46 kHz, use 0x200-0x300 makes 46.78 kHz

    bleaio_pwm_init(AIO_ID_PWM0,PMU_CLK,AIO_PWM_STEPS, 0); //PMU_CLK or LHL_CLK
    bleaio_pwm_init(AIO_ID_PWM1,PMU_CLK,AIO_PWM_STEPS, 0);
    bleaio_pwm_init(AIO_ID_PWM2,PMU_CLK,AIO_PWM_STEPS, 0);
    bleaio_pwm_init(AIO_ID_PWM3,PMU_CLK,AIO_PWM_STEPS, 0);

Note that this was verified on *20732S*, which means it was created within SDK1.1.

However, we believe that it should behave the same on the 20736/7S.

4pwms.png

We just tested this with a BCM20736 SIP with SDK 2.1.1 and can confirm that the code above indeed works with a very important addition:

since P13 and P28 are dual-bonded on the SIP at pin 39 you get both PWM2 and PWM3 signals on that pin unless you turn off PWM2 for P28. To do so you have to add the following after configuring the other GPIO pins:

    gpio_configurePin((GPIO_PIN_P28) / 16, (GPIO_PIN_P28) % 16, GPIO_INPUT_ENABLE, 0);

Another note to Broadcom people: it is essential to document the special GPIO config flag (2 << 4) which seems to switch on the alternate function on a GPIO. We had some trouble finding that special config value in the documentation...

Thanks Stefan,

Since PWM_Tones and the discussions on the forum are the only sources of documentation I'm aware of for the PWM functionality, where did you find any documentation on the following:

Another note to Broadcom people: it is essential to document the special GPIO config flag (2 << 4) which seems to switch on the alternate function on a GPIO. We had some trouble finding that special config value in the documentation...

janusw vik86 j.t arvinds

0 Likes

Well, in fact we haven't been able to find any documentation about that except of sample code floating around here on the forum. We wonder why there was never a #define for (2<<4) except for the following enum in pwm.h:

enum

{

  /// PWM0 Output enable on P26

  PWM0_OUTPUT_ENABLE_P26  = GPIO_OUTPUT_ENABLE,

  /// PWM1 Output enable on P27

  PWM1_OUTPUT_ENABLE_P27  = GPIO_OUTPUT_ENABLE,

  /// PWM2 Output enable pn P28

  PWM2_OUTPUT_ENABLE_P28  = GPIO_OUTPUT_ENABLE,

  /// PWM2 Output enable on P6

  PWM2_OUTPUT_ENABLE_P6  = (GPIO_OUTPUT_ENABLE | (1 << 4)),

  /// PWM2 Output enable on P14

  PWM2_OUTPUT_ENABLE_P14  = (2 << 4),

  /// PWM3 Output enable on P29

  PWM3_OUTPUT_ENABLE_P29  = GPIO_OUTPUT_ENABLE,

  /// PWM3 Output enable on P13

  PWM3_OUTPUT_ENABLE_P13  = (2 << 4)

};

It is a little strange that P6 can be used for PWM2 as well. Does this apply to the 20732?

So IMHO there really is a need for better GPIO behaviour documentation especially for 20736/7 SOC and SIP.

The SoC datasheet states that the following GPIOs can be mapped as PWMs:

• P26
• P27
• P14/P28 (Dual bonded, only one of two is available.)
• P13

P6 may be a typo?

P14/P28 are the only instances I'm aware of on the module that can be used as PWM2.

All 2073XS modules should be identical with regards to PWM functionality in HW.

0 Likes
Anonymous
Not applicable

Thank you for answer mwf_mmfae.

Please include this important information in your datasheets, because people are confused and loosing their time looking for possible software errors.

Best regards

Mariusz Lacina

0 Likes

Noted.

0 Likes