STM32 ADC is pretty complex peripheral. It is designed to be flexible enough to accomplish complex tasks. We are going to dedicate few posts where we will try to cover main features and give working examples of code. The block schematic may look scary at first time but if you look closer it can be split in to several pieces that are responsible for different functions. Will will go through them step by step to make it look more clear.
When we need some feedback from microcontroller usually we use USART. It allows to output messages, debug information to terminal screen. Also data can be sent to MCU same way. For this purpose STM32 microcontrollers have more than one USART interface allowing to have multiple streams of data output and input. USART interface is designed to be very versatile allowing to have lots of modes including LIN, IrDA, Smart card emulation, DMA based transmissions. But for now lets focus on standard USART communications we we could send and receive messages from terminal window.
Probably one of the key features in any microcontroller is interrupt system. ARM Cortex-M3 microcontrollers may have up to 256 interrupts sources. First 15 interrupt sources are called system exceptions. These exceptions rise within Cortex core like reset, NMI, hard fault and error, debug and SystTick timer interrupt. In the exception table they start from address 0x00000004 and are numbered from 1 to 15. There is no 0 number exception (FYI – the very top of exception table address is used to store starting point of stack pointer): Each exception vector holds four byte wide address of service routine that is called when exception occurs. Exception table usually is located in startup code like this: