STM32 Get the address of the register

Publisher:zhuanshiLatest update time:2018-12-28 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

If you need to use DMA transmission of TX1, it will involve configuring the peripheral address of DMA. Here, the peripheral address should be the address of DR register of USART1. But how to get the address of this register?


We have tested three methods and all of them are feasible.


method 1:


Directly query the register map in the manual, the DR address of USART1 is 0x40013804


Method 2:


According to the manual, the offset address of the DR register is 0X04, so the DR address of USART1 can be written as (USART1_BASE + 0X04).


Among them, USART1_BASE is defined in stm32f10xb.h

#define USART1_BASE (APB2PERIPH_BASE + 0x00003800U)


Method 3:


If we want to modify the value of DR to 0X03, we will write: USART1->DR = 0X03, then the address of DR is (uint32_t)(&USART1->DR)


The last method is the most pleasing and intuitive.


Keywords:STM32 Reference address:STM32 Get the address of the register

Previous article:STM32 uses PWM + DMA to drive WS2812
Next article:Detailed explanation of the priority setting method of stm32 tick clock SYStick

Recommended ReadingLatest update time:2024-11-23 11:58

STM32 RTC clock configuration
1. RTC Instructions    "RTC" is the abbreviation of Real Time Clock, which means real-time clock. STM32 provides a second interrupt source and an alarm interrupt source. Modifying the value of the counter can reset the current time and date of the system.    The reason why the RTC module has the real-time clock funct
[Microcontroller]
Design of two-phase stepper motor subdivision driver based on STM32
The stepper motor is a widely used control motor, which is characterized by the ability to perform speed control and positioning control without using a position feedback loop, which is the so-called motor open-loop control. Compared with servo motors, stepper motors have the advantages of low cost and simple contr
[Microcontroller]
Design of two-phase stepper motor subdivision driver based on STM32
Difference between DSP and STM32
The difference between DSP and ordinary 51 AVR and STM32      DSP is a chip designed for computing. Its most powerful feature is its numerical computing performance, which is supported by its instruction set. Forget about comparing DSP and STM32. If you are familiar with both, you will know that there is no comparison
[Microcontroller]
STM32 power management and low power mode
7.1 Power Management Overview Processors make extensive use of clock gating to disable inputs to unused functions and blocks, so that only the clocks that are being used are Dynamic power is consumed only by logic that is actively in use. The ARMv7-M architecture supports a system sleep mode that stops the Cortex-M3 a
[Microcontroller]
STM32 power management and low power mode
STM32IO and timer mapping to address
Significance: Sometimes when we operate multiple STM32 IOs, the hardware design may not be regular, such as the output pins are: PB3, PC4, PC5, PD0, but the operations of these pins have commonalities, or we want to use for(it i = 0; i 4; i++) to operate these pins like an array, the program will become very concise,
[Microcontroller]
STM32 learning memory and bus architecture
Four driver units: D-bus and S-bus of context-M3 core, general DMA1 and general DMA2. Four driven units: internal FLASH (internal mountain village memory), internal SRAM, FSMC, AHB to APB bridge AHP2APBx. The ICode bus is the bus that connects the context-M3 and the internal flash FLASH instruction interface, and impl
[Microcontroller]
STM32 USB routine modification steps
The following is a summary of what I learned when I modified ST's Custom_HID routine into a "custom USB device" routine. Because I have just started learning USB development, some misunderstandings are inevitable. Please correct me if I misunderstand them.       1. usb_desc.c file Modify it according to the
[Microcontroller]
Red light therapy device control system based on STM32
1. Determination of STM32 ADC sampling frequency First look at some information to determine the clock of the STM32 ADC: (1) The ADCCLK clock provided by the clock controller is synchronized with PCLK2 (APB2 clock). The CLK controller provides a dedicated programmable prescaler for the ADC clock. (2)
[Microcontroller]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号