You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/11/17 17:04:34 UTC

[GitHub] [incubator-nuttx] TimJTi opened a new pull request, #7614: SAMA5D2 pio errors

TimJTi opened a new pull request, #7614:
URL: https://github.com/apache/incubator-nuttx/pull/7614

   ## Summary
   Added GPIO functionality revealed errors in the PIO related files for this processor
   
   ## Impact
   None to anything other than SAMA5D2 based boards, which will now work
   
   ## Testing
   GPIO example app used on a custom SAMA5D27-D5M board to check GPIO inputs and outputs as well as signals via interrupts which previously didn't work.
   
   


-- 
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] TimJTi closed pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi closed pull request #7614: SAMA5D2 pio errors
URL: https://github.com/apache/nuttx/pull/7614


-- 
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] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7614:
URL: https://github.com/apache/incubator-nuttx/pull/7614#discussion_r1027108915


##########
arch/arm/src/sama5/hardware/_sama5d2x_memorymap.h:
##########
@@ -517,9 +520,10 @@
 #define SAM_SFRBU_VBASE          (SAM_PERIPHC_VSECTION+SAM_SFRBU_OFFSET)
 #define SAM_CHIPID_VBASE         (SAM_PERIPHC_VSECTION+SAM_CHIPID_OFFSET)
 
-#define SAM_PIOA_VBASE           (SAM_PERIPHA_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOB_VBASE           (SAM_PERIPHB_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOC_VBASE           (SAM_PERIPHC_VSECTION+SAM_PIO_OFFSET)
+#define SAM_PIOA_VBASE           (SAM_PIO_VBASE)
+#define SAM_PIOB_VBASE           (SAM_PIO_VBASE+SAM_PIOB_OFFSET)
+#define SAM_PIOC_VBASE           (SAM_PIO_VBASE+SAM_PIOC_OFFSET)
+#define SAM_PIOD_VBASE           (SAM_PIO_VBASE+SAM_PIOD_OFFSET)

Review Comment:
   First of all if you are new to git and do not want to loose all your changes then I would recommend you to go with the next steps:
   ```
   git checkout SAMA5D2-PIO-errors
   git checkout -b SAMA5D2-PIO-errors-backup     # <- just checkout new branch, to save what you have now. you can push if you want of keep those changes locally
   git checkout SAMA5D2-PIO-errors     # <- get back to branch for this PR
   git rebase -i master       # <- to trigger interactive rebase. Here you can reorder, update, squash, etc. your commits
   git rebase --continue     # <- will be needed after each step is finished until you reach the end
   git push -f origin SAMA5D2-PIO-errors    # <- this will "force-push" your branch. It meats that Github version will be overwritten with your local change in SAMA5D2-PIO-errors branch, but SAMA5D2-PIO-errors-backup will still contain old code, so you can recover from it in case anything goes wrong
   ```



-- 
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] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7614:
URL: https://github.com/apache/incubator-nuttx/pull/7614#discussion_r1027102529


##########
arch/arm/src/sama5/Kconfig:
##########
@@ -3244,13 +3244,15 @@ config SAMA5_ADC_SEQUENCER
 config SAMA5_ADC_ANARCH
 	bool "Analog changes"
 	default n
+  depends on ARCH_CHIP_SAMA5D3 || ARCH_CHIP_SAMA5D2
 	---help---
 		This option allows you to select different gain, offset, and single
 		vs. differential modes for each channel.
 
 if SAMA5_ADC_ANARCH
 
 menu "Channel gain"
+depends on ARCH_CHIP_SAMA5D3

Review Comment:
   ```suggestion
   	depends on ARCH_CHIP_SAMA5D3
   ```



##########
arch/arm/src/sama5/Kconfig:
##########
@@ -3627,12 +3627,45 @@ config SAMA5_ADC_TIOATRIG
 		A-to-D Conversion is initiated the A output from one of
 		Timer/Counter 0 channels.
 
+config SAMA5_ADC_PWMTRIG
+  bool "PWM Event trigger"
+  depends on SAMA5_PWM
+  ---help---
+    A-to-D Conversion is initiated from the PWM event lines
+
+config SAMA5_ADC_RTCOUT
+  bool "RTC Out trigger"
+  depends on SAMA5_RTC
+  depends on ARCH_CHIP_SAMA5D2
+  ---help---
+    A-to-D Conversion is initiated from the RTC output
+
 endchoice # Trigger mode
 
