STM32F4 Labs. T.O.M.A.S Technically Oriented Microcontroller Application Services V1.07

Size: px
Start display at page:

Download "STM32F4 Labs. T.O.M.A.S Technically Oriented Microcontroller Application Services V1.07"

Transcription

1 STM32F4 Labs T.O.M.A.S Technically Oriented Microcontroller Application Services V1.07

2 CONTENT 1/ GPIO lab 2. EXTI lab 3. SLEEP lab 4. STOP lab 5. STANDBY lab 6. DMA Poll lab 7. DMA Interrupt lab 8. RTC Alarm lab 9. UART Poll lab 10. UART Interrupt lab 11. UART DMA lab STM32F42xx Technical Training 15/06/2015

3 CONTENT 2/ SPI Poll lab 13. SPI Interrupt lab 14. SPI DMA lab 15. TIM Interrupt lab 16. TIM PWM out lab 17. TIM DMA lab 18. TIM Counter lab 19. DAC wave generation lab 20. ADC Poll lab 21. ADC Interrupt lab 22. ADC DMA lab STM32F42xx Technical Training 15/06/2015

4 CONTENT 3/ WWDG lab 24. IWDG lab 25. FMC SDRAM BSP lab 26. LCD BSP Print text lab 27. I2C BSP EEPROM lab 28. SPI BSP GYROSCOPE lab STM32F42xx Technical Training 15/06/2015

5 GPIO Lab 1 STM32F42xx Technical Training 15/06/2015

6 1 Configure GPIO for LED toggling 6 Objective Learn how to setup pin and GPIO port in CubeMX How to Generate Code in CubeMX and use HAL functions Goal Configure GPIO pin in CubeMX and Generate Code Add in to project HAL_Delay function and HAL_GPIO_Toggle function Verify the correct functionality on toggling LED

7 1 Configure GPIO for LED toggling 7 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx Configure LED pin as GPIO_Output

8 1 Configure GPIO for LED toggling 8 For debug purpose is recommended to select debug pins SWD or JTAG Select can be done in TAB>Pinout>SYS On discovery is available only SWD option If SWD/JTAG is not selected and the Set all free pins as analog (MENU>Project>Settings>TAB>Code Generator) is selected, debug is not possible

9 1 Configure GPIO for LED toggling 9 Clock Configuration TAB>Clock Configuration We can easily setup STM32 clocks

10 1 Configure GPIO for LED toggling 10 The Clock configuration tree is interactive version of tree from RM RM0090 Chapter 6 Reset and clock control Page 151

11 1 Configure GPIO for LED toggling 11 Clock Configuration overview 1 Clock sources Internal oscillators Internal oscillators

12 1 Configure GPIO for LED toggling 12 Clock Configuration overview 3 Clock sources Internal oscillators External clock sources External clock sources

13 1 Configure GPIO for LED toggling 13 Clock Configuration overview 4 Clock sources Internal oscillators LSI External clock sources 1. Low speed internal oscillator

14 1 Configure GPIO for LED toggling 14 Clock Configuration overview 5 Clock sources Internal oscillators LSI HSI External clock sources 1. Low speed internal oscillator 2. High speed internal oscillator

15 1 Configure GPIO for LED toggling 15 Clock Configuration overview 6 Clock sources Internal oscillators LSI HSI External clock sources LSE 3. Low speed external clocks 1. Low speed internal oscillator 2. High speed internal oscillator External 32,768Hz crystal or external signal in bypass mode

16 1 Configure GPIO for LED toggling 16 Clock Configuration overview 7 Clock sources Internal oscillators LSI HSI External clock sources LSE crystal or external signal in bypass mode HSE 3. Low speed external clocks 1. Low speed internal oscillator 2. High speed internal oscillator External crystal 4-26MHz or external signal 1-50Mhz in bypass mode 4. High speed external clocks

17 1 Configure GPIO for LED toggling 17 Clock Configuration overview 8 Clock sources Internal oscillators LSI HSI External clock sources LSE crystal or external signal in bypass mode HSE crystal 4-26MHz or external signal 1-50MHz in bypass mode 3. Low speed external clocks 1. Low speed internal oscillator 2. High speed internal oscillator Disabled clocks How to enable? 4. High speed external clocks

18 1 Configure GPIO for LED toggling 18 Clock Configuration overview 9 Clock sources Internal oscillators LSI HSI External clock sources LSE crystal or external signal in bypass mode HSE crystal 4-26MHz or external signal 1-50MHz in bypass mode 3. Low speed external clocks 1. Low speed internal oscillator 2. High speed internal oscillator Disabled clocks How to enable? 4. High speed external clocks

19 1 Configure GPIO for LED toggling 19 Clock Configuration overview 10 External clock enabling TAB>Pinout Select HSE and LSE clocks Bypass or crystal 1. Set HSE crystal 2. CubeMX reserve pins

20 1 Configure GPIO for LED toggling 20 Clock Configuration overview 11 The HSE is now available TAB>Clock configuration Click on Blue square and change frequency on 8MHz

21 1 Configure GPIO for LED toggling 21 Clock Configuration overview 12 Clock tree for core description System multiplexer PLL PLL source multiplexer Frequency of Core, AHB bridge, and memories Multiplexer select clock source for system Clock source for PLL PLL multiplies frequency

22 1 Configure GPIO for LED toggling 22 Clock Configuration overview 13 Core clocked from HSI, default option after reset HSI crystal HSI as system source System frequency 16MHz AHB prescaler divide by 1 Core frequency is now 16MHz

23 1 Configure GPIO for LED toggling 23 Clock Configuration overview 14 Core clocked from HSE HSE crystal or external signal HSE as system source System frequency 8MHz AHB prescaler divide by 1 Core frequency is now 8MHz

24 1 Configure GPIO for LED toggling 24 Clock Configuration overview 15 Core clocked from PLL and HSI HSI crystal PLL as system source System frequency 180MHz PLL clock source HSI AHB prescaler divide by 1 PLL in M divider by 16 PLL multiplier N by 360 PLL out P divider by 2 Core frequency is now 180MHz

25 1 Configure GPIO for LED toggling 25 Clock Configuration overview 16 Core clocked from PLL and HSE HSE crystal or external signal PLL as system source PLL clock source HSE System frequency 180MHz AHB prescaler divide by 1 PLL in M divider by 8 PLL multiplier N by 360 PLL out P divider by 2 Core frequency is now 180MHz

26 1 Configure GPIO for LED toggling 26 Clock Configuration overview 17 AHB, APB prescalers and peripheral speed Core, AHB, memory DMA clock Core clocks

27 1 Configure GPIO for LED toggling 27 Clock Configuration overview 18 AHB, APB prescalers and peripheral speed Systick divider Systick clock Core clocks

28 1 Configure GPIO for LED toggling 28 Clock Configuration overview 19 APB prescalers and peripheral speed External memory controller clock Core clocks

29 1 Configure GPIO for LED toggling 29 Clock Configuration overview 20 AHB, APB prescalers and peripheral speed APB1 prescaler APB1 peripherals clock Core clocks APB1 timers multiplier APB1 timers clock

30 1 Configure GPIO for LED toggling 30 Clock Configuration overview 21 AHB, APB prescalers and peripheral speed APB2 prescaler APB2 peripherals clock Core clocks APB2 timers multiplier APB2 timers clock

31 1 Configure GPIO for LED toggling 31 Clock Configuration overview 22 Data sheet Figure 4 AHB, Core, memory clock APB1 bus clock APB2 bus clock

32 1 Configure GPIO for LED toggling 32 Clock Configuration overview 23 AHB, Core, memory clock APB1 bus clock APB2 bus clock

33 1 Configure GPIO for LED toggling 33 Clock Configuration overview 23 Core clock External memory clock DMA clock AHB clock APB2 bus clock APB1 bus clock

34 1 Configure GPIO for LED toggling 34 Clock Configuration overview 24 Enable clocks which are gray How to enable gray features? MCO output? RTC and IWDG clock tree? USB FS tree?

35 1 Configure GPIO for LED toggling 35 Clock Configuration overview 25 MCO1 output TAB>Pinout RCC>MCO1 checkbox TAB>Clock Configuration Now the MCO1 output can be set 1. Disabled MCO 2. MCO1 enable 4. Set MCO1 3. CubeMX assign pin

36 1 Configure GPIO for LED toggling 36 Clock Configuration overview 26 RTC TAB>Pinout RCC>RTC set RTC feature TAB>Clock Configuration Now the RTC can be set 1. RTC disabled 2. RTC set 3. Set RTC

37 1 Configure GPIO for LED toggling 37 Clock Configuration overview 26 USB TAB>Pinout RCC>USB_OTG_FS set feature TAB>Clock Configuration Now the USB clock can be set 1. USB disabled 2. USB enable 3. CubeMX assign pins 4. USB clock can be set now

38 1 Configure GPIO for LED toggling 38 GPIO Configuration TAB>Configuration>System>GPIO

39 1 Configure GPIO for LED toggling 39 GPIO(Pin) Configuration Select Push Pull mode No pull-up and pull-down Output speed to HIGH Is important for faster peripheries like SPI, USART Button OK

40 1 Configure GPIO for LED toggling 40 GPIO(Pin) output speed configuration Change the rising and falling edge when pin change state from high to low or low to high Higher GPIO speed increase EMI noise from STM32 and increase STM32 consumption It is good to adapt GPIO speed with periphery speed. Ex.: Toggling GPIO on 1Hz is LOW optimal settings, but SPI on 45MHz the HIGH must be set GPIO output LOW speed GPIO output MEDIUM speed LOW LOW HIGH HIGH GPIO output FAST speed GPIO output HIGH speed LOW LOW HIGH HIGH

41 1 Configure GPIO for LED toggling 41 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

42 1 Configure GPIO for LED toggling 42 Now we open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */ tags Into infinite loop while(1){ } For toggling we need to use this functions HAL_HAL_Delay which create specific delay HAL_GPIO_WritePin or HAL_GPIO_TogglePin

43 EXTI lab 2 STM32F42xx Technical Training 15/06/2015

44 2 Configure EXTI which turns on LED 45 Objective Learn how to setup input pin with EXTI in CubeMX How to Generate Code in CubeMX and use HAL functions Goal Configure GPIO and EXTI pin in CubeMX and Generate Code Add into project Callback function and function which turn on led Verify the correct functionality by pressing button which turns on LED

45 2 Configure EXTI which turns on LED 46 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx Configure LED pin as GPIO_Output Configure Button pin as GPIO_EXTIX

46 2 Configure EXTI which turns on LED 47 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx Configure LED pin as GPIO_Output Configure Button pin as GPIO_EXTIX

47 2 Configure EXTI which turns on LED 48 In order to run on maximum frequency, setup clock system Details in lab 0

48 2 Configure EXTI which turns on LED 49 GPIO Configuration TAB>Configuration>System>GPIO

49 2 Configure EXTI which turns on LED 50 GPIO(Pin) Configuration Select External Interrupt Mode with Rising edge trigger detection No pull-up or pull-down PG14 can be let in default settings Button OK

50 2 Configure EXTI which turns on LED 51 NVIC Configuration We need to enable interrupts for EXTI TAB>Configuration>System>NVIC

51 2 Configure EXTI which turns on LED 52 NVIC Configuration Enable interrupt for EXTI Line0 Button OK

52 2 Configure EXTI which turns on LED 53 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

53 2 Configure EXTI which turns on LED 54 HAL Library work flow 1 Peripheral Initializations including peripheral interrupt NVIC initializations Generated by CubeMX Configure the GPIO to generate interrupt on rising or falling edge HAL_EXTI0_IRQHandler EXTI0_IRQHandler Edge detection callback HAL_GPIO_EXTI_Callback

54 2 Configure EXTI which turns on LED 55 HAL Library work flow 2 Peripheral Initializations including peripheral interrupt NVIC initializations Configure the GPIO to generate interrupt on rising or falling edge MX_GPIO_Init inside main.c HAL_EXTI0_IRQHandler EXTI0_IRQHandler Edge detection callback HAL_GPIO_EXTI_Callback

55 2 Configure EXTI which turns on LED 56 HAL Library working flow 3 Peripheral Initializations including peripheral interrupt NVIC initializations inside stm32f4xx_it.c Configure the GPIO to generate interrupt on rising or falling edge HAL_EXTI0_IRQHandler EXTI0_IRQHandler Edge detection callback HAL_GPIO_EXTI_Callback

56 2 Configure EXTI which turns on LED 57 HAL Library work flow 4 Peripheral Initializations including peripheral interrupt NVIC initializations Configure the GPIO to generate interrupt on rising or falling edge HAL_EXTI0_IRQHandler EXTI0_IRQHandler Edge detection callback HAL_GPIO_EXTI_Callback User must define Callback it is declared by default as empty weak

57 2 Configure EXTI which turns on LED 58 HAL Library work flow 5 Peripheral Initializations including peripheral interrupt NVIC initializations Configure the GPIO to generate interrupt on rising or falling edge HAL_EXTI0_IRQHandler EXTI0_IRQHandler Edge detection callback HAL_GPIO_EXTI_Callback Usually in main.c between /* USER CODE BEGIN */ tags

58 2 Configure EXTI which turns on LED 59 HAL Library work flow summary Peripheral Initializations including peripheral interrupt NVIC initializations Configure the GPIO to generate interrupt on rising or falling edge 1. init NVIC 2. init GPIO 5. HAL EXTI interrupt handler 3. create edge 4. EXTI interrupt handler HAL_EXTI0_IRQHandler EXTI0_IRQHandler Edge detection callback HAL_GPIO_EXTI_Callback 6. HAL EXTI callback HAL files clearing flags, check errors,

