You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "jturnsek (via GitHub)" <gi...@apache.org> on 2023/03/10 13:57:07 UTC

[GitHub] [nuttx] jturnsek opened a new pull request, #8788: imxrt_flexpwm independent output B support added

jturnsek opened a new pull request, #8788:
URL: https://github.com/apache/nuttx/pull/8788

   ## Summary
   i.MXRT FlexPWM has two outputs per PWM submodule, called A and B, respectively. Output B can be set to be complementary output for Output A or independent. Later is increasing the number of channels per FlexPWM module from 4 to 8 if CONFIG_PWM_MULTICHAN is used. This PR is supporting this independent mode. If complementary mode is used, channel number of Output A must be used.
   
   ## Impact
   
   CONFIG_PWM_NCHANNELS must be set to 8 (maximum) and numbering of channels must be according, i.e. 0 to 7. Even if submodules are excluded with configuration. THis means if only MOD3 is used in FlexPWM1, usable channels are 4 and 5.
   
   ## Testing
   
   Tested with rgbled example on EdgePro1, where FlexPWM2 MOD3 Out B is used for Red and FlexPWM1 MOD4 Out A and Out B is used for Green and Blue.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] michallenc commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132798365


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   Ok, I got it. In this case channel numbers should be 1 to 8 since number 0 means the channel is not used (and is skipped per line [1258](https://github.com/apache/nuttx/blob/c9424becbb7f6813b3576a7646f1bd51517adf41/arch/arm/src/imxrt/imxrt_flexpwm.c#L1258)) . Therefore
   ```
   uint8_t shift = (info->channels[channel].channel - 1) >> 1;
   ```
   should be used. Otherwise we get mixed channels A and B. We should have MOD1 has channel 1 for output A and channel 2 for output B etc.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] jturnsek commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "jturnsek (via GitHub)" <gi...@apache.org>.
jturnsek commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1144415600


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -873,21 +905,38 @@ static int pwm_set_output(struct pwm_lowerhalf_s *dev, uint8_t channel,
   regval |= MCTRL_CLDOK(1 << shift);
   putreg16(regval, priv->base + IMXRT_FLEXPWM_MCTRL_OFFSET);
 
-  /* Write width to value register 3 and enable output A */
+  if ((channel - 1) % 2)

Review Comment:
   Ok, I would prefer to keep this as is, because I think it is only an estetical change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] michallenc commented on pull request #8788: imxrt_flexpwm independent output B support added

Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#issuecomment-1465622863

   @acassis I think this can be merged if you agree.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] jturnsek commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "jturnsek (via GitHub)" <gi...@apache.org>.
jturnsek commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132744742


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   Channel numbers are now from 0 to 7. MOD1 of FlexPWM has channel 0 for Output A and channel 1 for Output B. MOD2 has channels 2 and 3, etc. In order to get shift form 0 to 3, we need to divide channel number by 2, thus shifting left.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] michallenc commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132800176


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   Oh yea, my bad. You are right.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] jturnsek commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "jturnsek (via GitHub)" <gi...@apache.org>.
jturnsek commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132798784


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   The problem I see now is that channel numbers should not start with 0, because this is reserved for not enabled channel, I believe. At least I can see that in rgbled driver. Why is this not documented somehow in pwm.h?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] jturnsek commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "jturnsek (via GitHub)" <gi...@apache.org>.
jturnsek commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132816573


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   Have also changed the Summary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] jturnsek commented on pull request #8788: imxrt_flexpwm independent output B support added