+if SAMA5_ADC_PWMTRIG
+
+choice
+  prompt "PWM Event Line Selection"
+  default SAMA5_ADC_PWMTRIG_LINE0
+
+config SAMA5_ADC_PWM_TRIG_LINE0
+  bool "PWM event Line 0"
+  ---help---
+    Trigger A-to-D conversion on PWM event line 0

Review Comment:
   TABs



##########
arch/arm/src/sama5/sam_tc.c:
##########
@@ -1460,7 +1461,7 @@ int sam_tc_divisor(uint32_t frequency, uint32_t *div, uint32_t *tcclks)
   uint32_t ftcin = sam_tc_infreq();
   int ndx = 0;
 
-  tmrinfo("frequency=%d\n", frequency);
+  tmrinfo("frequency=%ld\n", frequency);

Review Comment:
   ```suggestion
     tmrinfo("frequency=%" PRIu32 "\n", frequency);
   ```



##########
arch/arm/src/sama5/sama5d2x_pio.c:
##########
@@ -262,6 +262,32 @@ static uint32_t sam_configcommon(pio_pinset_t cfgset)
       break;
     }
 
+  /* Select Input Event selection.
+   * NOTE: Only applies to input pins
+   */
+
+  switch (cfgset & PIO_INT_MASK)
+    {
+      default:
+      case PIO_INT_NONE:
+      break;
+      case PIO_INT_FALLING:
+        regval |= PIO_CFGR_EVTSEL_FALLING;
+      break;

Review Comment:
   ```suggestion
           break;
   ```



##########
arch/arm/src/sama5/sama5d2x_pio.c:
##########
@@ -262,6 +262,32 @@ static uint32_t sam_configcommon(pio_pinset_t cfgset)
       break;
     }
 
