Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

STM32F10x - FreeRTOS - ADC - ISR

Status
Not open for further replies.

valeriogiampa

Member level 3
Joined
Jul 3, 2008
Messages
58
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,288
Location
ITALY
Activity points
1,897
Dear Collegue,
I have to use an ADC integrated into the STM32F10x microcontroller.
The firmware application is based of STM32 Peripheral Library and FreeRTOS Porting for STM32 Arm Cortex M3 RTOS.
I have to configure the ADC to operate in single channel continuous conversion mode.
i would select the ouuput data of the ADC with the ADC Interrupt service routine.
I don't know How I can configure the ADC Interrupt and How I can generate an OS Signal in the ADC ISR to start the task.
Can yu help me?
In addition I would like to know if I can use in alternative at the ADC ISR, a DMA to transfer the ADC Output data into the memory without CPU load and How I can do it.
 

yuvko

Member level 4
Joined
Sep 5, 2007
Messages
74
Helped
19
Reputation
38
Reaction score
17
Trophy points
1,288
Activity points
1,596
ADC configuration - get ST STD library from:
ST Microelectronics | Resource Selector

they have there plenty of example codes for various ADC configurations and it's interrupt. basicly using their libraries, your ADC init code will look somewhat like this:

ADC_InitStructure.ADC_Mode = ADC_Mode_Independent; // no dual mode
ADC_InitStructure.ADC_ScanConvMode = DISABLE;
ADC_InitStructure.ADC_ContinuousConvMode = ENABLE;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfChannel = 1;
ADC_Init(ADC1, &ADC_InitStructure);


to generate an OS signal use xSemaphoreGiveFromISR(), xQueueSendFromISR() ,
xQueueSendToBackFromISR() or xQueueSendToFrontFromISR().
look at FreeRTOS-A Free professional grade RTOS supporting 27 architectures, including ARM7, ARM9, Cortex-M3, RX600, MSP430, MSP430X, MicroBlaze, AVR, x86, PIC32, PIC24, dsPIC, H8S, HCS12 and 8051 api reference.

Yes you can use DMA with the ADC, again look at ST STD peripheral libraries for example.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top