59 2 Configure EXTI which turns on LED 60 Now we open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 4 */ and /* USER CODE END 4 */ tags We create function which will handle the EXTI interrupts The HAL callback function for EXTI void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) For LED turn on we need to use this functions HAL_GPIO_WritePin

60 2 Configure EXTI which turns on LED 61 Now we open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 4 */ and /* USER CODE END 4 */ tags We create function which will handle the EXTI interrupts The HAL callback function for EXTI void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) For LED turn on we need to use this functions HAL_GPIO_WritePin /* USER CODE BEGIN 4 */ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { if(gpio_pin == GPIO_PIN_0) { HAL_GPIO_WritePin(GPIOG, GPIO_PIN_14, GPIO_PIN_SET); } else { NOP(); } } /* USER CODE END 4 */

61 Low Power mode SLEEP lab 3 STM32F42xx Technical Training 15/06/2015

62 3 Use SLEEP mode with EXTI 63 Objective We use the EXTI setup from lab 1 Learn how to setup SLEEP in HAL Create simple project with SLEEP mode with wake up on pin press Goal Use project from EXTI lab Learn how to setup the SLEEP in HAL, and which events can wake up MCU Verify the correct functionality by measuring consumption

63 SLEEP Mode GPIO s RTC/backup reg. Core CM4 FLASH RAM Core is stopped Peripherals are running IWDG DMA GP timers Clock HSI SPI USB DAC HSE LSI LSE USART I2C ADC Reset Power regulator

64 3 Use SLEEP mode with EXTI 65 HAL Library work flow summary Peripheral Initializations including peripheral interrupt NVIC initializations Configure the GPIO to generate interrupt on rising or falling edge Enter into SLEEP mode(wfi) 1. init NVIC 2. init GPIO 3. Use WFI HAL_EXTI0_IRQHandler 6. HAL EXTI interrupt handler 4. create edge 5. EXTI interrupt handler EXTI0_IRQHandler Edge detection callback HAL_GPIO_EXTI_Callback 7. HAL EXTI callback HAL files clearing flags, check errors,

65 3 Use SLEEP mode with EXTI 66 Now we open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */ tags Function to enter SLEEP HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry) We can measure consumption To be able to reprogram the STM32 which is in LP mode, use connection during reset option

66 3 Use SLEEP mode with EXTI 67 Now we open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */ tags Function to enter SLEEP HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry) We can measure consumption /* USER CODE BEGIN 3 */ /* Infinite loop */ while (1) { HAL_Delay(1000); HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON,PWR_SLEEPENTRY_WFI); } /* USER CODE END 3 */

67 3 Use SLEEP mode with EXTI 68 Consumption still to high? Is STM32 really in SLEEP? Is the Systick disabled? /* USER CODE BEGIN 3 */ /* Infinite loop */ while (1) { HAL_Delay(1000); HAL_SuspendTick(); HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON,PWR_SLEEPENTRY_WFI); HAL_ResumeTick(); } /* USER CODE END 3 */ Is this better?

68 Low Power mode STOP lab 4 STM32F42xx Technical Training 15/06/2015

69 4 Use STOP mode with EXTI 70 Objective We use the EXTI setup from lab 1 Learn how to setup STOP in HAL Create simple project with STOP mode with wake up on pin press Goal Use project from EXTI lab Learn how to setup the STOP in HAL, which events can wake up you Verify the correct functionality by measuring consumption

70 STOP Mode Core is stopped GPIO s RTC/backup reg. IWDG Core CM4 DMA FLASH RAM HSE, MSI clocks are OFF SRAM and registers content is preserved GP timers SPI USB DAC Clock HSE HSI LSI LSE USART I2C Peripherals with HSI, LSI, LSE clock option can be ON GPIO s keep their setup ADC Reset Power regulator

71 4 Use STOP mode with EXTI 72 HAL Library work flow summary Peripheral Initializations including peripheral interrupt NVIC initializations Configure the GPIO to generate interrupt on rising or falling edge Enter into STOP mode(wfi) 1. init NVIC 2. init GPIO 3. Use WFI HAL_EXTI0_IRQHandler 4. create edge 5. EXTI interrupt handler EXTI0_IRQHandler Clock reconfigure 8. Reconfigure clock after wakeup 6. HAL EXTI interrupt handler Edge detection callback HAL_GPIO_EXTI_Callback 7. HAL EXTI callback HAL files clearing flags, check errors,

72 4 Use STOP mode with EXTI 73 Now we open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */ tags Function to enter SLEEP HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry) HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry) We can measure consumption To be able to reprogram the STM32 which is in LP mode, use connection during reset option

73 4 Use STOP mode with EXTI 74 Now we open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */ tags Function to enter SLEEP HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry) HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry) We can measure consumption /* USER CODE BEGIN 3 */ /* Infinite loop */ while (1) { HAL_Delay(1000); HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON,PWR_STOPENTRY_WFI); SystemClock_Config(); } /* USER CODE END 3 */

74 4 Use STOP mode with EXTI 75 Or different function (for STM32F42X/43X) /* USER CODE BEGIN 3 */ /* Infinite loop */ while (1) { HAL_Delay(1000); HAL_PWREx_EnterUnderDriveSTOPMode(PWR_LOWPOWERREGULATOR_UNDERDRIVE_ON,PWR_STOPENTRY_WFI); SystemClock_Config(); } /* USER CODE END 3 */

75 Low Power mode STANDBY lab 5 STM32F42xx Technical Training 15/06/2015

76 5 Use STANDBY mode 77 Objective For this lab create CubeMX project For testing purpose enable LED on PG14 Learn how to setup STANDBY in HAL Create simple project with STANDBY mode with wake up on pin press Goal Learn how to setup the STANDBY in HAL, which events can wake up you Verify the correct functionality by measuring consumption

77 STANDBY Mode GPIO s RTC/backup reg. Core CM4 FLASH RAM Core and all peripherals are OFF, except RTC and IWDG if enabled IWDG DMA HSE, HSI clocks are OFF, LSI LSE can be ON GP timers SPI USB DAC ADC Clock HSE HSI LSI LSE Reset USART I2C SRAM and registers content is lost, except RTC, and standby circuitry GPIO s are in high Z, except Reset, RTC OUT and WKUP 1,2,3 Power regulator Reset RTC OUT WKUP 1,2,3

78 5 Use STANDBY mode 79 HAL Library work flow summary Peripheral Initializations including peripheral interrupt NVIC initializations 1. init NVIC 2. Standby Enable Wake-up pin Enter into STANDBY mode(wfi) 3. Use WFI 4. create edge Reset 5. Wake up STM with reset

79 5 Use STANDBY mode 80 Now we open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */ tags For Wake up we need to setup wake up pin HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx) Function to enter STANDBY HAL_PWR_EnterSTANDBYMode(); We can measure consumption To be able to reprogram the STM32 which is in LP mode, use connection during reset option

80 5 Use STANDBY mode 81 Now we open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */ tags Function to enter SLEEP HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry) HAL_PWREx_EnterUnderDriveSTOPMode(uint32_t Regulator, uint8_t STOPEntry) We can measure consumption /* USER CODE BEGIN 3 */ /* Infinite loop */ while (1) { HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_14); HAL_Delay(2000); HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1); HAL_PWR_EnterSTANDBYMode(); } /* USER CODE END 3 */

81 5 Use STANDBY mode 82 We cannot go into STANDBY again? Try to clear wake up flag HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); /* USER CODE BEGIN 2 */ HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); /* USER CODE END 2 */

82 Data transfer over DMA lab 6 STM32F42xx Technical Training 15/06/2015

83 6 Use DMA in M2M transfer 84 Objective Learn how to setup DMA transfer in CubeMX Create simple DMA memory to memory transfer from RAM to RAM Goal Use CubeMX and Generate Code with DMA Learn how to setup the DMA in HAL Verify the correct functionality by comparing transferred buffers

84 ART Accelerator D-Bus I-Bus S-Bus 6 Use DMA in M2M transfer 85 CCM data RAM 64KB CORTEX-M4 168MHz w/ FPU & MPU Master 1 Ethernet 10/100 Master 5 FIFO/DMA High Speed USB2.0 Master 4 FIFO/DMA Dual Port DMA1 Master 2 FIFO/8 Streams Dual Port DMA2 Master 3 FIFO/8 Streams Dual Port AHB1-APB2 AHB1 AHB2 Dual Port AHB1-APB1 SRAM1 112KB SRAM2 16KB FSMC Multi-AHB Bus Matrix I-Code D-Code FLASH 1Mbytes

85 6 Use DMA in M2M transfer 86 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx For DMA we don t need to configure any pins

86 6 Use DMA in M2M transfer 87 In order to run on maximum frequency, setup clock system Details in lab 0

87 6 Use DMA in M2M transfer 88 DMA configuration TAB>Configuration System>DMA TAB>DMA2 Button ADD 1. TAB > Configuration 2. System DMA 3. TAB>DMA 2 4. Add DMA channel

88 6 Use DMA in M2M transfer 89 DMA configuration Select MEMTOMEM DMA request Normal mode Increment source and destination address FIFO setup Byte data width Burst size Button OK 2. Normal mode 5. Data width and Burst 1. MEMTOMEM 3. Increment addresses 4. FIFO setup 6. OK

89 6 Use DMA in M2M transfer 90 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

90 6 Use DMA in M2M transfer 91 Start process DMA (same for TIM, ADC) Non blocking start process The end of the process must be checked by polling Peripheral Initializations Start Process (HAL_DMA_Start) 1. init DMA 2. Start DMA 3. DMA transfer data Poll for process complete (HAL_DMA_PollForTransfer) 4. Check if transfer is complete

91 6 Use DMA in M2M transfer 92 Return values Most of CubeMX functions have return values, which indicate, if operation was successful, timeout occurs of function end with error Is recommended handle this return values to be sure that program working as expected Ex: Poll for process complete (HAL_DMA_PollForTransfer) HAL_OK HAL_ERROR HAL_BUSY DMA transfer was successfully finished and data was transferred to destination without error

92 6 Use DMA in M2M transfer 93 Return values Most of CubeMX functions have return values, which indicate, if operation was successful, timeout occurs of function end with error Is recommended handle this return values to be sure that program working as expected Ex: Poll for process complete (HAL_DMA_PollForTransfer) HAL_OK HAL_ERROR HAL_BUSY Error occurs during DMA transfer you use HAL_DMA_GetError for details what happened

93 6 Use DMA in M2M transfer 94 Return values Most of CubeMX functions have return values, which indicate, if operation was successful, timeout occurs of function end with error Is recommended handle this return values to be sure that program working as expected Ex: Poll for process complete (HAL_DMA_PollForTransfer) HAL_OK HAL_ERROR HAL_BUSY DMA transfer in progress, user can only abort the transfer

94 6 Use DMA in M2M transfer 95 Now we open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags HAL functions for DMA HAL_DMA_Start(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength) HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, uint32_t CompleteLevel, uint32_t Timeout)

95 6 Use DMA in M2M transfer 96 We create two buffers One with source data Second as destination buffer /* USER CODE BEGIN 0 */ uint8_t Buffer_Src[]={0,1,2,3,4,5,6,7,8,9}; uint8_t Buffer_Dest[10]; /* USER CODE END 0 */

96 6 Use DMA in M2M transfer 97 HAL_DMA_Start start the M2M data transfer HAL_DMA_PollForTransfer check if the transfer ends successfully /* USER CODE BEGIN 2 */ HAL_DMA_Start(&hdma_memtomem_dma2_stream0, (uint32_t) (Buffer_Src), (uint32_t) (Buffer_Dest), 10); while(hal_dma_pollfortransfer(&hdma_memtomem_dma2_stream0, HAL_DMA_FULL_TRANSFER, 100)!= HAL_OK) { NOP(); } /* USER CODE END 2 */

97 Data transfer over DMA with interrupt lab 7 STM32F42xx Technical Training 15/06/2015

98 7 Use DMA M2M transfer with interrupt 99 Objective Learn how to setup DMA transfer with interrupt in CubeMX Create simple DMA memory to memory transfer from RAM to RAM Goal Use CubeMX and Generate Code with DMA Learn how to setup the DMA in HAL Verify the correct functionality by comparing transferred buffers

99 7 Use DMA M2M transfer with interrupt 100 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx For DMA we don t need to configure any pins

100 7 Use DMA M2M transfer with interrupt 101 In order to run on maximum frequency, setup clock system Details in lab 0

101 7 Use DMA M2M transfer with interrupt 102 DMA configuration TAB>Configuration System>DMA TAB>DMA2 Button ADD 1. TAB > Configuration 2. System DMA 3. TAB>DMA 2 4. Add DMA channel

102 7 Use DMA M2M transfer with interrupt 103 DMA configuration Select MEMTOMEM DMA request Normal mode Increment source and destination address FIFO setup Byte data width Burst size Button OK 2. Normal mode 5. Data width and Burst 1. MEMTOMEM 3. Increment addresses 4. FIFO setup 6. OK

103 7 Use DMA M2M transfer with interrupt 104 DMA configuration System > NVIC Enable DMA2 Stream interrupt Button OK 1. TAB > Configuration 2. System > NVIC 3. Enable DMA2 interrupts 4. OK