+  /* Select Input Event selection.
+   * NOTE: Only applies to input pins
+   */
+
+  switch (cfgset & PIO_INT_MASK)
+    {
+      default:
+      case PIO_INT_NONE:
+      break;
+      case PIO_INT_FALLING:
+        regval |= PIO_CFGR_EVTSEL_FALLING;
+      break;
+      case PIO_INT_RISING:
+        regval |= PIO_CFGR_EVTSEL_RISING;
+      break;
+      case PIO_INT_BOTHEDGES:
+        regval |= PIO_CFGR_EVTSEL_BOTH;
+      break;
+      case PIO_INT_LOWLEVEL:
+        regval |= PIO_CFGR_EVTSEL_LOW;
+      break;

Review Comment:
   ```suggestion
           break;
   ```



##########
arch/arm/src/sama5/Kconfig:
##########
@@ -3487,6 +3490,7 @@ config SAMA5_ADC_OFFSET11
 endmenu # Channel offsets
 
 menu "Channel differential mode"
+depends on ARCH_CHIP_SAMA5D3 || ARCH_CHIP_SAMA5D2

Review Comment:
   ```suggestion
   	depends on ARCH_CHIP_SAMA5D3 || ARCH_CHIP_SAMA5D2
   ```



##########
arch/arm/src/sama5/Kconfig:
##########
@@ -3627,12 +3627,45 @@ config SAMA5_ADC_TIOATRIG
 		A-to-D Conversion is initiated the A output from one of
 		Timer/Counter 0 channels.
 
+config SAMA5_ADC_PWMTRIG
+  bool "PWM Event trigger"
+  depends on SAMA5_PWM
+  ---help---
+    A-to-D Conversion is initiated from the PWM event lines
+
+config SAMA5_ADC_RTCOUT
+  bool "RTC Out trigger"
+  depends on SAMA5_RTC
+  depends on ARCH_CHIP_SAMA5D2
+  ---help---
+    A-to-D Conversion is initiated from the RTC output
+
 endchoice # Trigger mode
 
+if SAMA5_ADC_PWMTRIG
+
+choice
+  prompt "PWM Event Line Selection"
+  default SAMA5_ADC_PWMTRIG_LINE0

Review Comment:
   TABs



##########
arch/arm/src/sama5/Kconfig:
##########
@@ -3573,11 +3577,11 @@ config SAMA5_ADC_DIFFMODE11
 		Selects differential (vs. single-ended mode) for ADC channel 11
 
 endmenu # Differential mode
-endif # SAMA5_ADC_ANARCH
 
-if !SAMA5_ADC_ANARCH
+endif # SAMA5_ADC_ANARCH
 
 config SAMA5_ADC_GAIN
+depends on ARCH_CHIP_SAMA5D3

Review Comment:
   ```suggestion
   	depends on ARCH_CHIP_SAMA5D3
   ```



##########
arch/arm/src/sama5/Kconfig:
##########
@@ -3244,13 +3244,15 @@ config SAMA5_ADC_SEQUENCER
 config SAMA5_ADC_ANARCH
 	bool "Analog changes"
 	default n
+  depends on ARCH_CHIP_SAMA5D3 || ARCH_CHIP_SAMA5D2

Review Comment:
   TABs



##########
arch/arm/src/sama5/Kconfig:
##########
@@ -3387,6 +3389,7 @@ config SAMA5_ADC_GAIN11
 endmenu # Channel gain
 
 menu "Channel offsets"
+depends on ARCH_CHIP_SAMA5D3

Review Comment:
   ```suggestion
   	depends on ARCH_CHIP_SAMA5D3
   ```



##########
arch/arm/src/sama5/Kconfig:
##########
@@ -3712,6 +3746,17 @@ config SAMA5_ADC_TIOA_BOTH
 
 endchoice # ADTRG edge
 endif # SAMA5_ADC_TIOATRIG
+
+if SAMA5_ADC_PERIODIC_TRIG
+
+config SAMA5_ADC_TRIGGER_PERIOD
+	int "ADC Periodic Trigger Rate, useconds"
+	default 50000
+	---help---
+    This setting determines the periodic sample trigger rate in useconds.

Review Comment:
   TABs



##########
arch/arm/src/sama5/Kconfig:
##########
@@ -3627,12 +3627,45 @@ config SAMA5_ADC_TIOATRIG
 		A-to-D Conversion is initiated the A output from one of
 		Timer/Counter 0 channels.
 
+config SAMA5_ADC_PWMTRIG
+  bool "PWM Event trigger"
+  depends on SAMA5_PWM
+  ---help---
+    A-to-D Conversion is initiated from the PWM event lines
+
+config SAMA5_ADC_RTCOUT
+  bool "RTC Out trigger"
+  depends on SAMA5_RTC
+  depends on ARCH_CHIP_SAMA5D2
+  ---help---
+    A-to-D Conversion is initiated from the RTC output
+
 endchoice # Trigger mode
 
+if SAMA5_ADC_PWMTRIG
+
+choice
+  prompt "PWM Event Line Selection"
+  default SAMA5_ADC_PWMTRIG_LINE0
+
+config SAMA5_ADC_PWM_TRIG_LINE0
+  bool "PWM event Line 0"
+  ---help---
+    Trigger A-to-D conversion on PWM event line 0
+
+config SAMA5_ADC_PWM_TRIG_LINE1
+  bool "PWM event Line 1"
+  ---help---
+    Trigger A-to-D conversion on PWM event line 1

Review Comment:
   TABs



##########
arch/arm/src/sama5/Kconfig:
##########
@@ -3627,12 +3627,45 @@ config SAMA5_ADC_TIOATRIG
 		A-to-D Conversion is initiated the A output from one of
 		Timer/Counter 0 channels.
 
+config SAMA5_ADC_PWMTRIG
+  bool "PWM Event trigger"
+  depends on SAMA5_PWM
+  ---help---
+    A-to-D Conversion is initiated from the PWM event lines

Review Comment:
   TABs



##########
arch/arm/src/sama5/sam_adc.c:
##########
@@ -1728,7 +1890,8 @@ static void sam_adc_gain(struct sam_adc_s *priv)
   /* Set GAIN0 only.  GAIN0 will be used for all channels. */
 
   sam_adc_putreg(priv, SAM_ADC_CGR, ADC_CGR_GAIN0(CONFIG_SAMA5_ADC_GAIN));
-#endif
+#endif /* CONFIG_SAMA5_ADC_ANARCH */

Review Comment:
   ```suggestion
   #  endif /* CONFIG_SAMA5_ADC_ANARCH */
   ```



##########
arch/arm/src/sama5/Kconfig:
##########
@@ -3627,12 +3627,45 @@ config SAMA5_ADC_TIOATRIG
 		A-to-D Conversion is initiated the A output from one of
 		Timer/Counter 0 channels.
 
+config SAMA5_ADC_PWMTRIG
+  bool "PWM Event trigger"
+  depends on SAMA5_PWM
+  ---help---
+    A-to-D Conversion is initiated from the PWM event lines
+
+config SAMA5_ADC_RTCOUT
+  bool "RTC Out trigger"
+  depends on SAMA5_RTC
+  depends on ARCH_CHIP_SAMA5D2
+  ---help---
+    A-to-D Conversion is initiated from the RTC output

Review Comment:
   TABs



##########
arch/arm/src/sama5/sam_adc.c:
##########
@@ -2050,9 +2213,17 @@ struct adc_dev_s *sam_adc_initialize(void)
       /* Initialize the public ADC device data structure */
 
 #ifdef SAMA5_ADC_HAVE_CHANNELS
+      g_adcdev.ad_ops  = &g_adcops;
       priv->dev = &g_adcdev;
 #endif
 
+      g_adcdev.ad_priv = priv;
+
+      /* Initialize the private ADC device data structure */
+
+      nxmutex_init(&priv->lock);
+      priv->cb  = NULL;

Review Comment:
   ```suggestion
         priv->cb = NULL;
   ```



##########
arch/arm/src/sama5/sam_tc.c:
##########
@@ -599,8 +599,8 @@ static inline uint32_t sam_tc_getreg(struct sam_chan_s *chan,
  *
  ****************************************************************************/
 
-static inline void sam_tc_putreg(struct sam_chan_s *chan, uint32_t regval,
-                                 unsigned int offset)
+static inline void sam_tc_putreg(struct sam_chan_s *chan,
+                                unsigned int offset, uint32_t regval)

Review Comment:
   ```suggestion
                                    unsigned int offset, uint32_t regval)
   ```



##########
arch/arm/src/sama5/sam_adc.c:
##########
@@ -2050,9 +2213,17 @@ struct adc_dev_s *sam_adc_initialize(void)
       /* Initialize the public ADC device data structure */
 
 #ifdef SAMA5_ADC_HAVE_CHANNELS
+      g_adcdev.ad_ops  = &g_adcops;

Review Comment:
   ```suggestion
         g_adcdev.ad_ops = &g_adcops;
   ```



##########
arch/arm/src/sama5/sam_tsd.c:
##########
@@ -137,6 +137,18 @@
 #  define MAX(a,b) (((a) > (b)) ? (a) : (b))
 #endif
 
+#ifndef BOARD_TSSCTIM
+# define BOARD_TSSCTIM 0

Review Comment:
   ```suggestion
   #  define BOARD_TSSCTIM 0
   ```



##########
arch/arm/src/sama5/sam_tsd.c:
##########
@@ -245,12 +257,7 @@ static const struct file_operations g_tsdops =
 
 /* The driver state structure is pre-allocated. */
 
-static struct sam_tsd_s g_tsd =
-{
-  .threshx = INVALID_THRESHOLD,
-  .threshy = INVALID_THRESHOLD,
-  .waitsem = SEM_INITIALIZER(0),
-};
+static struct sam_tsd_s g_tsd;

Review Comment:
   Why static init is removed?



##########
arch/arm/src/sama5/sam_tsd.c:
##########
@@ -1655,7 +1735,10 @@ int sam_tsd_register(struct sam_adc_s *adc, int minor)
 
   /* Initialize the touchscreen device driver instance */
 
-  priv->adc = adc; /* Save the ADC device handle */
+  priv->adc     = adc;               /* Save the ADC device handle    */
+  priv->threshx = INVALID_THRESHOLD; /* Initialize thresholding logic */
+  priv->threshy = INVALID_THRESHOLD; /* Initialize thresholding logic */
+  nxsem_init(&priv->waitsem, 0, 0);

Review Comment:
   Why those fields can't be initialized statically?



##########
arch/arm/src/sama5/sam_tsd.c:
##########
@@ -1318,7 +1378,11 @@ static void sam_tsd_tracking(struct sam_tsd_s *priv, uint32_t time)
           tracktim--;
         }
     }
