- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've been having some difficulty getting all four PWMs working at once on the BCM20736S.
To the best of my knowledge, there is only once configuration that can get all four PWMs out:
PWM0 P26 pin 42
PWM1 P27 pin 1
PWM2 P14 pin 40
PWM3 P13 pin 39
I've learned about having to configure P14 and P13 *after* calling pwm_start, and I have 3 of the four working. However, pin 42 (PWM0) seems to output a signal which is low approx. 0.45 uSec, with a period of approx 43 uSec.
The period of PWM1 - PWM3 seems to be correct, about 24000 Hz. The duty cycle of PWM1 - PWM3 corresponds to the value passed for the "toggleCount" parameter in "pwm_start".
It seems that the period of PWM0 is also 24000 Hz, but the duty cycle seems to be stuck at 1/1024. For the code shown in our "initialize_pwm" below, PWM0 should be low for approx 4.5 uSec, not 0.45 uSec. Also, changing the PWM "toggleCount" parameter in the call to "pwm_start" doesn't change the PWM0 output waveform.
I've included code from a modified "hello_sensor" application for the PWM initialization. For reference, I've also included the initial GPIO configuration, which doesn't try to set the PWM GPIOs.
How can I get all four PWMs to output their appropriate signals at the same time?
void initialize_pwm(void)
{
// Disable sleep when PWM is active.
devlpm_registerForLowPowerQueries(timme_charger_device_lpm_queriable, 0);
aclk_configure(24000000, ACLK1, ACLK_FREQ_24_MHZ); //
gpio_configurePin(26/16,26%16,GPIO_OUTPUT_ENABLE, 0);
pwm_start(PWM0, PMU_CLK, 104, 0); // 10% duty cycle
gpio_configurePin(27/16,27%16,GPIO_OUTPUT_ENABLE, 0);
pwm_start(PWM1, PMU_CLK, 208, 0); // 20% duty cycle
pwm_start(PWM2, PMU_CLK, 312, 0); // 30% duty cycle
// For PWM2 output on P14, GPIO must be configured *after* setting PWM
// If you want the PWM2 output on P14:
gpio_configurePin(14/16, 14%16, (2 << 4), GPIO_OUTPUT_LOW);
pwm_start(PWM3, PMU_CLK, 416, 0); // 40% duty cycle
// If you want the PWM3 output on P13:
gpio_configurePin(13/16, 13%16, (2 << 4), GPIO_OUTPUT_LOW);
}
#define TIMME_ADC_INPUT_PIN 15 // P15 is ADC input
#define TIMME_ADC_INPUT_CHANNEL ADC_INPUT_P15 // should be = adc_convertGPIOtoADCInput(TIMME_ADC_INPUT_PIN)
#define DIAG_CONNECTOR_PIN_1 1
#define LED_CTRL_PIN 33
#define A0_GPIO_PIN 2
#define A1_GPIO_PIN 4
#define A2_GPIO_PIN 8
// The following structure defines GPIO configuration used by the application
const BLE_PROFILE_GPIO_CFG hello_sensor_gpio_cfg =
{
/*.gpio_pin =*/
{
1, // Pin 1 of DIAG connector
3, // Pin 2 of DIAG connector
25, // Pin 3 of DIAG connector
24, // Pin 4 of DIAG connector
LED_CTRL_PIN, // Controls external LED, 1 => LED on
0, 32, 33, // CHARGER_SHUTDOWN, TIMME_OFF, LED_CTRL
A0_GPIO_PIN,
A1_GPIO_PIN,
A2_GPIO_PIN,
-1, -1, -1, -1, // 26, 27, 14, 13, // PWM0 thru PWM3
-1 // TIMME_ADC_INPUT_PIN,
// -1, -1, -1 // enter -1 for any unused GPIOs
},
/*.gpio_flag =*/
{
(GPIO_OUTPUT | GPIO_INIT_LOW),
(GPIO_OUTPUT | GPIO_INIT_LOW),
(GPIO_OUTPUT | GPIO_INIT_HIGH),
(GPIO_OUTPUT | GPIO_INIT_HIGH),
(GPIO_OUTPUT | GPIO_INIT_HIGH),
(GPIO_OUTPUT | GPIO_INIT_HIGH), (GPIO_OUTPUT | GPIO_INIT_HIGH), (GPIO_OUTPUT | GPIO_INIT_HIGH),
(GPIO_OUTPUT | GPIO_INIT_HIGH), // A0_GPIO_PIN
(GPIO_OUTPUT | GPIO_INIT_LOW), // A1_GPIO_PIN
(GPIO_OUTPUT | GPIO_INIT_HIGH), // A2_GPIO_PIN
0, 0, 0, 0,
0 // (GPIO_OUTPUT | GPIO_INIT_LOW), // ADC input pin
// 0, 0, 0
}
};
Solved! Go to Solution.
- Labels:
-
PWM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are 3 PWM channels on SIP module (4 on SOC).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are 3 PWM channels on SIP module (4 on SOC).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Searching the entire "BCM20736S Technical Reference Manual" for "PWM" yields only 4 pages with information on PWM. All references to PWM only discuss the pin names PWM0 through PWM3.
How are we as developers supposed to know that there are only 3 available PWM channels when the data sheet discusses four?
Under what circumstances can PWM0 be used? What 3 PWM channels can be used under what circumstances?
This information should be front and center in a technical reference manual, because it makes the difference between suitability in some applications, and not being a candidate after all.
It’s unfortunate that we’ve invested a significant amount of time into getting familiar with this part, but we need 4 PWM's. We can't use the part if it only has 3.
Please make your data sheets representative of the part you’re offering.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We appreciate the feedback.
We understand that more PWM documentation is needed. Currently, the pwm_tones application, in addition to the posts here: WICED Smart Forums are what we can offer.
Note that both the SOC and SIP module are represented on the website, along with datasheets for each.
The SIP module offers a subset of functionality compared to the SIP module. Most select the SIP module because it includes most of the work needed to support global regulatory approvals.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This subject has been updated within this thread: Re: How many PWM channels available in BCM20732S ? as we had a user internally that was able to get all 4 PWMs working.