cancel
Showing results for 
Search instead for 
Did you mean: 

Ask a question about the PWM setting of the SPC58 series controller!

Bwang.3
Associate III

Hello! In the SPC58XX-RLA PWM-ICU Test Application for Discovery routine, I would like to ask which CH0 is circled in red as shown in the following figure, CH1... What do they represent? I have been confused whether eMIOS0 CH0 in the first image and Channel 0 in the Channel 0 Setting in the second image are the same channel. I hope you can give me an answer! Thank you!

QQ图片20240523183243.pngQQ图片20240523183345.png

1 ACCEPTED SOLUTION

Accepted Solutions
ATROI
ST Employee

Hi Bwang,

The answer to your question is no, channel 0 (CH0) in the first picture is not the same as in picture 1.

The example "SPC582Bxx_RLA PWM-ICU Test Application for Discovery" you see has two eMios set up differently. One is SAIC (Single Action Input Capture), and the other is OPWMB (Buffered Output Pulse With Modulation).

The Emios0 CH0-CH7 channels (Group 0) can be configured independently of each other either as PWM or ICU.

In addition, each channel of the eMaios0 Group0 can be configured with a different frequency depending on the frequency of the internal counter.

The eMios0 Group0 is shown in the red rectangle,

ATROI_0-1716722433606.png

while in the green rectangle, eMios0 is grouped as

    Group1 -> (CH9 - Ch15)

    Group2 -> (CH17 - CH23)

    Group3 -> (CH25 - CH31)

Group1,2,3 can be configured in the GUI as PWM with a common group frequency depending on the Internal Frequency Counter.

eMios configuration as PWM

In the example, the eMios configured as PWM is the Emios0 Group1.

ATROI_1-1716722465313.png

This is because pin 6 is selected as the output signal in the PinMap Editor and is used with CH9.

ATROI_2-1716722487988.png

In the PWM configuration window,

ATROI_3-1716722513515.png

in rectangle 1, eMios0 Group1-3 is selected as the channel group, based on the previous settings, and

in rectangle 2, 'Channel 0 settings' is configured, because it represents channel CH9. See the following image.

ATROI_4-1716722554728.png

AutoDevKit Team

View solution in original post

3 REPLIES 3
ATROI
ST Employee

Hi Bwang,

The answer to your question is no, channel 0 (CH0) in the first picture is not the same as in picture 1.

The example "SPC582Bxx_RLA PWM-ICU Test Application for Discovery" you see has two eMios set up differently. One is SAIC (Single Action Input Capture), and the other is OPWMB (Buffered Output Pulse With Modulation).

The Emios0 CH0-CH7 channels (Group 0) can be configured independently of each other either as PWM or ICU.

In addition, each channel of the eMaios0 Group0 can be configured with a different frequency depending on the frequency of the internal counter.

The eMios0 Group0 is shown in the red rectangle,

ATROI_0-1716722433606.png

while in the green rectangle, eMios0 is grouped as

    Group1 -> (CH9 - Ch15)

    Group2 -> (CH17 - CH23)

    Group3 -> (CH25 - CH31)

Group1,2,3 can be configured in the GUI as PWM with a common group frequency depending on the Internal Frequency Counter.

eMios configuration as PWM

In the example, the eMios configured as PWM is the Emios0 Group1.

ATROI_1-1716722465313.png

This is because pin 6 is selected as the output signal in the PinMap Editor and is used with CH9.

ATROI_2-1716722487988.png

In the PWM configuration window,

ATROI_3-1716722513515.png

in rectangle 1, eMios0 Group1-3 is selected as the channel group, based on the previous settings, and

in rectangle 2, 'Channel 0 settings' is configured, because it represents channel CH9. See the following image.

ATROI_4-1716722554728.png

AutoDevKit Team

Hello! I had the same doubt and your reply did a great job of clearing my doubts, so a huge thanks for that. But I have one more doubt  

In the PWM configuration window,

ATROI_3-1716722513515.png

for context I am using spc584Bx. In the rectangle 1, the channel group is selected as "eMIOS Group 1-3" and suppose I have to generate a 5kHz pwm signal from channel 9 (which is in group 1) and a 20kHz pwm signal from channel 30 (which is in group 3). Since I have selected "eMIOS Group 1-3" is it even possible to configure it to get my desired output ? if so , how am I suppose to do it ?


Thank you.

Hello Satya,

 if you need to configure two different PWMs (with different frequencies), I recommend using eMIOS0 because,

as highlighted in the latest post ,each channel can be configured independently of each others.

 below an example:

 Step 1) in EmiosGroup0 select two channels and set is as PWM

step 2) add two configuration objects in the PWM configuration section

 

ATROI_0-1749197642314.png

Step3) open each configuration row:

  •  assign an unique Symbolic Name
  • Configure Prescaler and Period according your needs.

 Step4) In the Channel 0 Settings section:

  • Set Output Mode
  • if you deem it necessary, you can insert the name of the callback function that  you will have to implement in the main.c file next
  • Save all.

 Step5) Repeat steps 2 and 3 also for the second configuration line.

 Step 6) Select "Generate application Code" to generate the code

ATROI_2-1749197765806.png

Step 7) Select the Pin Map editor as shown in the previous post and select the pin that belongs to eMios0 and the channel you selected in the configuration.

Step 8) Open the main.c file, import the library

 

ATROI_3-1749197794922.png

Step 9) Use the function pwm_lld_start to initialize and enable the PWM driver 2 (emios0 CH0)

ATROI_4-1749197826994.png

Suggestion: to identify the parameters that have to be passed to the pwm_lld_start function press the  "Ctrl + space bar" keys

ATROI_5-1749197887189.png

Note: you can use the following demo "SPC58ECxx_RLA PWM-ICU Test Application" present in AutoDevKit Studio as additional example

Hope this can help.

AutoDevKit Team