-
+#elif defined (ATSAMA5D3)

Review Comment:
   ```suggestion
   #elif defined(ATSAMA5D3)
   ```



##########
arch/arm/src/sama5/sam_tsd.c:
##########
@@ -460,9 +468,11 @@ static void sam_tsd_setaverage(struct sam_tsd_s *priv, uint32_t tsav)
         {
           /* Set TSFREQ = TSAV */
 
-          regval &= ~ADC_TSMR_TSFREQ_MASK;
-          regval |=  ADC_TSMR_TSFREQ(minfreq);
+          tsfreq = minfreq;
         }
+
+        regval &= ~ADC_TSMR_TSFREQ_MASK;
+        regval |=  ADC_TSMR_TSFREQ(minfreq);

Review Comment:
   ```suggestion
           regval |= ADC_TSMR_TSFREQ(minfreq);
   ```



##########
arch/arm/src/sama5/sam_tsd.c:
##########
@@ -639,6 +684,7 @@ static void sam_tsd_bottomhalf(void *arg)
                 yraw, yscale);
           goto ignored;
         }
+#endif

Review Comment:
   ```suggestion
   ```



##########
arch/arm/src/sama5/sama5d2x_pio.c:
##########
@@ -262,6 +262,32 @@ static uint32_t sam_configcommon(pio_pinset_t cfgset)
       break;
     }
 