Posted by "jturnsek (via GitHub)" <gi...@apache.org>.
jturnsek commented on PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#issuecomment-1464244386

   > does that complementary PWM has dead time support to H-Bridge usage like Michal submitted to SAM MCU? More info: https://community.element14.com/technologies/fpga-group/b/blog/posts/vhdl-pwm-generator-with-dead-time-the-design
   
   FlexPWM actually has a dead time support, but  I think it is not used here. That is something to be considered in future improvements.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] michallenc commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132824083


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   Thanks! I created PR #8791 adding this to pwm.h. You are correct it should have been documentated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] jturnsek commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "jturnsek (via GitHub)" <gi...@apache.org>.
jturnsek commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132816076


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   I have already corrected code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] jturnsek commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "jturnsek (via GitHub)" <gi...@apache.org>.
jturnsek commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132744742


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   Channel numbers are now from 0 to 7. MOD1 of FlexPWM has channel 0 for Output A and channel 1 for Output B. MOD2 has channels 2 and 3, etc. In order to get shift form 0 to 3, we need to divide channel number by 2, thus shifting right.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1133774463


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -873,21 +905,38 @@ static int pwm_set_output(struct pwm_lowerhalf_s *dev, uint8_t channel,
   regval |= MCTRL_CLDOK(1 << shift);
   putreg16(regval, priv->base + IMXRT_FLEXPWM_MCTRL_OFFSET);
 
-  /* Write width to value register 3 and enable output A */
+  if ((channel - 1) % 2)

Review Comment:
   Optional
   ```suggestion
     if ((channel - 1) % 2 != 0)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] acassis commented on pull request #8788: imxrt_flexpwm independent output B support added

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#issuecomment-1463882309

   @jturnsek does that complementary PWM has dead time support to H-Bridge usage like Michal submitted to SAM MCU?
   More info: https://community.element14.com/technologies/fpga-group/b/blog/posts/vhdl-pwm-generator-with-dead-time-the-design


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] michallenc commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132803053


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   Yes, channel numbers should indeed not start with 0, it is common for every PWM driver. I think it should be
   
   ```
   uint8_t shift = (info->channels[channel].channel -1) >> 1;
   ```
   
   In order to keep the correct numbering. And use channel numbers 1 to 8.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] jturnsek commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "jturnsek (via GitHub)" <gi...@apache.org>.
jturnsek commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132798784


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   The problem I see now is that channel numbers should not start with 0, because this is reserved for not defined channel, I believe. At least I can see that in rgbled driver. Why is this not documented somehow in pwm.h?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] jturnsek commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "jturnsek (via GitHub)" <gi...@apache.org>.
jturnsek commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1143338769


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -873,21 +905,38 @@ static int pwm_set_output(struct pwm_lowerhalf_s *dev, uint8_t channel,
   regval |= MCTRL_CLDOK(1 << shift);
   putreg16(regval, priv->base + IMXRT_FLEXPWM_MCTRL_OFFSET);
 
-  /* Write width to value register 3 and enable output A */
+  if ((channel - 1) % 2)

Review Comment:
   Do I need to fix something in order to merge PR?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko merged pull request #8788: imxrt_flexpwm independent output B support added

Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko merged PR #8788:
URL: https://github.com/apache/nuttx/pull/8788


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] jturnsek commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "jturnsek (via GitHub)" <gi...@apache.org>.
jturnsek commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132816076


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   I have already corrected the code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] michallenc commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132570711


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   I am not sure about this right shift. This will always result in zero, right? We need to have shift values from 0 to 4 in order to write in correct registers.



##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -856,7 +888,7 @@ static int pwm_set_output(struct pwm_lowerhalf_s *dev, uint8_t channel,
   uint16_t period;
   uint16_t width;
   uint16_t regval;
-  uint8_t shift = channel - 1;  /* Shift submodle offset addresses */
+  uint8_t shift = channel >> 1;  /* Shift submodle offset addresses */

Review Comment:
   The same as above.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] michallenc commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "michallenc (via GitHub)" <gi...@apache.org>.
michallenc commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1132803053


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   Yes, channel numbers should indeed not start with 0, it is common for every PWM driver. I think it should be
   
   ```
   uint8_t shift = (info->channels[channel].channel - 1) >> 1;
   ```
   
   In order to keep the correct numbering. And use channel numbers 1 to 8.



##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -774,7 +806,7 @@ static int pwm_change_freq(struct pwm_lowerhalf_s *dev,
 {
   struct imxrt_flexpwm_s *priv = (struct imxrt_flexpwm_s *)dev;
 #ifdef CONFIG_PWM_MULTICHAN
-  uint8_t shift = info->channels[channel].channel - 1;
+  uint8_t shift = info->channels[channel].channel >> 1;

Review Comment:
   Yes, channel numbers should not start with 0, it is common for every PWM driver. I think it should be
   
   ```
   uint8_t shift = (info->channels[channel].channel - 1) >> 1;
   ```
   
   In order to keep the correct numbering. And use channel numbers 1 to 8.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8788: imxrt_flexpwm independent output B support added

Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #8788:
URL: https://github.com/apache/nuttx/pull/8788#discussion_r1143873544


##########
arch/arm/src/imxrt/imxrt_flexpwm.c:
##########
@@ -873,21 +905,38 @@ static int pwm_set_output(struct pwm_lowerhalf_s *dev, uint8_t channel,
   regval |= MCTRL_CLDOK(1 << shift);
   putreg16(regval, priv->base + IMXRT_FLEXPWM_MCTRL_OFFSET);
 
-  /* Write width to value register 3 and enable output A */
+  if ((channel - 1) % 2)

Review Comment:
   No. Usually the reply "I would prefer to keep this as is" would be a sign that the author processed the comment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org