104 7 Use DMA M2M transfer with interrupt 105 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

105 7 Use DMA M2M transfer with interrupt 106 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_DMA_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback process Error callback DMA_XferErrorCallback

106 7 Use DMA M2M transfer with interrupt 107 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Generated by CubeMX Start process with interrupt generation at end of process HAL_DMA_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback process Error callback DMA_XferErrorCallback

107 7 Use DMA M2M transfer with interrupt 108 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_DMA_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback process Error callback DMA_XferErrorCallback Defined by user

108 7 Use DMA M2M transfer with interrupt 109 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Generated in main.c Start process with interrupt generation at end of process HAL_DMA_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback process Error callback DMA_XferErrorCallback

109 7 Use DMA M2M transfer with interrupt 110 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_DMA_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback We recommend to use it in main.c process Error callback DMA_XferErrorCallback

110 7 Use DMA M2M transfer with interrupt 111 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_DMA_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback process Error callback DMA_XferErrorCallback User defined functions. The user must define functions by himself and put function names into DMA structure

111 7 Use DMA M2M transfer with interrupt 112 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_DMA_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback Generated in stm32f4xx_it.c process Error callback DMA_XferErrorCallback

112 7 Use DMA M2M transfer with interrupt 113 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_DMA_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback Defined in stm32f4xx_hal_dma.c process Error callback DMA_XferErrorCallback

113 7 Use DMA M2M transfer with interrupt 114 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_DMA_Start_IT Start DMA buffer transfer Not blocking function program can continue HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback process Error callback DMA_XferErrorCallback

114 7 Use DMA M2M transfer with interrupt 115 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Interrupt indicate DMA process is half/complete or error was detected Start process with interrupt generation at end of process HAL_DMA_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback process Error callback DMA_XferErrorCallback

115 7 Use DMA M2M transfer with interrupt 116 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_DMA_Start_IT Process interrupt information HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback process Error callback DMA_XferErrorCallback

116 7 Use DMA M2M transfer with interrupt 117 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_DMA_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback Data correctly transferred Complete callback function process Error callback DMA_XferErrorCallback

117 7 Use DMA M2M transfer with interrupt 118 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_DMA_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback Error was detected Error callback function process Error callback DMA_XferErrorCallback

118 7 Use DMA M2M transfer with interrupt 119 HAL Library DMA with IT flow DMA Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_DMA_Start_IT 1. DMA init 2. DMA transfer start HAL_OK HAL_ERROR HAL_BUSY HAL_DMA_IRQHandler DMA2_Stream0_IRQHandler end of process callback DMA_XferCpltCallback 5. DMA transfer was correct 4. HAL DMA management 3. DMA transfer complete or error process Error callback DMA_XferErrorCallback 5. Error in DMA transfer

119 7 Use DMA M2M transfer with interrupt 120 Now we open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags DMA callback function We need to add the name of callback function into DMA structure HAL functions for DMA HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)

120 7 Use DMA M2M transfer with interrupt 121 We create two buffers One with source data Second as destination buffer /* USER CODE BEGIN 0 */ uint8_t Buffer_Src[]={0,1,2,3,4,5,6,7,8,9}; uint8_t Buffer_Dest[10]; /* USER CODE END 0 */

121 7 Use DMA M2M transfer with interrupt 122 DMA callback creation function prototype /* USER CODE BEGIN 0 */ uint8_t Buffer_Src[]={0,1,2,3,4,5,6,7,8,9}; uint8_t Buffer_Dest[10]; void XferCpltCallback(DMA_HandleTypeDef *hdma); /* USER CODE END 0 */ DMA complete callback with nop where we can put breakpoint /* USER CODE BEGIN 4 */ void XferCpltCallback(DMA_HandleTypeDef *hdma) { NOP();//we reach this only if DMA transfer was correct } /* USER CODE END 4 */

122 7 Use DMA M2M transfer with interrupt 123 DMA Start Before we start the DMA with interrupt we need to set the callback into DMA structure Then is possible use the HAL_DMA_Start_IT to begin DMA transfer /* USER CODE BEGIN 2 */ hdma_memtomem_dma2_stream0.xfercpltcallback=&xfercpltcallback; HAL_DMA_Start_IT(&hdma_memtomem_dma2_stream0,(uint32_t)Buffer_Src,(uint32_t)Buffer_Dest,10); /* USER CODE END 2 */

123 Use RTC Alarm lab 8 STM32F42xx Technical Training 15/06/2015

124 8 Use RTC and Alarm with interrupt 125 Objective Learn how to setup RTC with interrupt in CubeMX Create simple RTC project with periodic alarm interrupt Goal Use CubeMX and Generate Code with RTC Learn how to setup the RTC in HAL Verify the correct functionality by periodic RTC alarm interrupts

125 8 Use RTC and Alarm with interrupt 126 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx Set Internal Alarm on Alarm A or Alarm B Set GPIO to toggle with LED as alarm indication

126 8 Use RTC and Alarm with interrupt 127 In order to run on maximum frequency, setup clock system Details in lab 0

127 8 Use RTC and Alarm with interrupt 128 RTC Configuration TAB>Configuration Control > RTC Set parameters which you want 1. TAB > Configuration 2. RTC 3. Check configuration

128 8 Use RTC and Alarm with interrupt 129 RTC Configuration NVIC TAB>NVIC Setup Enable Alarm interrupt Button OK 1. TAB > NVIC 2. Enable RTC Alarm 3. Button OK

129 8 Use RTC and Alarm with interrupt 130 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

130 8 Use RTC and Alarm with interrupt 131 The RTC can be preserved during RESET(ok LP modes) CubeMX not enable the RTC by default We need to add HAL_PWR_EnableBkUpAccess() and HAL_RCC_RTC_ENABLE() before we call MX_RTC_Init() Set the first alarm to 1s In MX_RTC_Init We create the RTC interrupt handler and we reconfigure the Alarm A time HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc) HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *salarm, uint32_t Alarm, uint32_t Format) HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *salarm, uint32_t Format) RTC alarm indication will be done by LED HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)

131 8 Use RTC and Alarm with interrupt 132 RTC enable /* Initialize all configured peripherals */ HAL_PWR_EnableBkUpAccess();//enable PWR backup domain access (RTC,BKReg) HAL_RCC_RTC_ENABLE();//Enable RTC. not created by cube because the RTC can run. MX_GPIO_Init(); MX_RTC_Init(); In MX_RTC_Init we set first Alarm to 1s /**Enable the Alarm A */ salarm.alarmtime.hours = 0; salarm.alarmtime.minutes = 0; salarm.alarmtime.seconds = 1; salarm.alarmtime.subseconds = 0;

132 8 Use RTC and Alarm with interrupt 133 RTC enable /* USER CODE BEGIN 4 */ void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc){ RTC_AlarmTypeDef salarm; HAL_RTC_GetAlarm(hrtc,&sAlarm,RTC_ALARM_A,FORMAT_BIN); if(salarm.alarmtime.seconds>58){ salarm.alarmtime.seconds=0; }else{ salarm.alarmtime.seconds=salarm.alarmtime.seconds+1; } while(hal_rtc_setalarm_it(hrtc, &salarm, FORMAT_BIN)!=HAL_OK){} HAL_GPIO_TogglePin(GPIOG,GPIO_PIN_14); } /* USER CODE END 4 */

133 8 Use RTC and Alarm with interrupt 134 Advanced task The counting stops after 1minute Modify the project to create alarm every 1s for infinite time /**Enable the Alarm A */ salarm.alarmtime.hours = 0; salarm.alarmtime.minutes = 0; salarm.alarmtime.seconds = 1; salarm.alarmtime.subseconds = 0; salarm.alarmtime.timeformat = RTC_HOURFORMAT12_AM; salarm.alarmtime.daylightsaving = RTC_DAYLIGHTSAVING_NONE; salarm.alarmtime.storeoperation = RTC_STOREOPERATION_RESET; salarm.alarmmask = RTC_ALARMMASK_DATEWEEKDAY RTC_ALARMMASK_HOURS RTC_ALARMMASK_MINUTES; salarm.alarmsubsecondmask = RTC_ALARMSUBSECONDMASK_ALL; salarm.alarmdateweekdaysel = RTC_ALARMDATEWEEKDAYSEL_DATE; salarm.alarmdateweekday = 1; salarm.alarm = RTC_ALARM_A; HAL_RTC_SetAlarm_IT(&hrtc, &salarm, FORMAT_BCD); We only need to modify the Alarm mask to ignore Days, Hours and Minutes

134 UART Poll lab 9 STM32F42xx Technical Training 15/06/2015

135 9 Simple UART communication 136 Objective Learn how to setup UART in CubeMX How to Generate Code in CubeMX and use HAL functions Work in pairs, one will create transmitter and second receiver Goal Configure UART in CubeMX and Generate Code Learn how to send and receive data over UART without interrupts Verify the correct functionality

136 9 Simple UART communication 137 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx Pin selection We are looking for free pins where is possible to create wire loopback connection

137 9 Simple UART communication 138 Pin selection We are looking for free pins where is possible to create wire loopback connection Image from STM32F429-Discovery user manual

138 9 Simple UART communication 139 Pin selection We are looking for free pins where is possible to create wire loopback connection Image from STM32F429 datasheet

139 9 Simple UART communication 140 Hardware preparation We connect selected pins together by jumper, this help us to create loopback on UART Hardware connection RX <-TX TX>RX

140 9 Simple UART communication 141 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx CubeMX UART selection Select USART1 in asynchronous mode Select PA9 and PA10 for USART1 if weren't selected

141 9 Simple UART communication 142 In order to run on maximum frequency, setup clock system Details in lab 0

142 9 Simple UART communication 143 CubeMX UART configuration Tab>Configuration>Connectivity>USART1

143 9 Simple UART communication 144 CubeMX USART configuration check: BaudRate World length Parity Stop bits Data direction Oversampling

144 9 Simple UART communication 145 CubeMX USART GPIO configuration check: On high baud rate set the GPIO speed to HIGH TAB>Configuration>System> >GPIO Set the HIGH output speed Button OK

145 9 Simple UART communication 146 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

146 9 Simple UART communication 147 HAL Library init flow Peripheral Initializations MX_USART1_UART_Init(); CubeMX UART init start in main.c file Init UART1 structure HAL_UART_Init(&huart1); HAL_UART_MspInit callback Init GPIO and NVIC for UART

147 9 Simple UART communication 148 HAL Library init flow Peripheral Initializations 1. We need init UART1 MX_USART1_UART_Init(); Init UART1 structure HAL_UART_Init(&huart1); HAL_UART_MspInit callback Init GPIO and NVIC for UART

148 9 Simple UART communication 149 HAL Library init flow Peripheral Initializations 1. We need init UART1 MX_USART1_UART_Init(); Init UART1 structure CubeMX create for us function which handle UART initialization HAL_UART_Init(&huart1); HAL_UART_MspInit callback Init GPIO and NVIC for UART

149 9 Simple UART communication 150 HAL Library init flow Peripheral Initializations MX_USART1_UART_Init(); 1. We need init UART1 2. Call UART1 init function Init UART1 structure HAL_UART_Init(&huart1); HAL_UART_MspInit callback Init GPIO and NVIC for UART

150 9 Simple UART communication 151 HAL Library init flow Peripheral Initializations MX_USART1_UART_Init(); 1. We need init UART1 2. Call UART1 init function Init UART1 structure HAL_UART_Init(&huart1); CubeMX fill the UART structure with parameters which we choose in Configuration window HAL_UART_MspInit callback Init GPIO and NVIC for UART

151 9 Simple UART communication 152 HAL Library init flow Peripheral Initializations MX_USART1_UART_Init(); 1. We need init UART1 2. Call UART1 init function Init UART1 structure 3. Store UART1 configuration into structure HAL_UART_Init(&huart1); HAL_UART_MspInit callback Init GPIO and NVIC for UART

152 9 Simple UART communication 153 HAL Library init flow Peripheral Initializations MX_USART1_UART_Init(); 1. We need init UART1 2. Call UART1 init function Init UART1 structure 3. Store UART1 configuration into structure HAL_UART_Init(&huart1); HAL_UART_MspInit callback Function wrote parameters from structure into UART1 registers Init GPIO and NVIC for UART

153 9 Simple UART communication 154 HAL Library init flow Peripheral Initializations MX_USART1_UART_Init(); 1. We need init UART1 2. Call UART1 init function Init UART1 structure HAL_UART_Init(&huart1); 3. Store UART1 configuration into structure 4. Write to UART1 registers HAL_UART_MspInit callback Init GPIO and NVIC for UART Optional callback from HAL_UART_Init function, be default empty weak function

154 9 Simple UART communication 155 HAL Library init flow Peripheral Initializations MX_USART1_UART_Init(); 1. We need init UART1 2. Call UART1 init function Init UART1 structure HAL_UART_Init(&huart1); 3. Store UART1 configuration into structure 4. Write to UART1 registers HAL_UART_MspInit callback Init GPIO and NVIC for UART CubeMX configure here UART1 GPIOs and enable UART1 clock system

155 9 Simple UART communication 156 HAL Library init flow Peripheral Initializations MX_USART1_UART_Init(); 1. We need init UART1 2. Call UART1 init function Init UART1 structure HAL_UART_Init(&huart1); 3. Store UART1 configuration into structure 4. Write to UART1 registers HAL_UART_MspInit callback 5. UART1 init callback Init GPIO and NVIC for UART CubeMX configure here UART1 GPIOs and enable UART1 clock system and NVIC