+  /* Select Input Event selection.
+   * NOTE: Only applies to input pins
+   */
+
+  switch (cfgset & PIO_INT_MASK)
+    {
+      default:
+      case PIO_INT_NONE:
+      break;
+      case PIO_INT_FALLING:
+        regval |= PIO_CFGR_EVTSEL_FALLING;
+      break;
+      case PIO_INT_RISING:
+        regval |= PIO_CFGR_EVTSEL_RISING;
+      break;

Review Comment:
   ```suggestion
           break;
   ```



##########
arch/arm/src/sama5/sam_tsd.c:
##########
@@ -630,7 +675,7 @@ static void sam_tsd_bottomhalf(void *arg)
       pressr = sam_adc_getreg(priv->adc, SAM_ADC_PRESSR);
 #endif
       /* Discard any bad readings.  This check may not be necessary. */
-
+#if 1

Review Comment:
   ```suggestion
   ```



##########
arch/arm/src/sama5/sama5d2x_pio.c:
##########
@@ -262,6 +262,32 @@ static uint32_t sam_configcommon(pio_pinset_t cfgset)
       break;
     }
 
+  /* Select Input Event selection.
+   * NOTE: Only applies to input pins
+   */
+
+  switch (cfgset & PIO_INT_MASK)
+    {
+      default:
+      case PIO_INT_NONE:
+      break;

Review Comment:
   ```suggestion
           break;
   ```



##########
arch/arm/src/sama5/sama5d2x_pio.c:
##########
@@ -262,6 +262,32 @@ static uint32_t sam_configcommon(pio_pinset_t cfgset)
       break;
     }
 
+  /* Select Input Event selection.
+   * NOTE: Only applies to input pins
+   */
+
+  switch (cfgset & PIO_INT_MASK)
+    {
+      default:
+      case PIO_INT_NONE:
+      break;
+      case PIO_INT_FALLING:
+        regval |= PIO_CFGR_EVTSEL_FALLING;
+      break;
+      case PIO_INT_RISING:
+        regval |= PIO_CFGR_EVTSEL_RISING;
+      break;
+      case PIO_INT_BOTHEDGES:
+        regval |= PIO_CFGR_EVTSEL_BOTH;
+      break;

Review Comment:
   ```suggestion
           break;
   ```



##########
arch/arm/src/sama5/hardware/_sama5d2x_memorymap.h:
##########
@@ -517,9 +520,10 @@
 #define SAM_SFRBU_VBASE          (SAM_PERIPHC_VSECTION+SAM_SFRBU_OFFSET)
 #define SAM_CHIPID_VBASE         (SAM_PERIPHC_VSECTION+SAM_CHIPID_OFFSET)
 
-#define SAM_PIOA_VBASE           (SAM_PERIPHA_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOB_VBASE           (SAM_PERIPHB_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOC_VBASE           (SAM_PERIPHC_VSECTION+SAM_PIO_OFFSET)
+#define SAM_PIOA_VBASE           (SAM_PIO_VBASE)
+#define SAM_PIOB_VBASE           (SAM_PIO_VBASE+SAM_PIOB_OFFSET)
+#define SAM_PIOC_VBASE           (SAM_PIO_VBASE+SAM_PIOC_OFFSET)
+#define SAM_PIOD_VBASE           (SAM_PIO_VBASE+SAM_PIOD_OFFSET)

Review Comment:
   Maybe better to add `SAM_PERIPHB_VSECTION`, `SAM_PERIPHC_VSECTION` and `SAM_PERIPHD_VSECTION` just from style perspective? And define:
   ```
   #  define SAM_PIO_OFFSET         0x00038000 /* 0x00038000-0x0003bfff: PIOA-D */
   #  define SAM_PIOA_OFFSET        0x00038000 /* PIOA */
   #  define SAM_PIOB_OFFSET        0x00038040 /* PIOB */
   #  define SAM_PIOC_OFFSET        0x00038080 /* PIOC */
   #  define SAM_PIOD_OFFSET        0x000380c0 /* PIOD */
   ```
   ?



##########
arch/arm/src/sama5/sama5d2x_pio.c:
##########
@@ -262,6 +262,32 @@ static uint32_t sam_configcommon(pio_pinset_t cfgset)
       break;
     }
 
