My setup:
- Windows 7,
- Arduino IDE 1.8.12,
- Hardware: STM32F103C8T6 Blue Pill board,
- Upload Method: STM32duino bootloader (USB)
- Installed Boards: STM32F1xx/GD32F1xx boards, version 2020.6.7,
- Installed Boards: Arduino SAMD Boards (32-bits Cortex-M0+), for essential arm compiler tools,
- Selected Board: Generic STM32F103C series, Variant: STM32F103CB (20k RAM 128k Flash)
The STM32ADC example program 'SingleChannelAtSampleRateCircularBuffer.ino' has served as a model for my ADC-DMA application. The sample program has not been updated (yet) for the STM32F1 board version 2020.6.12. The important code example code, included in the Arduino sketch setup() function, is:
Code: Select all
...
Timer3.setPeriod(samplePeriodus);
Timer3.setMasterModeTrGo(TIMER_CR2_MMS_UPDATE);
myADC.calibrate();
myADC.setSampleRate(ADC_SMPR_1_5); // ?
myADC.setPins(&pins, 1);
==> myADC.setDMA(buffer, maxSamples, (DMA_MINC_MODE | DMA_CIRC_MODE | DMA_HALF_TRNS | DMA_TRNS_CMPLT), DmaIRQ);
myADC.setTrigger(ADC_EXT_EV_TIM3_TRGO);
myADC.startConversion();
...
Code: Select all
/* This function is used to setup DMA with the ADC.
It will be independent of the mode used. It will either be used in continuous or scan mode
or even both... go figure.
The reason why this is a uint16 is that I am not ready for dual mode.
*/
==> void setDMA(uint16 * Buf, uint16 BufLen, uint32 dmaFlags, voidFuncPtr func);
Code: Select all
/* This function is used to setup DMA with the ADC.
It will be independent of the mode used. It will either be used in continuous or scan mode
or even both... go figure.
The reason why this is a uint16 is that I am not ready for dual mode.
*/
==> void setDMA(uint16 * Buf, uint32 dmaFlags, voidFuncPtr func);
==> void startDMA(uint16 BufLen);
I appreciate your time to consider my questions and hope I can receive some advice here.
Steve