156 9 Simple UART communication 157 HAL Library init flow Peripheral Initializations MX_USART1_UART_Init(); 1. We need init UART1 2. Call UART1 init function Init UART1 structure HAL_UART_Init(&huart1); 3. Store UART1 configuration into structure 4. Write to UART1 registers HAL_UART_MspInit callback 5. UART1 init callback Init GPIO and NVIC for UART 6. UART1 GPIOS, NVIC and RCC init

157 9 Simple UART communication 158 HAL Library init flow Peripheral Initializations MX_USART1_UART_Init(); 1. We need init UART1 2. Call UART1 init function Init UART1 structure HAL_UART_Init(&huart1); 3. Store UART1 configuration into structure 4. Write to UART1 registers HAL_UART_MspInit callback 5. UART1 init callback Init GPIO and NVIC for UART 6. UART1 GPIOS, NVIC and RCC init 7. Next periph init or user code

158 9 Simple UART communication 159 HAL Library transmit flow Peripheral Initializations Generated by CubeMX Polling process HAL_UART_Transmit Function blocks Polling with timeout HAL_TIMEOUT HAL_OK HAL_ERROR HAL_BUSY

159 9 Simple UART communication 160 HAL Library transmit flow Peripheral Initializations Created by user Polling process HAL_UART_Transmit Function blocks Polling with timeout HAL_TIMEOUT HAL_OK HAL_ERROR HAL_BUSY

160 9 Simple UART communication 161 HAL Library receive flow Peripheral Initializations Generated by CubeMX Polling process HAL_UART_Receive Function blocks Polling with timeout HAL_TIMEOUT HAL_OK HAL_ERROR HAL_BUSY

161 9 Simple UART communication 162 HAL Library receive flow Peripheral Initializations Created by user Polling process HAL_UART_Receive Function blocks Polling with timeout HAL_TIMEOUT HAL_OK HAL_ERROR HAL_BUSY

162 9 Simple UART communication 163 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */ tags Into infinite while function For transmit use function HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pdata, uint16_t Size, uint32_t Timeout) For receive use function HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pdata, uint16_t Size, uint32_t Timeout);

163 9 Simple UART communication 164 Transmit solution Create data structure for data /* USER CODE BEGIN 0 */ uint8_t data[]={0,1,2,3,4,5,6,7,8,9}; /* USER CODE END 0 */ Call transmit function from while loop /* USER CODE BEGIN 3 */ /* Infinite loop */ while (1) { HAL_UART_Transmit(&huart1,data,10,1000); } /* USER CODE END 3 */

164 9 Simple UART communication 165 Receive solution Create data structure for data /* USER CODE BEGIN 0 */ uint8_t data[10]; /* USER CODE END 0 */ Call transmit function from while loop /* USER CODE BEGIN 3 */ /* Infinite loop */ while (1) { HAL_UART_Receive(&huart1,data,10,1000); } /* USER CODE END 3 */

165 UART Interrupt lab 10 STM32F42xx Technical Training 15/06/2015

166 10 Use UART with interrupt 167 Objective Learn how to setup UART with interrupts in CubeMX How to Generate Code in CubeMX and use HAL functions Create simple loopback example with interrupts Goal Configure UART in CubeMX and Generate Code Learn how to send and receive data over UART with interrupts Verify the correct functionality

167 10 Use UART with interrupt 168 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx Pin selection It will be same as previous lab we use again PA9 and PA10

168 10 Use UART with interrupt 169 Hardware preparation We connect selected pins together by jumper, this help us to create loopback on UART Hardware loopback

169 10 Use UART with interrupt 170 In order to run on maximum frequency, setup clock system Details in lab 0

170 10 Use UART with interrupt 171 CubeMX UART configuration Tab>Configuration>Connectivity>USART1

171 10 Use UART with interrupt 172 CubeMX UART configuration check: BaudRate World length Parity Stop bits Data direction Oversampling

172 10 Use UART with interrupt 173 CubeMX USART configuration NVIC settings TAB>NVIC Settings Enable interrupts OK

173 10 Use UART with interrupt 174 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

174 10 Use UART with interrupt 175 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Receive_IT HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_RxCpltCallback process Error callback HAL_UART_ErrorCallback

175 10 Use UART with interrupt 176 HAL Library UART with IT transmit flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback process Error callback HAL_UART_ErrorCallback

176 10 Use UART with interrupt 177 HAL Library UART with IT transmit flow Peripheral Initializations including peripheral interrupt NVIC initializations Generated by CubeMX Start process with interrupt generation at end of process HAL_UART_Transmit_IT HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback process Error callback HAL_UART_ErrorCallback

177 10 Use UART with interrupt 178 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback process Error callback HAL_UART_ErrorCallback Defined by user

178 10 Use UART with interrupt 179 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT Generated in main.c and stm32f4xx_hal_msp.c HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback process Error callback HAL_UART_ErrorCallback

179 10 Use UART with interrupt 180 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback We recommend to use it in main.c process Error callback HAL_UART_ErrorCallback

180 10 Use UART with interrupt 181 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback process Error callback HAL_UART_ErrorCallback Defined as weak you can find name of this functions in stm32f4xx_hal_uart.c

181 10 Use UART with interrupt 182 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback Generated in stm32f4xx_it.c process Error callback HAL_UART_ErrorCallback

182 10 Use UART with interrupt 183 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback Defined in stm32f4xx_hal_uart.c process Error callback HAL_UART_ErrorCallback

183 10 Use UART with interrupt 184 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT Send buffer over UART Not blocking function program can continue HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback process Error callback HAL_UART_ErrorCallback

184 10 Use UART with interrupt 185 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT Interrupt indicate the data register is empty we can send more data or error was detected HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback process Error callback HAL_UART_ErrorCallback

185 10 Use UART with interrupt 186 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT Process interrupt information HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback process Error callback HAL_UART_ErrorCallback

186 10 Use UART with interrupt 187 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT Send more data if is buffer not empty HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback process Error callback HAL_UART_ErrorCallback

187 10 Use UART with interrupt 188 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback If data buffer is empty use Complete callback function process Error callback HAL_UART_ErrorCallback

188 10 Use UART with interrupt 189 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback Or if error was detected use Error callback function process Error callback HAL_UART_ErrorCallback

189 10 Use UART with interrupt 190 HAL Library UART with IT receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_UART_Transmit_IT 1. UART1 init 2. UART1 send buffer HAL_OK HAL_ERROR HAL_BUSY HAL_UART_IRQHandler USART1_IRQHandler end of process callback HAL_UART_TxCpltCallback 5. Buffer sent 4. Send more data or manage error 3. UART1 Tx register empty process Error callback HAL_UART_ErrorCallback 5. Transmit error

190 10 Use UART with interrupt 191 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags For transmit use function HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pdata, uint16_t Size); For receive use function HAL_UART_Receive_IT(UART_HandleTypeDef *huart, uint8_t *pdata, uint16_t Size);

191 10 Use UART with interrupt 192 Buffer definition /* USER CODE BEGIN 0 */ uint8_t tx_buff[]={0,1,2,3,4,5,6,7,8,9}; uint8_t rx_buff[10]; /* USER CODE END 0 */ Sending and receiving methods /* USER CODE BEGIN 2 */ HAL_UART_Receive_IT(&huart1,rx_buff,10); HAL_UART_Transmit_IT(&huart1,tx_buff,10); /* USER CODE END 2 */

192 10 Use UART with interrupt 193 Complete callback check We can put brakepoints on NOPs to watch if we send or receive complete buffer /* USER CODE BEGIN 4 */ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { NOP();//test if we reach this position } void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) { NOP();//test if we reach this position } /* USER CODE END 4 */

193 UART DMA lab 11 STM32F42xx Technical Training 15/06/2015

194 11 Use UART with DMA transfer 196 Objective Learn how to setup UART with DMA in CubeMX How to Generate Code in CubeMX and use HAL functions Create simple loopback example with DMA Goal Configure UART in CubeMX and Generate Code Learn how to send and receive data over UART with DMA Verify the correct functionality

195 11 Use UART with DMA transfer 197 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx Pin selection It will be same as previous lab we use again PA9 and PA10

196 11 Use UART with DMA transfer 198 Hardware preparation We connect selected pins together by jumper, this help us to create loopback on UART Hardware loopback

197 11 Use UART with DMA transfer 199 In order to run on maximum frequency, setup clock system Details in lab 0

198 11 Use UART with DMA transfer 200 CubeMX UART configuration Tab>Configuration>Connectivity>USART1

199 11 Use UART with DMA transfer 201 CubeMX USART configuration check: BaudRate World length Parity Stop bits Data direction Oversampling

200 11 Use UART with DMA transfer 202 CubeMX USART configuration DMA settings TAB>DMA Settings Button ADD

201 11 Use UART with DMA transfer 203 CubeMX USART configuration DMA Tx settings Set USART1_TX request Memory to peripheral direction Normal mode Byte data width Increment memory address

202 11 Use UART with DMA transfer 204 CubeMX USART configuration DMA Rx settings Button ADD Set USART1_RX request Peripheral to memory direction Normal mode Byte data width Increment memory address

203 11 Use UART with DMA transfer 205 CubeMX USART configuration NVIC settings TAB>NVIC Settings Enable DMA2 interrupts for USART1 Button OK

204 11 Use UART with DMA transfer 206 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

205 11 Use UART with DMA transfer 207 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback process Error callback HAL_UART_ErrorCallback

206 11 Use UART with DMA transfer 208 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Generated by CubeMX Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback process Error callback HAL_UART_ErrorCallback

207 11 Use UART with DMA transfer 209 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback process Error callback HAL_UART_ErrorCallback Defined by user

208 11 Use UART with DMA transfer 210 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA Generated in main.c and stm32f4xx_hal_msp.c HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback process Error callback HAL_UART_ErrorCallback

209 11 Use UART with DMA transfer 211 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback We recommend to use it in main.c process Error callback HAL_UART_ErrorCallback

210 11 Use UART with DMA transfer 212 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback Generated in stm32f4xx_it.c process Error callback HAL_UART_ErrorCallback

211 11 Use UART with DMA transfer 213 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback process Error callback HAL_UART_ErrorCallback Defined in stm32f4xx_hal_dma.c and then linked to stm32f4xx_hal_uart.c

212 11 Use UART with DMA transfer 214 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA Receive buffer over UART with DMA Not blocking function program can continue HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback process Error callback HAL_UART_ErrorCallback

213 11 Use UART with DMA transfer 215 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA Interrupt indicate the DMA receive half/complete buffer or DMA error was detected HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback process Error callback HAL_UART_ErrorCallback

214 11 Use UART with DMA transfer 216 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA Process interrupt information from DMA and UART HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback process Error callback HAL_UART_ErrorCallback

215 11 Use UART with DMA transfer 217 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback If data buffer is full HAL use Complete callback function process Error callback HAL_UART_ErrorCallback

216 11 Use UART with DMA transfer 218 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA_Stream_IRQ Handler end of process callback HAL_UART_RxCpltCallback process Error callback HAL_UART_ErrorCallback Or if DMA error was detected use Error callback function

217 11 Use UART with DMA transfer 219 HAL Library UART with DMA RX flow Peripheral Initializations including DMA stream initializations 1. UART1 and DMA2 init Start process with DMA end of transfer interrupt generation at end of process HAL_UART_Receive_DMA 2. UART1 receive buffer HAL_OK HAL_ERROR end of process callback HAL_UART_RxCpltCallback HAL_ERROR 5. Buffer received HAL_DMA_IRQHandler 4. Process interrupt DMA_Stream_IRQ Handler 3. DMA buffer full process Error callback HAL_UART_ErrorCallback 5. Receive error

218 11 Use UART with DMA transfer 220 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags For transmit use function HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pdata, uint16_t Size); For receive use function HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pdata, uint16_t Size);

219 11 Use UART with DMA transfer 221 Buffer definition /* USER CODE BEGIN 0 */ uint8_t tx_buff[]={0,1,2,3,4,5,6,7,8,9}; uint8_t rx_buff[10]; /* USER CODE END 0 */ Sending and receiving methods with DMA /* USER CODE BEGIN 2 */ HAL_UART_Receive_DMA(&huart1,rx_buff,10); HAL_UART_Transmit_DMA(&huart1,tx_buff,10); /* USER CODE END 2 */