+  /* Select Input Event selection.
+   * NOTE: Only applies to input pins
+   */
+
+  switch (cfgset & PIO_INT_MASK)
+    {
+      default:
+      case PIO_INT_NONE:
+      break;
+      case PIO_INT_FALLING:
+        regval |= PIO_CFGR_EVTSEL_FALLING;
+      break;
+      case PIO_INT_RISING:
+        regval |= PIO_CFGR_EVTSEL_RISING;
+      break;
+      case PIO_INT_BOTHEDGES:
+        regval |= PIO_CFGR_EVTSEL_BOTH;
+      break;
+      case PIO_INT_LOWLEVEL:
+        regval |= PIO_CFGR_EVTSEL_LOW;
+      break;
+      case PIO_INT_HIGHLEVEL:
+        regval |= PIO_CFGR_EVTSEL_HIGH;
+      break;

Review Comment:
   ```suggestion
           break;
   ```



-- 
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] [incubator-nuttx] TimJTi commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi commented on code in PR #7614:
URL: https://github.com/apache/incubator-nuttx/pull/7614#discussion_r1027106631


##########
arch/arm/src/sama5/sama5d2x_pio.c:
##########
@@ -262,6 +262,32 @@ static uint32_t sam_configcommon(pio_pinset_t cfgset)
       break;
     }
 
+  /* Select Input Event selection.
+   * NOTE: Only applies to input pins
+   */
+
+  switch (cfgset & PIO_INT_MASK)
+    {
+      default:
+      case PIO_INT_NONE:
+      break;
+      case PIO_INT_FALLING:
+        regval |= PIO_CFGR_EVTSEL_FALLING;
+      break;
+      case PIO_INT_RISING:
+        regval |= PIO_CFGR_EVTSEL_RISING;
+      break;
+      case PIO_INT_BOTHEDGES:
+        regval |= PIO_CFGR_EVTSEL_BOTH;
+      break;
+      case PIO_INT_LOWLEVEL:
+        regval |= PIO_CFGR_EVTSEL_LOW;
+      break;
+      case PIO_INT_HIGHLEVEL:
+        regval |= PIO_CFGR_EVTSEL_HIGH;
+      break;

Review Comment:
   Rather than commit your corrections here (the easy option) I will go through them one by one, manually, to make sure I fully understand and learn from this :-)



-- 
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] TimJTi commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi commented on code in PR #7614:
URL: https://github.com/apache/nuttx/pull/7614#discussion_r1032314382


##########
arch/arm/src/sama5/sam_tsd.c:
##########
@@ -1655,7 +1735,10 @@ int sam_tsd_register(struct sam_adc_s *adc, int minor)
 
   /* Initialize the touchscreen device driver instance */
 
-  priv->adc = adc; /* Save the ADC device handle */
+  priv->adc     = adc;               /* Save the ADC device handle    */
+  priv->threshx = INVALID_THRESHOLD; /* Initialize thresholding logic */
+  priv->threshy = INVALID_THRESHOLD; /* Initialize thresholding logic */
+  nxsem_init(&priv->waitsem, 0, 0);

Review Comment:
   Wasn't my code or change. But can look at this.



-- 
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] TimJTi commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi commented on code in PR #7614:
URL: https://github.com/apache/nuttx/pull/7614#discussion_r1032315114


##########
arch/arm/src/sama5/sama5d2x_pio.c:
##########
@@ -262,6 +262,32 @@ static uint32_t sam_configcommon(pio_pinset_t cfgset)
       break;
     }
 
+  /* Select Input Event selection.
+   * NOTE: Only applies to input pins
+   */
+
+  switch (cfgset & PIO_INT_MASK)
+    {
+      default:
+      case PIO_INT_NONE:
+      break;
+      case PIO_INT_FALLING:
+        regval |= PIO_CFGR_EVTSEL_FALLING;
+      break;

Review Comment:
   Change made



-- 
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] [incubator-nuttx] TimJTi commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi commented on code in PR #7614:
URL: https://github.com/apache/incubator-nuttx/pull/7614#discussion_r1027106905


##########
arch/arm/src/sama5/hardware/_sama5d2x_memorymap.h:
##########
@@ -517,9 +520,10 @@
 #define SAM_SFRBU_VBASE          (SAM_PERIPHC_VSECTION+SAM_SFRBU_OFFSET)
 #define SAM_CHIPID_VBASE         (SAM_PERIPHC_VSECTION+SAM_CHIPID_OFFSET)
 
