Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

Introducing to STM32 ADC programming. Part1

STM32 ADC is pretty complex peripheral. It is designed to be flexible enough to accomplish complex tasks. We are going to dedicate a few posts where we will try to cover the main features and give working examples of code. The block schematic may look scary at the first time, but if you look closer, it can be split into several pieces that are responsible for different functions. Will will go through them step by step to make it look brighter. Continue reading

Programming STM32 USART using GCC tools. Part 1

When we need some feedback from the microcontroller, usually we use USART. It allows to output messages, debug information to the 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, let’s focus on standard USART communications we could send and receive messages from the terminal window. Continue reading

STM32 interrupts and programming with GCC

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 the starting point of stack pointer): Each exception vector holds the four-byte address of service routine that is called when an exception occurs. Exception table usually is located in startup code like this: Continue reading