220 11 Use UART with DMA transfer 222 Complete callback check We can put breakpoints on NOPs to watch if we receive complete buffer /* USER CODE BEGIN 4 */ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { NOP();//check if we receive all data } /* USER CODE END 4 */

221 SPI Poll lab 12 STM32F42xx Technical Training 15/06/2015

222 12 Simple SPI communication 224 Objective Learn how to setup SPI in CubeMX How to Generate Code in CubeMX and use HAL functions Goal Configure SPI in CubeMX and Generate Code Learn how to send and receive data over SPI without interrupts Verify the correct functionality

223 12 Simple SPI communication 225 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx Pin selection We are looking for free pins where is possible to create wire loopback connection

224 12 Simple SPI communication 226 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx CubeMX SPI selection Select SPI1 Full-Duplex Master Select PA5, PA6, PA7 for SPI1 if weren't selected

225 12 Simple SPI communication 227 Hardware preparation Connect PA6 and PA7 together with jumper Hardware loopback

226 12 Simple SPI communication 228 In order to run on maximum frequency, setup clock system Details in lab 0

227 12 Simple SPI communication 229 CubeMX SPI configuration Tab>Configuration>Connectivity>SPI1 Check the settings Button OK The CLK frequency with core on 180MHz is now 45MHz For this clock use HIGH GPIO speed

228 12 Simple SPI communication 230 CubeMX SPI GPIO configuration The SPI CLK frequency with core on 180MHz is now 45MHz For this clock use HIGH GPIO speed Tab>Configuration>System> >GPIO Tab>SPI1 Seth High output speed Button OK

229 12 Simple SPI communication 231 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

230 12 Simple SPI communication 232 HAL Library transmit receive flow Peripheral Initializations Polling process HAL_SPI_TransmitReceive Function blocks Polling with timeout HAL_TIMEOUT HAL_OK HAL_ERROR HAL_BUSY

231 12 Simple SPI communication 233 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */ tags For transmit and receive use function HAL_SPI_TransmitReceive(SPI_HandleTypeDef *hspi, uint8_t *ptxdata, uint8_t *prxdata, uint16_t Size, uint32_t Timeout)

232 12 Simple SPI communication 234 Transmit receive solution Create data structure for data /* USER CODE BEGIN PV */ uint8_t tx_buffer[]={0,1,2,3,4,5,6,7,8,9}; uint8_t rx_buffer[10]; /* USER CODE END PV */ Call transmit receive function /* USER CODE BEGIN 2 */ HAL_SPI_TransmitReceive(&hspi1,tx_buffer,rx_buffer,10,100); /* USER CODE END 2 */

233 SPI Interrupt lab 13 STM32F42xx Technical Training 15/06/2015

234 13 Use SPI with interrupt 236 Objective Learn how to setup SPI with interrupts in CubeMX How to Generate Code in CubeMX and use HAL functions Create simple loopback example with interrupts Goal Configure SPI in CubeMX and Generate Code Learn how to send and receive data over SPI with interrupts Verify the correct functionality

235 13 Use SPI with interrupt 237 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx CubeMX SPI selection Select SPI1 Full-Duplex Master Select PA5, PA6, PA7 for SPI1 if weren't selected

236 13 Use SPI with interrupt 238 Hardware preparation Connect PA6 and PA7 together with jumper Hardware loopback

237 13 Use SPI with interrupt 239 In order to run on maximum frequency, setup clock system Details in lab 0

238 13 Use SPI with interrupt 240 CubeMX SPI configuration Tab>Configuration>Connectivity>SPI1 Check the settings Button OK

239 13 CubeMX SPI configuration TAB>NVIC Settings Enable SPI interrupt Button OK Use SPI with interrupt 241

240 13 Use SPI with interrupt 242 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

241 13 Use SPI with interrupt 243 HAL Library SPI with IT transmit receive flow Peripheral Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_SPI_TransmitReceive_IT HAL_OK HAL_ERROR HAL_BUSY HAL_SPI_IRQHandler SPI1_IRQHandler end of process callback HAL_SPI_TxRxCpltCallback process Error callback HAL_SPI_ErrorCallback

242 13 Use SPI with interrupt 244 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags For transmit use function HAL_SPI_TransmitReceive_IT(SPI_HandleTypeDef *hspi, uint8_t *ptxdata, uint8_t *prxdata, uint16_t Size)

243 13 Use SPI with interrupt 245 Buffer definition /* USER CODE BEGIN 0 */ uint8_t tx_buff[]={0,1,2,3,4,5,6,7,8,9}; uint8_t rx_buff[10]; /* USER CODE END 0 */ Sending and receiving methods /* USER CODE BEGIN 2 */ HAL_SPI_TransmitReceive_IT(&hspi1,tx_buff,rx_buff,10); /* USER CODE END 2 */

244 13 Use SPI with interrupt 246 Complete callback check We can put breakpoints on NOPs to watch if we send or receive complete buffer /* USER CODE BEGIN 4 */ void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi) { NOP(); } /* USER CODE END 4 */

245 SPI DMA lab 14 STM32F42xx Technical Training 15/06/2015

246 14 Use SPI with DMA transfer 248 Objective Learn how to setup SPI with DMA in CubeMX How to Generate Code in CubeMX and use HAL functions Create simple loopback example with DMA Goal Configure SPI in CubeMX and Generate Code Learn how to send and receive data over SPI with DMA Verify the correct functionality

247 14 Use SPI with DMA transfer 249 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx CubeMX SPI selection Select SPI1 Full-Duplex Master Select PA5, PA6, PA7 for SPI1 if weren't selected

248 14 Use SPI with DMA transfer 250 Hardware preparation Connect PA6 and PA7 together with jumper Hardware loopback

249 14 Use SPI with DMA transfer 251 In order to run on maximum frequency, setup clock system Details in lab 0

250 14 Use SPI with DMA transfer 252 CubeMX SPI configuration Tab>Configuration>Connectivity>SPI1 Check the settings Button OK

251 14 Use SPI with DMA transfer 253 CubeMX SPI configuration DMA settings TAB>DMA Settings Button ADD SPI1_RX Memory increment Button ADD SPI1_Tx Memory increment Button OK

252 14 Use SPI with DMA transfer 254 CubeMX SPI configuration NVIC settings TAB>NVIC Settings Enable DMA2 interrupts for SPI1 Button OK

253 14 Use SPI with DMA transfer 255 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

254 14 Use SPI with DMA transfer 256 HAL Library SPI with DMA TX RX flow Peripheral Initializations including DMA stream initializations Start process with DMA end of transfer interrupt generation at end of process HAL_SPI_TransmitReceive_DMA HAL_OK HAL_ERROR HAL_ERROR HAL_DMA_IRQHandler DMA2_Stream0_IRQ Handler end of process callback HAL_SPI_TxRxCpltCallback process Error callback HAL_SPI_ErrorCallback

255 14 Use SPI with DMA transfer 257 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags For transmit use function HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi, uint8_t *ptxdata, uint8_t *prxdata, uint16_t Size)

256 14 Use SPI with DMA transfer 258 Buffer definition /* USER CODE BEGIN 0 */ uint8_t tx_buff[]={0,1,2,3,4,5,6,7,8,9}; uint8_t rx_buff[10]; /* USER CODE END 0 */ Sending and receiving methods /* USER CODE BEGIN 2 */ HAL_SPI_TransmitReceive_DMA(&hspi1,tx_buff,rx_buff,10); /* USER CODE END 2 */

257 14 Use SPI with DMA transfer 259 Complete callback check We can put breakpoints on NOPs to watch if we send or receive complete buffer /* USER CODE BEGIN 4 */ void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi) { NOP(); } /* USER CODE END 4 */

258 TIM with interrupt lab 15 STM32F42xx Technical Training 15/06/2015

259 15 Use TIM with interrupt 261 Objective Learn how to setup TIM with Interrupt in CubeMX How to Generate Code in CubeMX and use HAL functions Indicate TIM interrupt with LED toggle Goal Configure TIM in CubeMX and Generate Code Learn how start timer and handle interrupt Verify the correct functionality

260 15 Use TIM with interrupt 262 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx CubeMX TIM selection Select TIM clock source Internal clock Enable GPIO for LED PG14

261 15 CubeMX TIM configuration Tab>Configuration>Control>TIM1 Check the settings Use TIM with interrupt 263

262 15 CubeMX TIM configuration Tab>Parameter Settings Prescaler to Counter period to Together with 180MHz TIMER1 clock we get period 1Hz Use TIM with interrupt 264

263 15 CubeMX TIM configuration Tab>NVIC Settings Enable TIM1 Update interrupt Button OK Use TIM with interrupt 265

264 15 Use TIM with interrupt 266 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

265 15 Use TIM with interrupt 267 HAL Library TIM with IT flow TIM Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_TIM_Base_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_TIM_IRQHandler TIM1_UP_TIM10_IRQHandler process callback HAL_TIM_PeriodElapsedCallback process Error callback HAL_TIM_ErrorCallback

266 15 Use TIM with interrupt 268 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags For TIM start use function HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim) TIM callback void TIM1_UP_TIM10_IRQHandler(void) GPIO LED toggle HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)

267 15 Use TIM with interrupt 269 Solution TIM start /* USER CODE BEGIN 2 */ HAL_TIM_Base_Start_IT(&htim1); /* USER CODE END 2 */ Callback handling /* USER CODE BEGIN 4 */ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { HAL_GPIO_TogglePin(GPIOG,GPIO_PIN_14); } /* USER CODE END 4 */

268 TIM with PWM output lab 16 STM32F42xx Technical Training 15/06/2015

269 16 Use TIM with PWM output 271 Objective Learn how to setup TIM with PWM out in CubeMX How to Generate Code in CubeMX and use HAL functions Indicate TIM PWM on LED Goal Configure TIM in CubeMX and Generate Code Learn how start timer and set PWM out Verify the correct functionality with LED

270 16 Use TIM with PWM output 272 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx CubeMX TIM selection Select TIM clock source - Internal clock Set Channel1 to PWM generation

271 16 Use TIM with PWM output 273 CubeMX TIM configuration TAB>Configuration >Control>TIM1 TAB>Parameter settings Prescaler to Counter period to Together with 180MHz TIMER1 clock we get period 1Hz PWM pulse to 5000 this give us 1Hz blinking frequency

272 16 Use TIM with PWM output 274 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

273 16 Use TIM with PWM output 275 Start process TIM with PWM(same for DMA, ADC) Non blocking start process Peripheral Initializations Start Process HAL_TIM_PWM_Start

274 16 Use TIM with PWM output 276 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags For TIM start use function HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel) GPIO LED toggle We wire the Channel1 PE9 with LED PG14

275 16 Use TIM with PWM output 277 Solution TIM PWM start /* USER CODE BEGIN 2 */ HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_1); /* USER CODE END 2 */ TIM1 Channel 1 and LED connection

276 TIM with DMA lab 17 STM32F42xx Technical Training 15/06/2015

277 17 Use TIM with DMA transfer 279 Objective Learn how to setup TIM with DMA in CubeMX How to Generate Code in CubeMX and use HAL functions Indicate TIM DMA transfer with LED toggle Goal Configure TIM in CubeMX and Generate Code Learn how start timer and setup DMA Verify the correct functionality with DMA transfer into GPIO register

278 17 Use TIM with DMA transfer 280 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx CubeMX TIM selection Select TIM clock source Internal clock Enable GPIO for LED PG14

279 17 Use TIM with DMA transfer 281 CubeMX TIM configuration Tab>Configuration>Control>TIM1 Check the settings

280 17 Use TIM with DMA transfer 282 CubeMX TIM configuration Tab>Parameter Settings Prescaler to Counter period to Together with 180MHz TIMER1 clock we get period 1Hz

281 17 Use TIM with DMA transfer 283 CubeMX TIM configuration TAB>DMA Settings Button ADD Select TIM1_UP DMA request Memory to peripheral direction Set Memory increment Circular mode Half word data width Button OK

282 17 Use TIM with DMA transfer 284 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

283 17 Use TIM with DMA transfer 285 HAL Library TIM with DMA flow Peripheral Initializations including DMA stream initializations Start process with DMA HAL_DMA_Start HAL_OK HAL_ERROR HAL_ERROR Start process with TIM HAL_TIM_Base_Start HAL_OK HAL_ERROR HAL_ERROR

284 17 Use TIM with DMA transfer 286 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags For TIM start use function HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pdata, uint16_t Length) TIM1 trigger DMA transfer HAL_TIM_ENABLE_DMA DMA start function HAL_DMA_Start(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength) GPIO LED register address (uint32_t)(&gpiog->odr)

285 17 Use TIM with DMA transfer 287 Variable data definition /* USER CODE BEGIN PV */ uint16_t data[]={gpio_pin_14,0x0000}; /* USER CODE END PV */ DMA and TIM start /* USER CODE BEGIN 2 */ HAL_TIM_ENABLE_DMA(&htim1, TIM_DMA_UPDATE); HAL_DMA_Start(&hdma_tim1_up,(uint32_t)data,(uint32_t)&GPIOG->ODR,2); HAL_TIM_Base_Start(&htim1); /* USER CODE END 2 */

286 TIM as counter lab 18 STM32F42xx Technical Training 15/06/2015

287 18 Use TIM as pulse counter 289 Objective Learn how to setup TIM as counter in CubeMX How to Generate Code in CubeMX and use HAL functions Indicate TIM count 5 button press with LED toggle Goal Configure TIM as counter in CubeMX and Generate Code Learn how start timer and handle interrupt Verify the correct functionality with LED toggle after 5 button press

288 18 Use TIM as pulse counter 290 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx CubeMX TIM selection Select TIM clock source ETR2 Enable GPIO for LED PG14

289 18 Use TIM as pulse counter 291 Hard ware setting Connect Button PA0 and ETR pin PE7 with wire together

290 18 Use TIM as pulse counter 292 CubeMX TIM configuration Tab>Configuration>Control>TIM1 Check the settings

291 18 Use TIM as pulse counter 293 CubeMX TIM configuration Tab>Parameter Settings Counter set to 5, 5 button press Clock set the ETR pin filter and edge reaction

292 18 Use TIM as pulse counter 294 CubeMX TIM configuration Tab>NVIC Settings Enable TIM1 Update interrupt Button OK

293 18 Use TIM as pulse counter 295 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

294 18 Use TIM as pulse counter 296 HAL Library TIM with IT flow TIM Initializations including peripheral interrupt NVIC initializations Start process with interrupt generation at end of process HAL_TIM_Base_Start_IT HAL_OK HAL_ERROR HAL_BUSY HAL_TIM_IRQHandler TIM1_UP_TIM10_IRQHandler process callback HAL_TIM_PeriodElapsedCallback process Error callback HAL_TIM_ErrorCallback

