Configuring ADC on Nucleo-F401RE in Arduino IDE gives erratic values for input freq greater than 100Hz
I want to configure ADC on STM32(Nucleo-F401RE) using Arduino IDE and transmit the values through SPI to Basys 3 FPGA(End Goal). The ADC works for input signal frequency only below 100Hz. How do I increase the throughput rate? My project requires conversion of input analog signal between 500KHz to 900Khz.
Attached is the plot for input freq 1KHz,1.2V,Sine wave from Arduino Serial Plotter
#include <f401reMap.h>
float analogPin = pinMap(31); //PA0
float val = 0; // variable to store the value read
void setup() {
Serial.begin(115200); // setup serial
analogReadResolution(12);
}
void loop() {
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
}In the past,I have used Keil and STMCubeMX. It did not sample the input signal below 100Hz which was achievable using Arduino IDE. I have tried increasing the sampling cycles, the issue persists. Configured ADC without DMA with HAL_ADC_Start function and transferred the values to PC through UART,still unable to retrieve the original signal. I'm unable to isolate where the problem lies. What am I missing?