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

[PR] arch/{stm32|stm32f7|at32|samv7|imxrt}: fix for adc_setup [nuttx]

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

   ## Summary
   
   - stm32{f7}/adc: always increase initialization counter when adc_setup called
   - at32/adc: always increase initialization counter when adc_setup called
   - imxrt/adc: always increase initialization counter when adc_setup called
   - samv7/adc: always increase initialization counter when adc_setup called
   
   The problem originally occurred in stm32_adc.c and has propagated to other architectures.
   the `initialized` flag should be incremented every time adc_setup is called, otherwise the protective logic in adc_reset that is supposed to prevent resetting the ADC in use doesn't work properly.
   
   The problem occurs when the ADC peripheral is shared by more than one different driver. In my case this is ADC upper-half driver and FOC lower-half driver.
   
   ## Impact
   
   ## Testing
   only stm32 tested with b-g431b-esc1/foc_f32.
   


-- 
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


Re: [PR] arch/{stm32|stm32f7|at32|samv7|imxrt}: fix for adc_setup [nuttx]

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


##########
arch/arm/src/at32/at32_adc.c:
##########
@@ -2458,6 +2458,7 @@ static int adc_setup(struct adc_dev_s *dev)
 
   if (priv->initialized > 0)
     {
+      priv->initialized += 1;

Review Comment:
   this file uses `priv->initialzied +=` in other places so I prefer to leave it as it is. The same for `stm32_adc.c`



-- 
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


Re: [PR] arch/{stm32|stm32f7|at32|samv7|imxrt}: fix for adc_setup [nuttx]

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


##########
arch/arm/src/stm32/stm32_adc.c:
##########
@@ -2886,6 +2886,7 @@ static int adc_setup(struct adc_dev_s *dev)
 
   if (priv->initialized > 0)
     {
+      priv->initialized += 1;

Review Comment:
   ```suggestion
         priv->initialized++;
   ```
   



##########
arch/arm/src/stm32f7/stm32_adc.c:
##########
@@ -1798,6 +1798,7 @@ static int adc_setup(struct adc_dev_s *dev)
 
   if (priv->initialized > 0)
     {
+      priv->initialized += 1;

Review Comment:
   ```suggestion
         priv->initialized++;
   ```
   



##########
arch/arm/src/at32/at32_adc.c:
##########
@@ -2458,6 +2458,7 @@ static int adc_setup(struct adc_dev_s *dev)
 
   if (priv->initialized > 0)
     {
+      priv->initialized += 1;

Review Comment:
   ```suggestion
         priv->initialized++;
   ```
   



-- 
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


Re: [PR] arch/{stm32|stm32f7|at32|samv7|imxrt}: fix for adc_setup [nuttx]

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


##########
arch/arm/src/at32/at32_adc.c:
##########
@@ -2458,6 +2458,7 @@ static int adc_setup(struct adc_dev_s *dev)
 
   if (priv->initialized > 0)
     {
+      priv->initialized += 1;

Review Comment:
   Ok



-- 
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


Re: [PR] arch/{stm32|stm32f7|at32|samv7|imxrt}: fix for adc_setup [nuttx]

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


-- 
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