- 
                Notifications
    
You must be signed in to change notification settings  - Fork 4
 
Closed
Labels
conclusion: resolvedIssue was resolvedIssue was resolvedtype: imperfectionPerceived defect in any part of projectPerceived defect in any part of project
Description
When I run Arduino_AdvancedAnalog/examples/Advanced/ADC_Multi_Channel/ADC_Multi_Channel.ino in the M4 co-processor of my Portenta H7, it only works for channels A4 to A7. According to the documentation ADC1 should also work with A0 and A1. Why are A0 and A1 not working? They do work in the main M7 core.
I have used these codes:
M7:
void setup() {
  bootM4();
  Serial.begin(9600);
}
void loop() {
  Serial.println("M7");
  digitalWrite(LEDG, LOW);
  delay(100);
  digitalWrite(LEDG, HIGH);
  delay(2000);
}
M4:
#include <Arduino_AdvancedAnalog.h>
AdvancedADC adc(A0); // not working with A0 or A1. It does work with A4 to A7
uint64_t last_millis = 0;
void setup() {
  Serial1.begin(9600);
  // Resolution, sample rate, number of samples per channel, queue depth.
  if (!adc.begin(AN_RESOLUTION_16, 16000, 32, 128)) {
      Serial1.println("Failed to start analog acquisition!");
      while (1);
  }
}
void loop() {
  if (adc.available()) {
      SampleBuffer buf = adc.read();
      // Process the buffer.
      if ((millis() - last_millis) > 20) {
        Serial1.println(buf[0]);   // Sample from first channel
        Serial1.println(buf[1]);   // Sample from second channel
        last_millis = millis();
      }
      // Release the buffer to return it to the pool.
      buf.release();
  }
}
Metadata
Metadata
Assignees
Labels
conclusion: resolvedIssue was resolvedIssue was resolvedtype: imperfectionPerceived defect in any part of projectPerceived defect in any part of project