Bonjour,
après avoir utilisé des ARDUINO MICRO et NANO, j'ai acheté un NANO 33 BLE pour un projet de traitement de signal sonore.
J'ai réalisé un petit programme ci-dessous pour tester la rapidité de l'acquisition analogique à partir d'un simple potentiomètre. Je visualise le déroulement correct à l'oscilloscope sur la sortie 12.
#include <ArduinoBLE.h>
#include "nrf.h"
#include "mbed.h"
int sensorPin ;
int ledPin = 12; // select the pin for the LED
int valueADC = 0; // variable to store the value coming from the sensor
int minValueADC = 1024;
int maxValueADC = 0;
bool toggle = LOW;
//NRF_WDT->TASKS_START = 1;
//NRF_POWER->SYSTEMOFF = 1;
//NRF_SAADC->SAMPLERATE_MODE=1;
//NRF_SAADC->RESOLUTION=2;
void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
// Serial.begin (115200); //debug
}
void loop() {
// read the value from the sensor:
valueADC = analogRead(0);
/* debug
if (valueADC > maxValueADC) maxValueADC = valueADC;
else
{
if (valueADC < minValueADC) minValueADC = valueADC;
}
Serial.print(valueADC);
Serial.print(" ");
Serial.print(minValueADC);
Serial.print(" ");
Serial.print(maxValueADC);
Serial.print(" ");
Serial.println(maxValueADC-minValueADC);
debug*/
// toggle output pin à chaque itération
if (toggle==LOW)
{toggle=HIGH;
}
else
{toggle=LOW;
}
digitalWrite(ledPin, toggle);
}
Il fonctionne correctement, cependant je voudrais le faire tourner plus vite.
Pour cela j'ai tenté d'utiliser les instructions du MCU NRF (exemples en commentaires dans le code).
Dès que j’ôte les slash de l'une de ces lignes (ici NRF_SAADC->SAMPLERATE_MODE=1;), la compilation s'arrête sur l'erreur suivante.
In file included from C:\Users\jeanp\AppData\Local\Arduino15\packages\arduino\hardware\mbed\1.3.1\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/modules/nrfx/mdk/nrf.h:79:0,
from C:\Users\jeanp\AppData\Local\Arduino15\packages\arduino\hardware\mbed\1.3.1\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/cmsis.h:21,
from C:\Users\jeanp\AppData\Local\Arduino15\packages\arduino\hardware\mbed\1.3.1\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/TARGET_ARDUINO_NANO33BLE/PinNames.h:20,
from C:\Users\jeanp\AppData\Local\Arduino15\packages\arduino\hardware\mbed\1.3.1\variants\ARDUINO_NANO33BLE/pinmode_arduino.h:17,
from C:\Users\jeanp\AppData\Local\Arduino15\packages\arduino\hardware\mbed\1.3.1\cores\arduino/Arduino.h:29,
from sketch\AnalogInputEssaiRapidite.ino.cpp:1:
C:\Users\jeanp\AppData\Local\Arduino15\packages\arduino\hardware\mbed\1.3.1\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/modules/nrfx/mdk/nrf52840.h:2423:67: error: expected ')' before '*' token
#define NRF_SAADC ((NRF_SAADC_Type *) NRF_SAADC_BASE)
^
D:\Documents\Bricolage\Arduino\AnalogInputEssaiRapidite\AnalogInputEssaiRapidite.ino:43:1: note: in expansion of macro 'NRF_SAADC'
NRF_SAADC->SAMPLERATE_MODE=1;
^
C:\Users\jeanp\AppData\Local\Arduino15\packages\arduino\hardware\mbed\1.3.1\cores\arduino/mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/modules/nrfx/mdk/nrf52840.h:2423:67: error: expected ')' before '*' token
#define NRF_SAADC ((NRF_SAADC_Type *) NRF_SAADC_BASE)
^
D:\Documents\Bricolage\Arduino\AnalogInputEssaiRapidite\AnalogInputEssaiRapidite.ino:43:1: note: in expansion of macro 'NRF_SAADC'
NRF_SAADC->SAMPLERATE_MODE=1;
^
exit status 1
Erreur de compilation pour la carte Arduino Nano 33 BLE
Merci de m'indiquer l'origine de l'erreur.
Cordialement
Jean