STM32F103C6T6A Board
STM32F103C6T6A Board
The STM32F103C6T6A Board is a microcontroller board based on the STM32F103C6T6A microcontroller unit (MCU) from STMicroelectronics. It is a popular choice for various applications, including IoT projects, robotics, and embedded systems.
| Microcontroller Unit (MCU) |
The STM32F103C6T6A MCU is a 32-bit ARM Cortex-M3 core-based microcontroller. It operates at a frequency of up to 72 MHz and features a flash memory of 32 KB, a RAM of 10 KB, and a ROM of 8 KB.
| ### Performance |
32-bit ARM Cortex-M3 core
up to 72 MHz
32 KB
10 KB
8 KB
| ### Digital Peripherals |
15 timers (including 2 advanced-control timers, 1 general-purpose timer, and 1 basic timer)
2 watchdog timers
2 Inter-Integrated Circuit (I2C) interfaces
3 Universal Synchronous/Asynchronous Receiver-Transmitter (USART) interfaces
2 Universal Asynchronous Receiver-Transmitter (UART) interfaces
1 Serial Peripheral Interface (SPI) interface
1 Controller Area Network (CAN) interface
1 USB interface (Full-speed, 12 Mbps)
| ### Analog Peripherals |
12-bit Analog-to-Digital Converter (ADC) with 16 channels
2 12-bit Digital-to-Analog Converters (DAC)
| ### Others |
2.0 V to 3.6 V
-40C to 105C
Support for JTAG and SWD debugging interfaces
| ### Board Features |
Onboard crystal oscillator (8 MHz)
Power LED indicator
Reset button
USB connector for programming and communication
Breadboard-friendly headers for easy connection to peripheral modules
| ### Software Support |
Compatible with ARM Keil Vision, IAR Embedded Workbench, and GCC-based IDEs
Supports mBed, Zephyr, and other popular IoT development platforms
| The STM32F103C6T6A Board is suitable for a wide range of applications, including |
IoT devices and gateways
Robotics and automation systems
Industrial control and monitoring systems
Medical devices and wearables
Consumer electronics and appliances
The STM32F103C6T6A Board is a powerful and feature-rich microcontroller board, ideal for developing complex IoT projects and embedded systems. Its low power consumption, high performance, and extensive peripheral set make it a popular choice among developers and engineers.
STM32F103C6T6A Board DocumentationOverviewThe STM32F103C6T6A is a microcontroller board based on the STM32F103C6T6 microprocessor from STMicroelectronics. It is a 32-bit ARM Cortex-M3 processor with 32KB of flash memory and 10KB of SRAM. The board is widely used in various IoT projects due to its low cost, high performance, and ease of use.Features32-bit ARM Cortex-M3 processor
32KB of flash memory
10KB of SRAM
12-bit ADC with 16 channels
2 x 12-bit DAC
3 x USART
2 x SPI
2 x I2C
1 x CAN
1 x USB
37 GPIO pinsHardware RequirementsSTM32F103C6T6A board
USB cable
Breadboard and jumper wires (for connecting external components)Software RequirementsKeil Vision IDE (or alternative development environment)
STM32F1 HAL libraryExample 1: Blinking LED using GPIOIn this example, we will use the STM32F103C6T6A board to blink an LED connected to pin PA5.Code
```c
#include "stm32f1xx_hal.h"#define LED_PIN GPIO_PIN_5
#define LED_GPIO_PORT GPIOAint main(void)
{
HAL_Init();// Initialize LED pin as output
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = LED_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LED_GPIO_PORT, &GPIO_InitStruct);while (1)
{
// Set LED pin high
HAL_GPIO_WritePin(LED_GPIO_PORT, LED_PIN, GPIO_PIN_SET);// Delay for 500ms
HAL_Delay(500);// Set LED pin low
HAL_GPIO_WritePin(LED_GPIO_PORT, LED_PIN, GPIO_PIN_RESET);// Delay for 500ms
HAL_Delay(500);
}
}
```
Example 2: Communicating with an LCD Display using SPIIn this example, we will use the STM32F103C6T6A board to communicate with an LCD display using the SPI protocol.Code
```c
#include "stm32f1xx_hal.h"
#include "spi.h"#define LCD_CS_PIN GPIO_PIN_4
#define LCD_RST_PIN GPIO_PIN_3
#define LCD_SPI_PORT SPI1SPI_HandleTypeDef hspi1;int main(void)
{
HAL_Init();// Initialize SPI peripheral
hspi1.Instance = LCD_SPI_PORT;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLK_Polarity = SPI_POLARITY_LOW;
hspi1.Init.CLK_Phase = SPI_PHASE_1EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
if (HAL_SPI_Init(&hspi1) != HAL_OK)
{
Error_Handler();
}// Initialize LCD pins
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = LCD_CS_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);GPIO_InitStruct.Pin = LCD_RST_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);// Send data to LCD display
uint8_t data[] = {0x01, 0x02, 0x03, 0x04};
HAL_SPI_Transmit(&hspi1, data, 4, 100);while (1)
{
// Send data to LCD display periodically
HAL_SPI_Transmit(&hspi1, data, 4, 100);
HAL_Delay(1000);
}
}
```
Example 3: Reading Data from an ADC using DMAIn this example, we will use the STM32F103C6T6A board to read data from an ADC using the DMA (Direct Memory Access) peripheral.Code
```c
#include "stm32f1xx_hal.h"
#include "dma.h"#define ADC_PIN GPIO_PIN_0
#define ADC_CHANNEL ADC_Channel_0
#define DMA_STREAM DMA1_Stream0DMA_HandleTypeDef hdma_adc;int main(void)
{
HAL_Init();// Initialize ADC peripheral
ADC_HandleTypeDef hadc;
hadc.Instance = ADC1;
hadc.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2;
hadc.Init.Resolution = ADC_RESOLUTION_12BIT;
hadc.Init.ScanConvMode = ENABLE;
hadc.Init.EOC_Selection = ADC_EOC_SEQ_CONV;
hadc.Init.ContinuousConvMode = ENABLE;
hadc.Init.NbrOfConversion = 1;
hadc.Init.DiscontinuousConvMode = DISABLE;
hadc.Init.NbrOfDiscConversion = 0;
if (HAL_ADC_Init(&hadc) != HAL_OK)
{
Error_Handler();
}// Initialize DMA channel
hdma_adc.Instance = DMA_STREAM;
hdma_adc.Init.Request = DMA_REQUEST_ADC1;
hdma_adc.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_adc.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_adc.Init.MemInc = DMA_MINC_ENABLE;
hdma_adc.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
hdma_adc.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
hdma_adc.Init.Mode = DMA_CIRCULAR;
hdma_adc.Init.NbData = 1;
if (HAL_DMA_Init(&hdma_adc) != HAL_OK)
{
Error_Handler();
}// Start ADC conversion and DMA transfer
HAL_ADC_Start_DMA(&hadc, (uint32_t)adc_data, 1);while (1)
{
// Process ADC data
// ...
}
}
```
Note: These examples are for illustration purposes only and may require modifications to work with your specific hardware setup. Additionally, error handling and other necessary functions should be added to ensure reliable operation.