Coder Social home page Coder Social logo

Comments (10)

iabdalkader avatar iabdalkader commented on May 29, 2024 1

I tested this the first time with a Giga, which had a newer core. I tested it again with a Portenta, and the Portenta does fail with an older core (4.0.8) but works with the latest (4.1.3).

from arduino_advancedanalog.

iabdalkader avatar iabdalkader commented on May 29, 2024

This might be related to this issue: arduino/ArduinoCore-mbed#867

But how do you know if it works or not ? The M4 can't use serial to print message. The difference between A0..A3 and A4-A7, is that A0-A3 are dual-pad pins. The M4 may have an issue configuring or accessing them.

from arduino_advancedanalog.

mrubioroy avatar mrubioroy commented on May 29, 2024

Please note I use Serial1 for M4, which does work with output on UART1 pins.

When I use A0 or A1, I get the message β€œFailed to start analog acquisition!” on UART1. For A4 to A7, it prints the read values as expected. A2 and A3 don't work either, but that's the expected behavior for ADC1 according to the documentation.

from arduino_advancedanalog.

iabdalkader avatar iabdalkader commented on May 29, 2024

Ah I see. Well, as I've mentioned those pins happen to be dual-pads pins. That's the only difference, and I'm guessing but there might be an issue we've missed with using them from the M4. I'll give this a try next week.

from arduino_advancedanalog.

iabdalkader avatar iabdalkader commented on May 29, 2024

I tested this issue and I just can't reproduce it. I tried A0->A4, all seem to work fine, see the screenshot. Note the serial monitor is connect to a USB to serial port.

image

Sketch:

#include "RPC.h"
#ifdef CORE_CM7
void setup() {
  bootM4();
  Serial.begin(9600);
}
void loop() {
}
#else
#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();
  }
}
#endif

from arduino_advancedanalog.

iabdalkader avatar iabdalkader commented on May 29, 2024

Were you using the latest library or an older release ? You should be using 1.4.0.

from arduino_advancedanalog.

mrubioroy avatar mrubioroy commented on May 29, 2024

I'm using Advanced Analog 1.4.0 and board 4.1.1

I've uploaded your sketch to both cores and I still get the "Failed to start analog acquisition!" message on pin 14. I've even tried changing the #define DUAL_PIN according to commit 992ed2c but I still get the error message.

I'm using a Portenta H7 with no peripherals. Just USB-C for programming and Serial to USB on pin 14 (picture attached).

from arduino_advancedanalog.

facchinm avatar facchinm commented on May 29, 2024

@mrubioroy changing only the source files has no effect since the same setting should be applied to the precompiled library. Can you give a spin to core 4.1.3 (just released) that contains the full patch? Thx

from arduino_advancedanalog.

mrubioroy avatar mrubioroy commented on May 29, 2024

Works now, thank you

If I may, what is a "dual pad" pin?

from arduino_advancedanalog.

iabdalkader avatar iabdalkader commented on May 29, 2024

If I may, what is a "dual pad" pin?

Special pins that connect to two pads, or used separately as a GPIO pad and an ADC input.

from arduino_advancedanalog.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.