295 18 Use TIM as pulse counter 297 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags For TIM start use function HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim) TIM callback void TIM1_UP_TIM10_IRQHandler(void) GPIO LED toggle HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)

296 18 Use TIM as pulse counter 298 Solution TIM start /* USER CODE BEGIN 2 */ HAL_TIM_Base_Start_IT(&htim1); /* USER CODE END 2 */ Callback handling /* USER CODE BEGIN 4 */ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { HAL_GPIO_TogglePin(GPIOG,GPIO_PIN_14); } /* USER CODE END 4 */

297 DAC wave generator lab 19 STM32F42xx Technical Training 15/06/2015

298 19 Use DAC as wave generator 300 Objective Learn how to setup DAC as wave generator in CubeMX How to Generate Code in CubeMX and use HAL functions Goal Configure DAC as wave generator in CubeMX and Generate Code Learn how start it in project

299 19 Use DAC as wave generator 301 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx CubeMX DAC selection Select DAC OUT2

300 19 Use DAC as wave generator 302 CubeMX DAC configuration TAB>Configuration>Analog>DAC>Parametr Settings Enable Output buffer Button OK

301 19 Use DAC as wave generator 303 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

302 19 Use DAC as wave generator 304 Start process DAC generation (same for DMA, ADC) Non blocking start process Peripheral Initializations Start Process HAL_DAC_Start Set value HAL_DAC_SetValue

303 19 Use DAC as wave generator 305 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags and /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */ tags For DAC start use function HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel) DAC set DAC value HAL_DAC_SetValue(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data)

304 19 Use DAC as wave generator 306 Solution DAC setup and start /* USER CODE BEGIN 2 */ HAL_DAC_Start(&hdac,DAC_CHANNEL_2); /* USER CODE END 2 */ Create the wave /* USER CODE BEGIN 3 */ /* Infinite loop */ while (1) { HAL_DAC_SetValue(&hdac, DAC_CHANNEL_2, DAC_ALIGN_12B_R, value_dac); if(value_dac>4095) { value_dac=0; } HAL_Delay(1); } /* USER CODE END 3 */

305 ADC Poll lab 20 STM32F42xx Technical Training 15/06/2015

306 20 Use ADC in polling mode 308 Objective Use the DAC part from previous lab Learn how to setup ADC in CubeMX How to Generate Code in CubeMX and use HAL functions Goal Configure ADC in poll in CubeMX and Generate Code Learn how to start ADC and measure the DAC Verify the measured wave in STMStudio ( require JAVA)

307 20 Use ADC in polling mode 309 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx CubeMX DAC selection Select DAC OUT2 Select ADC IN13

308 20 Use ADC in polling mode 310 Hardware connection Connect DAC out2 PA5 and ADC1 IN13 PC3 together

309 20 Use ADC in polling mode 311 CubeMX ADC configuration TAB>Configuration>Analog>ADC1>Parametr Settings Set ADC1 Set sampling time for CH13 Button OK DAC from previous example

310 20 Use ADC in polling mode 312 Now we set the project details for generation Menu > Project > Project Settings Set the project name Project location Type of toolchain Now we can Generate Code Menu > Project > Generate Code

311 20 Use ADC in polling mode 313 Start process ADC(same for DMA, DAC, TIM) Non blocking start process Peripheral Initializations Start Process HAL_DAC_Start Peripheral Initializations Start Process HAL_DAC_Start

312 20 Use ADC in polling mode 314 Open the project in our IDE The functions we want to put into main.c Between /* USER CODE BEGIN 2 */ and /* USER CODE END 2 */ tags and /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */ tags For DAC start use function HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel) HAL_ADC_PollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout) HAL_ADC_GetValue(ADC_HandleTypeDef* hadc) DAC functions HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel) HAL_DAC_SetValue(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data)

313 20 Solution Variables /* USER CODE BEGIN PV */ uint32_t value_adc; uint32_t value_dac=0; /* USER CODE END PV */ Use ADC in polling mode 315 DAC setup and start /* USER CODE BEGIN 2 */ HAL_DAC_Start(&hdac,DAC_CHANNEL_2); HAL_DAC_SetValue(&hdac, DAC_CHANNEL_2, DAC_ALIGN_12B_R, value_dac); /* USER CODE END 2 */

314 20 Use ADC in polling mode 316 Solution Main loop with DAC set and ADC set /* USER CODE BEGIN 3 */ /* Infinite loop */ while (1) { HAL_ADC_Start(&hadc1); HAL_ADC_PollForConversion(&hadc1,10); value_adc=hal_adc_getvalue(&hadc1); HAL_DAC_SetValue(&hdac, DAC_CHANNEL_2, DAC_ALIGN_12B_R, value_dac); value_dac++; if(value_dac>4095){ value_dac=0; } HAL_Delay(1); } /* USER CODE END 3 */

315 20 Use ADC in polling mode 317 Test the functionality We need the address of variable value_adc This can be found usually in debug mode in watch, my address is 0x C (depends on compilator and optimizations) Start the STMStudio Set the ST Link SWD Right click into Display variable settings Select NEW

316 20 STM studio settings Set value_adc address my 0x C Set 16bit unsigned val Right click on this line Select Send To VarViewer1 Use ADC in polling mode 318

317 20 Use ADC in polling mode 319 STM studio settings Viewers settings is on bottom Set the correct upper value to 4096(12bit)

318 20 STM studio settings Now press green play button And you will see content of value_adc Use ADC in polling mode 320

319 ADC Interrupt lab 21 STM32F42xx Technical Training 15/06/2015

320 21 Use ADC with interrupt 322 Objective Use the DAC part from previous lab Learn how to setup ADC with interrupt in CubeMX How to Generate Code in CubeMX and use HAL functions Goal Configure ADC in interrupt in CubeMX and Generate Code Learn how to start ADC and measure the DAC Verify the measured wave in STMStudio ( require JAVA)

321 21 Use ADC with interrupt 323 Create project in CubeMX Menu > File > New Project Select STM32F4 > STM32F429/439 > LQFP144 > STM32F439ZITx CubeMX DAC selection Select DAC OUT2 Select ADC IN13

322 21 Use ADC with interrupt 324 CubeMX ADC configuration TAB>Configuration>Analog>ADC1>Parametr Settings Set ADC1 Set sampling time for CH13 Button OK DAC from previous example

323 21 CubeMX ADC configuration TAB>NVIC settings Enable ADC1 interrupt Button OK Use ADC with interrupt 325

324 21 Use ADC with interrupt 326 CubeMX NVIC configuration Because we want use the Systick for delay in interrupt The ADC interrupt priority must be changed TAB>Configuration>System>NVIC Change ADC1 preemption priority to 1

Tools Overview. Evaluation Boards Free IDEs. Ecosystem. AC6 CoIDE Keil (M0/M0+) mbed

Tools Overview. Evaluation Boards Free IDEs. Ecosystem. AC6 CoIDE Keil (M0/M0+) mbed STM32 USP Hands On Tools Overview 2 Evaluation Boards Free IDEs AC6 CoIDE Keil (M0/M0+) mbed Ecosystem STM32CubeMX STLink Utility ST Visual Programmer (STVP) STM32 Flash Loader Demonstrator Dfuse STM Studio

More information

AN2585 Application note

AN2585 Application note AN2585 Application note Application examples of the STM32F101xx and STM32F103xx core and system peripherals Introduction The STM32F10xxx is built around the latest Cortex -M3 core from ARM designed for

More information

STM bit ARM Cortex MCUs STM32F030 Series

STM bit ARM Cortex MCUs STM32F030 Series STM32 32-bit ARM Cortex MCUs STM32F030 Series ST has licensed Cortex-M processors 2 Forget traditional 8/16/32-bit classifications and get Seamless architecture across all applications Every product optimized

More information

Hello, and welcome to this presentation of the STM32 Reset and Clock Controller.

Hello, and welcome to this presentation of the STM32 Reset and Clock Controller. Hello, and welcome to this presentation of the STM32 Reset and Clock Controller. 1 The RCC controller integrated inside STM32 products manages system and peripheral clocks. STM32F7 devices embed two internal

More information

STM32L4 System operating modes

STM32L4 System operating modes STM32L4 System operating modes Typical application profile 2 Tperiod Tperiod I DD Process IRQ ACTIVE IRQ ACTIVE OFF STARTUP INITIALIZATION TASKS Tasks TASKS INACTIVE INACTIVE INACTIVE Application phases:

More information

STM32SnippetsL0. STM32L0xx Snippets firmware package. Features. Description

STM32SnippetsL0. STM32L0xx Snippets firmware package. Features. Description STM32L0xx Snippets firmware package Data brief Features Complete free C source code firmware examples for STM32L0xx microcontrollers Basic examples using direct-access registers as defined in CMSIS Cortex

More information

Hello, and welcome to this presentation of the STM32 Low Power Universal Asynchronous Receiver/Transmitter interface. It covers the main features of

Hello, and welcome to this presentation of the STM32 Low Power Universal Asynchronous Receiver/Transmitter interface. It covers the main features of Hello, and welcome to this presentation of the STM32 Low Power Universal Asynchronous Receiver/Transmitter interface. It covers the main features of this interface, which is widely used for serial communications.

More information

AN3268 Application note

AN3268 Application note Application note STM32VLDISCOVERY firmware package Introduction The purpose of this application note is to describe the STM32VLDISCOVERY package structure and provide short descriptions of: STM32VLDISCOVERY

More information

Designing with STM32F2x & STM32F4

Designing with STM32F2x & STM32F4 Designing with STM32F2x & STM32F4 Course Description Designing with STM32F2x & STM32F4 is a 3 days ST official course. The course provides all necessary theoretical and practical know-how for start developing

More information

AN4749 Application note

AN4749 Application note Application note Managing low-power consumption on STM32F7 Series microcontrollers Introduction The STM32F7 Series microcontrollers embed a smart architecture taking advantage of the ST s ART- accelerator

More information

The course provides all necessary theoretical and practical know-how for start developing platforms based on STM32L4 family.

The course provides all necessary theoretical and practical know-how for start developing platforms based on STM32L4 family. Designing with STM32L4 Family Course Description Designing with STM32L4 is a 3 days ST official course. The course provides all necessary theoretical and practical know-how for start developing platforms

More information

STM32F4 Introduction F1/F2/F4 Comparison Features Highlight

STM32F4 Introduction F1/F2/F4 Comparison Features Highlight STM32F4 Introduction F1/F2/F4 Comparison Features Highlight February 20 th 2012 2 Content Product family overview F1/F2/F4 features comparisons Features highlight Boot & Remap feature RTC calibration &

More information

TEVATRON TECHNOLOGIES PVT. LTD Embedded! Robotics! IoT! VLSI Design! Projects! Technical Consultancy! Education! STEM! Software!

TEVATRON TECHNOLOGIES PVT. LTD Embedded! Robotics! IoT! VLSI Design! Projects! Technical Consultancy! Education! STEM! Software! Summer Training 2016 Advance Embedded Systems Fast track of AVR and detailed working on STM32 ARM Processor with RTOS- Real Time Operating Systems Covering 1. Hands on Topics and Sessions Covered in Summer

More information

Hello, and welcome to this presentation of the STM32L4 power controller. The STM32L4 s power management functions and all power modes will also be

Hello, and welcome to this presentation of the STM32L4 power controller. The STM32L4 s power management functions and all power modes will also be Hello, and welcome to this presentation of the STM32L4 power controller. The STM32L4 s power management functions and all power modes will also be covered in this presentation. 1 Please note that this

More information

Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features

Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features of this USART interface, which is widely used for serial

More information

Interconnects, Memory, GPIO

Interconnects, Memory, GPIO Interconnects, Memory, GPIO Dr. Francesco Conti f.conti@unibo.it Slide contributions adapted from STMicroelectronics and from Dr. Michele Magno, others Processor vs. MCU Pipeline Harvard architecture Separate

More information

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction.

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction. AVR XMEGA TM Product Introduction 32-bit AVR UC3 AVR Flash Microcontrollers The highest performance AVR in the world 8/16-bit AVR XMEGA Peripheral Performance 8-bit megaavr The world s most successful

More information

STM32F7 series ARM Cortex -M7 powered Releasing your creativity

STM32F7 series ARM Cortex -M7 powered Releasing your creativity STM32F7 series ARM Cortex -M7 powered Releasing your creativity STM32 high performance Very high performance 32-bit MCU with DSP and FPU The STM32F7 with its ARM Cortex -M7 core is the smartest MCU and

More information

AN4515 Application note

AN4515 Application note Application note Using Batch Acquisition Mode (BAM) to maximize power efficiency on STM32F410/411/412 microcontroller lines Introduction The STM32F410, STM32F411 and STM32F412 lines are part of the STM32

More information

AN2606 Application note

AN2606 Application note Application note STM32 microcontroller system memory boot mode Introduction The bootloader is stored in the internal boot ROM memory (system memory) of STM32 devices. It is programmed by ST during production.

More information

Welcome to this presentation of the STM32 direct memory access controller (DMA). It covers the main features of this module, which is widely used to

Welcome to this presentation of the STM32 direct memory access controller (DMA). It covers the main features of this module, which is widely used to Welcome to this presentation of the STM32 direct memory access controller (DMA). It covers the main features of this module, which is widely used to handle the STM32 peripheral data transfers. 1 The Direct