-#define SAM_PIOA_VBASE           (SAM_PERIPHA_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOB_VBASE           (SAM_PERIPHB_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOC_VBASE           (SAM_PERIPHC_VSECTION+SAM_PIO_OFFSET)
+#define SAM_PIOA_VBASE           (SAM_PIO_VBASE)
+#define SAM_PIOB_VBASE           (SAM_PIO_VBASE+SAM_PIOB_OFFSET)
+#define SAM_PIOC_VBASE           (SAM_PIO_VBASE+SAM_PIOC_OFFSET)
+#define SAM_PIOD_VBASE           (SAM_PIO_VBASE+SAM_PIOD_OFFSET)

Review Comment:
   I am still nervous of git operations, especially command line operation as I use GitHub Desktop.
   
   What is the method to do this, please?



-- 
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] [incubator-nuttx] TimJTi commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi commented on code in PR #7614:
URL: https://github.com/apache/incubator-nuttx/pull/7614#discussion_r1028003622


##########
arch/arm/src/sama5/hardware/_sama5d2x_memorymap.h:
##########
@@ -517,9 +520,10 @@
 #define SAM_SFRBU_VBASE          (SAM_PERIPHC_VSECTION+SAM_SFRBU_OFFSET)
 #define SAM_CHIPID_VBASE         (SAM_PERIPHC_VSECTION+SAM_CHIPID_OFFSET)
 
-#define SAM_PIOA_VBASE           (SAM_PERIPHA_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOB_VBASE           (SAM_PERIPHB_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOC_VBASE           (SAM_PERIPHC_VSECTION+SAM_PIO_OFFSET)
+#define SAM_PIOA_VBASE           (SAM_PIO_VBASE)
+#define SAM_PIOB_VBASE           (SAM_PIO_VBASE+SAM_PIOB_OFFSET)
+#define SAM_PIOC_VBASE           (SAM_PIO_VBASE+SAM_PIOC_OFFSET)
+#define SAM_PIOD_VBASE           (SAM_PIO_VBASE+SAM_PIOD_OFFSET)

Review Comment:
   Discovered there are #defines for PIOA/B/C/D VBASE address in _sama5d2_pio.h, so the fix will make use of those now. i.e.
   
   #define SAM_PIOA_VASE       SAM_PIO_IOGROUPA_VBASE
   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] [incubator-nuttx] TimJTi commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi commented on code in PR #7614:
URL: https://github.com/apache/incubator-nuttx/pull/7614#discussion_r1027109592


##########
arch/arm/src/sama5/hardware/_sama5d2x_memorymap.h:
##########
@@ -517,9 +520,10 @@
 #define SAM_SFRBU_VBASE          (SAM_PERIPHC_VSECTION+SAM_SFRBU_OFFSET)
 #define SAM_CHIPID_VBASE         (SAM_PERIPHC_VSECTION+SAM_CHIPID_OFFSET)
 
-#define SAM_PIOA_VBASE           (SAM_PERIPHA_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOB_VBASE           (SAM_PERIPHB_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOC_VBASE           (SAM_PERIPHC_VSECTION+SAM_PIO_OFFSET)
+#define SAM_PIOA_VBASE           (SAM_PIO_VBASE)
+#define SAM_PIOB_VBASE           (SAM_PIO_VBASE+SAM_PIOB_OFFSET)
+#define SAM_PIOC_VBASE           (SAM_PIO_VBASE+SAM_PIOC_OFFSET)
+#define SAM_PIOD_VBASE           (SAM_PIO_VBASE+SAM_PIOD_OFFSET)

Review Comment:
   Thank you!



-- 
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] TimJTi commented on pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi commented on PR #7614:
URL: https://github.com/apache/nuttx/pull/7614#issuecomment-1327402055

   Closing as this is merged with other changes in a PR I have closed and same applies here - my lack of github skills have rendered the PR a waste of time.


-- 
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] TimJTi commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi commented on code in PR #7614:
URL: https://github.com/apache/nuttx/pull/7614#discussion_r1032314697


##########
arch/arm/src/sama5/sama5d2x_pio.c:
##########
@@ -262,6 +262,32 @@ static uint32_t sam_configcommon(pio_pinset_t cfgset)
       break;
     }
 