More information

STM32 F0 Value Line. Entry-level MCUs

STM32 F0 Value Line. Entry-level MCUs STM32 F0 Value Line Entry-level MCUs Key Messages 2 STM32 F0: Is the Cortex -M0 core generated with ST s STM32 DNA, for cost sensitive designs. The STM32 F0 is benefiting of STM32 DNA, providing the essential

More information

Introducing STM32 L0x Series. April

Introducing STM32 L0x Series. April Introducing STM32 L0x Series April 2014 www.emcu.it 20- to 80pins 20- to 100pins 48- to 144pins Memory size (Bytes) ST s Ultra-low-power Continuum (1/2) 2 512K 256K 192K STM32L0 Cortex TM -M0+ STM32L1

More information

STM32Cube TM Introduction

STM32Cube TM Introduction STM32Cube Overview STM32Cube TM Introduction 2 STMCube TM is an STMicroelectronics original initiative to ease developers life By reducing development efforts By reducing development time By reducing development

More information

Product Technical Brief S3C2412 Rev 2.2, Apr. 2006

Product Technical Brief S3C2412 Rev 2.2, Apr. 2006 Product Technical Brief S3C2412 Rev 2.2, Apr. 2006 Overview SAMSUNG's S3C2412 is a Derivative product of S3C2410A. S3C2412 is designed to provide hand-held devices and general applications with cost-effective,

More information

Embedded Programming with ARM Cortex-M3 Basic Experiments 1

Embedded Programming with ARM Cortex-M3 Basic Experiments 1 Embedded Programming with ARM Cortex-M3 Basic Experiments 1 Alan Xiao, Ph.D Handheld Scientific, Inc. qiwei@handheldsci.com Today s Topics Basics (with the Discovery board): 1. General Input/Output (GPIO)

More information

Universität Dortmund. MCUs Low-Power Features

Universität Dortmund. MCUs Low-Power Features MCUs Low-Power Features Why Low Power Is so Important for MCUs? Longer battery life Smaller products Simpler power supplies Less EMI simplifies PCB Permanent battery Reduced liability Power as a Design

More information

AVR XMEGA TM. A New Reference for 8/16-bit Microcontrollers. Ingar Fredriksen AVR Product Marketing Director

AVR XMEGA TM. A New Reference for 8/16-bit Microcontrollers. Ingar Fredriksen AVR Product Marketing Director AVR XMEGA TM A New Reference for 8/16-bit Microcontrollers Ingar Fredriksen AVR Product Marketing Director Kristian Saether AVR Product Marketing Manager Atmel AVR Success Through Innovation First Flash

More information

Hello, and welcome to this presentation of the STM32L4 System Configuration Controller.

Hello, and welcome to this presentation of the STM32L4 System Configuration Controller. Hello, and welcome to this presentation of the STM32L4 System Configuration Controller. 1 Please note that this presentation has been written for STM32L47x/48x devices. The key differences with other devices

More information

STM32L4+ MCU series Excellence in ultra-low-power with more performance

STM32L4+ MCU series Excellence in ultra-low-power with more performance STM32L4+ MCU series Excellence in ultra-low-power with more performance Key messages of STM32 L4+ series 2 + More performance and still ULP leader ST has stretched the STM32L4 architecture to reach 150

More information

AN4809 Application note

AN4809 Application note Application note Migrating between STM32L0 Series and STM32L4 Series / STM32L4+ Series microcontrollers Introduction For the designers of STM32 microcontroller applications, being able to easily replace

More information

ARM Cortex core microcontrollers 12 th Energy efficient operation

ARM Cortex core microcontrollers 12 th Energy efficient operation ARM Cortex core microcontrollers 12 th Energy efficient operation Balázs Scherer Budapest University of Technology and Economics Department of Measurement and Information Systems BME-MIT 2017 The importance

More information

Advanced Microcontrollers Grzegorz Budzyń Extras: STM32F4Discovery

Advanced Microcontrollers Grzegorz Budzyń Extras: STM32F4Discovery Advanced Microcontrollers Grzegorz Budzyń Extras: STM32F4Discovery Plan STM32F4Discovery module STM32F407 description STM32F4Discovery STM32F4Discovery Easily availble(farnell), cheap(~15 EUR) and powerful

More information

STM8L and STM32 L1 series. Ultra-low-power platform

STM8L and STM32 L1 series. Ultra-low-power platform STM8L and STM32 L1 series Ultra-low-power platform 8-bit and 32-bit MCU families 2 Flash (bytes) 2 M 1 M 128 K 16 K 8-bit Core STM8S Mainstream STM8A F and STM8AL Automotive STM8L Ultra-low-power 32-bit

More information

Arduino Uno R3 INTRODUCTION

Arduino Uno R3 INTRODUCTION Arduino Uno R3 INTRODUCTION Arduino is used for building different types of electronic circuits easily using of both a physical programmable circuit board usually microcontroller and piece of code running

More information

Product Technical Brief S3C2413 Rev 2.2, Apr. 2006

Product Technical Brief S3C2413 Rev 2.2, Apr. 2006 Product Technical Brief Rev 2.2, Apr. 2006 Overview SAMSUNG's is a Derivative product of S3C2410A. is designed to provide hand-held devices and general applications with cost-effective, low-power, and

More information

STM32F3 Hands-On Workshop

STM32F3 Hands-On Workshop STM32F3 Hands-On Workshop Ensure you picked-up Welcome Hands-On 2 USB Flash Drive with STM32F3 Discovery Kit Contents USB Cable STM32F3-Discovery Kit will be provided after software is loaded Keil uvision

More information

AK-STM32-ETH Development Board

AK-STM32-ETH Development Board AK-STM32-ETH Development Board Reference manual Copyright 2011 Artekit Italy All rights reserved Contents About this document... 3 Revision history... 3 Contact information... 3 Life support policy...

More information

STM32F7 series ARM Cortex -M7 powered Releasing your creativity

STM32F7 series ARM Cortex -M7 powered Releasing your creativity STM32F7 series ARM Cortex -M7 powered Releasing your creativity STM32 high performance Very high performance 32-bit MCU with DSP and FPU The STM32F7 with its ARM Cortex -M7 core is the smartest MCU and

More information

Reset and clock control (RCC)

Reset and clock control (RCC) Reset and clock control (RCC) RESET Sources 86 System RESET Resets all registers except some RCC registers, PWR registers and Backup domain Sources Low level on the NRST pin (External Reset) WWDG event

More information

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso Microcontroller It is essentially a small computer on a chip Like any computer, it has memory,

More information

STG - STM32 + FreeRTOS + LwIP/EmWin

STG - STM32 + FreeRTOS + LwIP/EmWin Formation STM32 + FreeRTOS + LwIP/EmWin: This course covers the STM32 ARM-based MCU family, the FreeRTOS Real Time OS, the LWIP TCP/IP Stack and/or the EmWin GUI Stack - Processeurs ARM: ST processors

More information

Hello, and welcome to this presentation of the STM32 Real- Time Clock. It covers the main features of this peripheral, which is used to provide a

Hello, and welcome to this presentation of the STM32 Real- Time Clock. It covers the main features of this peripheral, which is used to provide a Hello, and welcome to this presentation of the STM32 Real- Time Clock. It covers the main features of this peripheral, which is used to provide a very accurate time base. 1 The RTC peripheral features

More information

STM32G070CB/KB/RB. Arm Cortex -M0+ 32-bit MCU, 128 KB Flash, 36 KB RAM, 4x USART, timers, ADC, comm. I/Fs, V. Features

STM32G070CB/KB/RB. Arm Cortex -M0+ 32-bit MCU, 128 KB Flash, 36 KB RAM, 4x USART, timers, ADC, comm. I/Fs, V. Features STM32G070CB/KB/RB Arm Cortex -M0+ 32-bit MCU, 128 KB Flash, 36 KB RAM, 4x USART, timers, ADC, comm. I/Fs, 2.0-3.6V Datasheet - production data Features Core: Arm 32-bit Cortex -M0+ CPU, frequency up to

More information

Hello, and welcome to this presentation of the STM32 I²C interface. It covers the main features of this communication interface, which is widely used

Hello, and welcome to this presentation of the STM32 I²C interface. It covers the main features of this communication interface, which is widely used Hello, and welcome to this presentation of the STM32 I²C interface. It covers the main features of this communication interface, which is widely used to connect devices such as microcontrollers, sensors,

More information

STM32 Ecosystem workshop. T.O.M.A.S Team

STM32 Ecosystem workshop. T.O.M.A.S Team STM Ecosystem workshop T.O.M.A.S Team 2 Now it is time for some activities with STMCubeMX again Our current goal is to port provided ready project done for NUCLEO-L053R8 board (STML053R8T6 microcontroller)

More information

LPC4370FET256. Features and benefits

LPC4370FET256. Features and benefits Page 1 of 5 LPC4370FET256 32-bit ARM Cortex-M4 + 2 x M0 MCU; 282 kb SRAM; Ethernet;two HS USBs; 80 Msps 12-bit ADC; configurable peripherals The LPC4370 are ARM Cortex-M4 based microcontrollers for embedded

More information

ARM Cortex-M4 Architecture and Instruction Set 1: Architecture Overview

ARM Cortex-M4 Architecture and Instruction Set 1: Architecture Overview ARM Cortex-M4 Architecture and Instruction Set 1: Architecture Overview M J Brockway January 25, 2016 UM10562 All information provided in this document is subject to legal disclaimers. NXP B.V. 2014. All

More information

STM32 F-2 series High-performance Cortex-M3 MCUs

STM32 F-2 series High-performance Cortex-M3 MCUs STM32 F-2 series High-performance Cortex-M3 MCUs STMicroelectronics 32 bit microcontrollers, 120 MHz/150 DMIPS with ART Accelerator TM and advanced peripherals www.st.com/stm32 STM32 F-2 series The STM32

More information

AN5123 Application note

AN5123 Application note Application note STSPIN32F0A - bootloader and USART protocol Introduction Cristiana Scaramel The STSPIN32F0A is a system-in-package providing an integrated solution suitable for driving three-phase BLDC

More information

AN4311 Application note

AN4311 Application note Application note Assessing STM32L1 Series current consumption Introduction The STMicroelectronics ARM Cortex -M3 based STM32L1 series uses ST s proprietary ultra-low-leakage process technology with an

More information

AN4809 Application note

AN4809 Application note AN4809 Application note Migrating between STM32L0 Series and STM32L4 Series / STM32L4+ Series microcontrollers Introduction For the designers of STM32 microcontroller applications, being able to easily

More information

Microcontrollers: Lecture 2 Low power Modes, Buses, Memory, GPIOs. Michele Magno

Microcontrollers: Lecture 2 Low power Modes, Buses, Memory, GPIOs. Michele Magno Microcontrollers: Lecture 2 Low power Modes, Buses, Memory, GPIOs Michele Magno 1 Calendar 07.04.2016: Power consumption; Low power States; Buses, Memory, GPIOs 08.04.2016 Interrupts, Timers, ADC, DAC

More information

Xynergy It really makes the difference!

Xynergy It really makes the difference! Xynergy It really makes the difference! STM32F217 meets XILINX Spartan-6 Why Xynergy? Very easy: There is a clear Synergy achieved by combining the last generation of the most popular ARM Cortex-M3 implementation

More information

AN5200. Getting started with STM32H7 Series SDMMC host controller. Application note. Introduction

AN5200. Getting started with STM32H7 Series SDMMC host controller. Application note. Introduction Application note Getting started with STM32H7 Series SDMMC host controller Introduction The SDMMC (secure digital multimedia card) host interface in the STM32H7 Series provides an interface between the

More information

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1 M68HC08 Microcontroller The MC68HC908GP32 Babak Kia Adjunct Professor Boston University College of Engineering Email: bkia -at- bu.edu ENG SC757 - Advanced Microprocessor Design General Description The

More information

Hello, and welcome to this presentation of the STM32F7 System Configuration Controller.

Hello, and welcome to this presentation of the STM32F7 System Configuration Controller. Hello, and welcome to this presentation of the STM32F7 System Configuration Controller. 1 STM32F7 microcontrollers feature a set of configuration registers. The System Configuration Controller gives access

More information

STM32: Peripherals. Alberto Bosio November 29, Univeristé de Montpellier

STM32: Peripherals. Alberto Bosio November 29, Univeristé de Montpellier STM32: Peripherals Alberto Bosio bosio@lirmm.fr Univeristé de Montpellier November 29, 2017 System Architecture 2 System Architecture S0: I-bus: This bus connects the Instruction bus of the Cortex-M4 core

More information

STM32 Ecosystem workshop. T.O.M.A.S Team

STM32 Ecosystem workshop. T.O.M.A.S Team STM32 Ecosystem workshop T.O.M.A.S Team 2 Now it is a right time for some slides We will present briefly what is STM32CubeMX and the structure of the Cube library What it is STM32CubeMX? STM32CubeMX application

More information

AN Migrating to the LPC1700 series

AN Migrating to the LPC1700 series Rev. 01 6 October 2009 Application note Document information Info Keywords Abstract Content LPC1700, Migration, LPC2300/2400, ARM7, Cortex-M3 This application note introduces the important features of

More information

STM32L052x6 STM32L052x8

STM32L052x6 STM32L052x8 Ultra-low-power 32-bit MCU ARM-based Cortex-M0+, up to 64 KB Flash, 8 KB SRAM, 2 KB EEPROM, USB, ADC Data brief Features Ultra-low-power platform 1.65 V to 3.6 V power supply -40 to 105/125 C temperature

More information

KL03 Product Brief Supports all KL03 devices

KL03 Product Brief Supports all KL03 devices Freescale Semiconductor Document Number:KL03PB Product Brief Rev 3, 07/2014 KL03 Product Brief Supports all KL03 devices 1 KL03 sub-family introduction The device is highly-integrated, market leading ultra

More information

STM32F429 Overview. Steve Miller STMicroelectronics, MMS Applications Team October 26 th 2015

STM32F429 Overview. Steve Miller STMicroelectronics, MMS Applications Team October 26 th 2015 STM32F429 Overview Steve Miller STMicroelectronics, MMS Applications Team October 26 th 2015 Today - STM32 portfolio positioning 2 More than 30 product lines High-performance 398 CoreMark 120 MHz 150 DMIPS

More information

ARDUINO MEGA INTRODUCTION

ARDUINO MEGA INTRODUCTION ARDUINO MEGA INTRODUCTION The Arduino MEGA 2560 is designed for projects that require more I/O llines, more sketch memory and more RAM. With 54 digital I/O pins, 16 analog inputs so it is suitable for

More information

Microcontroller basics

Microcontroller basics FYS3240 PC-based instrumentation and microcontrollers Microcontroller basics Spring 2017 Lecture #4 Bekkeng, 30.01.2017 Lab: AVR Studio Microcontrollers can be programmed using Assembly or C language In

More information

Introduction to ARM LPC2148 Microcontroller

Introduction to ARM LPC2148 Microcontroller Introduction to ARM LPC2148 Microcontroller Dr.R.Sundaramurthy Department of EIE Pondicherry Engineering College Features of LPC2148 in a Nut Shell CPU = ARM 7 Core Word Length = 32 Bit ROM = 512 KB RAM

More information

STM32 Cortex-M3 STM32F STM32L STM32W

STM32 Cortex-M3 STM32F STM32L STM32W STM32 Cortex-M3 STM32F STM32L STM32W 01 01 STM32 Cortex-M3 introduction to family 1/2 STM32F combine high performance with first-class peripherals and lowpower, low-voltage operation. They offer the maximum

More information

STM32G0 MCU Series Efficiency at its Best

STM32G0 MCU Series Efficiency at its Best STM32G0 MCU Series Efficiency at its Best Key Messages of STM32G0 Series 2 2 3 Efficient Arm Cortex -M0+ at 64 MHz Compact cost: maximum I/Os count Best RAM/Flash Ratio Smallest possible package down to

More information

Universität Dortmund. IO and Peripheral Interfaces

Universität Dortmund. IO and Peripheral Interfaces IO and Peripheral Interfaces Microcontroller System Architecture Each MCU (micro-controller unit) is characterized by: Microprocessor 8,16,32 bit architecture Usually simple in-order microarchitecture,

More information

2-Oct-13. the world s most energy friendly microcontrollers and radios

2-Oct-13.  the world s most energy friendly microcontrollers and radios 1 2 3 EFM32 4 5 LESENSE Low Energy Sensor Interface Autonomous sensing in Deep Sleep LESENSE with central control logic ACMP for sensor input DAC for reference generation Measure up to 16 sensors Inductive

More information

Getting Started With the Stellaris EK-LM4F120XL LaunchPad Workshop. Version 1.05

Getting Started With the Stellaris EK-LM4F120XL LaunchPad Workshop. Version 1.05 Getting Started With the Stellaris EK-LM4F120XL LaunchPad Workshop Version 1.05 Agenda Introduction to ARM Cortex Cortex -M4F M4F and Peripherals Code Composer Studio Introduction to StellarisWare, I iti

More information

Unlocking the Potential of Your Microcontroller

Unlocking the Potential of Your Microcontroller Unlocking the Potential of Your Microcontroller Ethan Wu Storming Robots, Branchburg NJ, USA Abstract. Many useful hardware features of advanced microcontrollers are often not utilized to their fullest

More information

Product Technical Brief S3C2440X Series Rev 2.0, Oct. 2003

Product Technical Brief S3C2440X Series Rev 2.0, Oct. 2003 Product Technical Brief S3C2440X Series Rev 2.0, Oct. 2003 S3C2440X is a derivative product of Samsung s S3C24XXX family of microprocessors for mobile communication market. The S3C2440X s main enhancement

More information

XNUCLEO-F030R8, Improved STM32 NUCLEO Board

XNUCLEO-F030R8, Improved STM32 NUCLEO Board XNUCLEO-F030R8, Improved STM32 NUCLEO Board STM32 Development Board, Supports Arduino, Compatible with NUCLEO-F030R8 XNUCLEO-F030R8 Features Compatible with NUCLEO-F030R8, onboard Cortex-M0 microcontroller

More information

Exceptions and Interrupts ARM Cortex M3

Exceptions and Interrupts ARM Cortex M3 Exceptions and Interrupts ARM Cortex M3 ผศ.ดร. ส ร นทร ก ตต ธรก ล และ อ.สรย ทธ กลมกล อม 1 Introduction! Exception are events! They occur during the execution of the program! ARM exceptions! Exceptions

More information

AN4675 Application note

AN4675 Application note Application note Migration of microcontroller applications from STM32F42xxx/STM32F43xxx to STM32F469xx/STM32F479xx Introduction For more and more applications using STM32 products, it is important to migrate

More information

Product Brief Supports all SKEA64 devices

Product Brief Supports all SKEA64 devices Freescale Semiconductor Document Number:SKEA64PB Product Brief Rev 1.1, 02/2014 Product Brief Supports all SKEA64 devices 1 Kinetis EA series Kinetis EA series provide the highly scalable portfolio of

More information

EFM32 Series 0: DMA (ARM PrimeCell µdma PL230)

EFM32 Series 0: DMA (ARM PrimeCell µdma PL230) EFM32 Series 0: DMA (ARM PrimeCell µdma PL230) EFM32 - DMA DMA has read/write access to most of the EFM32 memory map Flash writes can not be done in memory map, but through sequenced writes to peripheral

More information

STM8AF6213 STM8AF6223/26 Errata sheet

STM8AF6213 STM8AF6223/26 Errata sheet STM8F6213 STM8F6223/26 Errata sheet Device limitations for STM8F62xx automotive MCUs featuring up to 8 Kbytes of Flash program memory Silicon identification This errata sheet applies to the STMicroelectronics

More information

AN4325 Application note

AN4325 Application note Application note Getting started with STM32F030xx and STM32F070xx series hardware development Introduction This application note is intended for system designers who require a hardware implementation overview

More information

Military Grade SmartFusion Customizable System-on-Chip (csoc)

Military Grade SmartFusion Customizable System-on-Chip (csoc) Military Grade SmartFusion Customizable System-on-Chip (csoc) Product Benefits 100% Military Temperature Tested and Qualified from 55 C to 125 C Not Susceptible to Neutron-Induced Configuration Loss Microcontroller

More information

STM32 F2 series High performance Cortex M3 MCUs

STM32 F2 series High performance Cortex M3 MCUs STM32 F2 series High performance Cortex M3 MCUs STMicroelectronics 32 bit microcontrollers, 120 MHz/150 DMIPS with ART Accelerator TM and advanced peripherals www.st.com/stm32 STM32 F2 series The STM32

More information

HZX N03 Bluetooth 4.0 Low Energy Module Datasheet

HZX N03 Bluetooth 4.0 Low Energy Module Datasheet HZX-51822-16N03 Bluetooth 4.0 Low Energy Module Datasheet SHEN ZHEN HUAZHIXIN TECHNOLOGY LTD 2017.7 NAME : Bluetooth 4.0 Low Energy Module MODEL NO. : HZX-51822-16N03 VERSION : V1.0 1.Revision History

More information

ATmega128. Introduction

ATmega128. Introduction ATmega128 Introduction AVR Microcontroller 8-bit microcontroller released in 1997 by Atmel which was founded in 1984. The AVR architecture was conceived by two students (Alf-Egil Bogen, Vergard-Wollen)

More information

KE02 Sub-Family Product Brief Supports all KE02 devices with 40 MHz core

KE02 Sub-Family Product Brief Supports all KE02 devices with 40 MHz core Freescale Semiconductor Document Number:KE02M40PB Product Brief Rev 2, 3/2014 KE02 Sub-Family Product Brief Supports all KE02 devices with 40 MHz core 1 Kinetis E series Kinetis E series provide the highly

More information

Product Brief Supports all SKEA8 devices

Product Brief Supports all SKEA8 devices Freescale Semiconductor Document Number:SKEA8PB Product Brief Rev 1.1, 02/2014 Product Brief Supports all SKEA8 devices 1 Kinetis EA series Kinetis EA series provide the highly scalable portfolio of ARM

More information

Realtek Ameba-1 Power Modes

Realtek Ameba-1 Power Modes Realtek Ameba-1 Power Modes Table of Contents 1 Power State... 3 1.1 Deep Sleep Mode... 3 1.2 Deep Standby Mode... 4 1.3 Sleep Mode... 4 1.3.1 Wakeup from sleep mode by UART... 4 1.3.1.1 Solution A, select

More information

Value-line ARM -based 32-bit MCU with up to 256 KB Flash, timers, ADC, communication interfaces, V operation

Value-line ARM -based 32-bit MCU with up to 256 KB Flash, timers, ADC, communication interfaces, V operation Features STM32F030x4 STM32F030x6 STM32F030x8 STM32F030xC Value-line ARM -based 32-bit MCU with up to 256 KB Flash, timers, ADC, communication interfaces, 2.4-3.6 V operation Datasheet - production data

More information

Product Technical Brief S3C2416 May 2008

Product Technical Brief S3C2416 May 2008 Product Technical Brief S3C2416 May 2008 Overview SAMSUNG's S3C2416 is a 32/16-bit RISC cost-effective, low power, high performance micro-processor solution for general applications including the GPS Navigation

More information

STM32 Journal. In this Issue:

STM32 Journal. In this Issue: Volume 1, Issue 2 In this Issue: Bringing 32-bit Performance to 8- and 16-bit Applications Developing High-Quality Audio for Consumer Electronics Applications Bringing Floating-Point Performance and Precision

More information

Product Brief Supports all SKEA128 devices

Product Brief Supports all SKEA128 devices Freescale Semiconductor Document Number:SKEA128PB Product Brief Rev 1.1, 02/2014 Product Brief Supports all SKEA128 devices 1 Kinetis EA series Kinetis EA series provide the highly scalable portfolio of

More information

Hello, and welcome to this presentation of the STM32 general-purpose IO interface. It covers the general-purpose input and output interface and how

Hello, and welcome to this presentation of the STM32 general-purpose IO interface. It covers the general-purpose input and output interface and how Hello, and welcome to this presentation of the STM32 general-purpose IO interface. It covers the general-purpose input and output interface and how it allows connectivity to the environment around the

More information

CN310 Microprocessor Systems Design

CN310 Microprocessor Systems Design CN310 Microprocessor Systems Design Microcontroller Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3 Microprocessor

More information

STM32x. tec.pres. STM32 ARM CortexTM-M3 Based Product Introduction

STM32x. tec.pres. STM32 ARM CortexTM-M3 Based Product Introduction STM32x tec.pres. STM32 ARM CortexTM-M3 Based Product Introduction 0101 STM32x Cortex M3 Hierarchical processor integrating core and advanced system peripherals Cortex-M3 core Harvard architecture 3-stage

More information

AN4666 Application note

AN4666 Application note Application note Parallel synchronous transmission using GPIO and DMA Introduction The STM32 MCUs are able to emulate a parallel synchronous communication through the GPIO interface, using the embedded

More information

to ARM Cortex TM -M3 October 17, 2007 MCD Application Team

to ARM Cortex TM -M3 October 17, 2007 MCD Application Team Introduction to ARM Cortex TM -M3 October 17, 2007 MCD Application Team CONTENTS Introduction to the Cortex-M3 Architecture Overview Comparison to ARM7 Bit Banding and Unaligned data access Interrupt and

More information

STM32 F4 Series Cortex M4 http://www.emcu.it/stm32f4xx/stm32f4xx.html www.emcu.it STM32 F4 Main common features Cortex -M4 (DSP + FPU) STM32F429/439 180 MHz 1 to 2-MB Flash 256-KB SRAM STM32F427/437 180

More information

KLx7 Product Brief Supports all KLx7 devices

KLx7 Product Brief Supports all KLx7 devices Freescale Semiconductor Document Number:KLX7PB Product Brief Rev 0, 08/2014 KLx7 Product Brief Supports all KLx7 devices 1 KLx7 family introduction The device is highly-integrated, market leading ultra

More information

[MG2420] MCU Module Datasheet. (No. ADS0705) V1.0

[MG2420] MCU Module Datasheet. (No. ADS0705) V1.0 [MG2420] MCU Module Datasheet (No. ADS0705) V1.0 REVISION HISTORY Version Date Description VER.1.0 2013.10.22 First version release. V1.0 Page:2/17 CONTENTS 1. INTRODUCTION... 4 1.1. DEFINITIONS... 4 2.

More information

PC87435 Enhanced IPMI Baseboard Management Controller

PC87435 Enhanced IPMI Baseboard Management Controller April 2003 Revision 1.01 PC87435 Enhanced IPMI Baseboard Management Controller General Description The PC87435 is a highlyintegrated Enhanced IPMI Baseboard Management Controller (BMC), or satellite management

More information