+  /* Select Input Event selection.
+   * NOTE: Only applies to input pins
+   */
+
+  switch (cfgset & PIO_INT_MASK)
+    {
+      default:
+      case PIO_INT_NONE:
+      break;

Review Comment:
   Change made



-- 
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] TimJTi commented on pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi commented on PR #7614:
URL: https://github.com/apache/nuttx/pull/7614#issuecomment-1327337644

   Let me know if there's anything else (apart from he static initialization discussed above) you'd like done. As I gain more GitHub experience (aka PAIN) I could close this and resubmit as a clean patch to most recent master? I think!


-- 
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] [incubator-nuttx] TimJTi commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi commented on code in PR #7614:
URL: https://github.com/apache/incubator-nuttx/pull/7614#discussion_r1027106510


##########
arch/arm/src/sama5/hardware/_sama5d2x_memorymap.h:
##########
@@ -517,9 +520,10 @@
 #define SAM_SFRBU_VBASE          (SAM_PERIPHC_VSECTION+SAM_SFRBU_OFFSET)
 #define SAM_CHIPID_VBASE         (SAM_PERIPHC_VSECTION+SAM_CHIPID_OFFSET)
 
-#define SAM_PIOA_VBASE           (SAM_PERIPHA_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOB_VBASE           (SAM_PERIPHB_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOC_VBASE           (SAM_PERIPHC_VSECTION+SAM_PIO_OFFSET)
+#define SAM_PIOA_VBASE           (SAM_PIO_VBASE)
+#define SAM_PIOB_VBASE           (SAM_PIO_VBASE+SAM_PIOB_OFFSET)
+#define SAM_PIOC_VBASE           (SAM_PIO_VBASE+SAM_PIOC_OFFSET)
+#define SAM_PIOD_VBASE           (SAM_PIO_VBASE+SAM_PIOD_OFFSET)

Review Comment:
   I did wonder about that, and happy to take that suggestion on board. Will change it on Monday and re-push, once I've worked through all the Kconfig blunders you've found <embarrassed>



-- 
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] [incubator-nuttx] TimJTi commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
TimJTi commented on code in PR #7614:
URL: https://github.com/apache/incubator-nuttx/pull/7614#discussion_r1027132286


##########
arch/arm/src/sama5/hardware/_sama5d2x_memorymap.h:
##########
@@ -517,9 +520,10 @@
 #define SAM_SFRBU_VBASE          (SAM_PERIPHC_VSECTION+SAM_SFRBU_OFFSET)
 #define SAM_CHIPID_VBASE         (SAM_PERIPHC_VSECTION+SAM_CHIPID_OFFSET)
 
-#define SAM_PIOA_VBASE           (SAM_PERIPHA_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOB_VBASE           (SAM_PERIPHB_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOC_VBASE           (SAM_PERIPHC_VSECTION+SAM_PIO_OFFSET)
+#define SAM_PIOA_VBASE           (SAM_PIO_VBASE)
+#define SAM_PIOB_VBASE           (SAM_PIO_VBASE+SAM_PIOB_OFFSET)
+#define SAM_PIOC_VBASE           (SAM_PIO_VBASE+SAM_PIOC_OFFSET)
+#define SAM_PIOD_VBASE           (SAM_PIO_VBASE+SAM_PIOD_OFFSET)

Review Comment:
   Found GitHub desktop supports this, so hopefully that's done now...



-- 
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] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7614: SAMA5D2 pio errors

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7614:
URL: https://github.com/apache/incubator-nuttx/pull/7614#discussion_r1027106687


##########
arch/arm/src/sama5/hardware/_sama5d2x_memorymap.h:
##########
@@ -517,9 +520,10 @@
 #define SAM_SFRBU_VBASE          (SAM_PERIPHC_VSECTION+SAM_SFRBU_OFFSET)
 #define SAM_CHIPID_VBASE         (SAM_PERIPHC_VSECTION+SAM_CHIPID_OFFSET)
 
-#define SAM_PIOA_VBASE           (SAM_PERIPHA_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOB_VBASE           (SAM_PERIPHB_VSECTION+SAM_PIO_OFFSET)
-#define SAM_PIOC_VBASE           (SAM_PERIPHC_VSECTION+SAM_PIO_OFFSET)
+#define SAM_PIOA_VBASE           (SAM_PIO_VBASE)
+#define SAM_PIOB_VBASE           (SAM_PIO_VBASE+SAM_PIOB_OFFSET)
+#define SAM_PIOC_VBASE           (SAM_PIO_VBASE+SAM_PIOC_OFFSET)
+#define SAM_PIOD_VBASE           (SAM_PIO_VBASE+SAM_PIOD_OFFSET)

Review Comment:
   Also please squash all `Update arch/arm/src/sama5/hardware/sam_adc.h` commits into one



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