1. Initialization of i.MX6ULL
①、Enable clock
Enable clock. The seven registers CCGR0-CCGR6 control the enable of all peripheral clocks of i.MX6ULL. For simplicity, set all seven registers CCGR0-CCGR6 to 0xFFFFFFFF, which is equivalent to enabling all peripheral clocks.
CCGR0:
CCGR1:
CCGR2:
CCGR3:
CCGR4:
CCGR5:
CCGR6:
The assembly enables all peripheral clocks:
②、Configure GPIO_I003 PIN multiplexing as GPIO
Set bit3-0 of IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03 to 0101, so that GPIO_IO03 is multiplexed as GPIO
Assembly implementation:
③、Configure the electrical properties of IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03
Set the electrical properties of register IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03, including slew rate, speed, drive capability, open drain, pull-up and pull-down, etc.
Assembly code implementation:
④. Configure GPIO function and set input and output
Set GPIO1_GDIR register bit3 to 1, that is, set it to output mode
Assembly implementation:
⑤、Set bit3 of GPIO_DR register, 1 means output high level, 0 means output low level
Assembly implementation:
The entire assembly code (.s file):
.global _start @Global label
_start:
/*Enable all peripheral clocks*/
LDR R0 , =0x020c4068 @CCGR0
LDR R1, =0xffffffff @To write data to CCGR0
STR R1, [R0] @Write the value of R1 into R0
LDR R0 , =0x020c406c @CCGR1
STR R1 ,[R0]
LDR R0 , =0x020c4070 @CCGR1
STR R1 ,[R0]
LDR R0 , =0x020c4074 @CCGR1
STR R1 ,[R0]
LDR R0 , =0x020c4078 @CCGR1
STR R1 ,[R0]
LDR R0 , =0x020c407c @CCGR1
STR R1 ,[R0]
LDR R0 , =0x020c4080 @CCGR1
STR R1 ,[R0]
/*Configure GPIO_I003 PIN multiplexing as GPIO
* IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03 = 0101 = 5
* The address of IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03 register is 0x020E_0068
*/
LDR R0 , =0x020E0068 @IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03
LDR R1 , =0x5 @Data to be written
STR R1 , [R0] @Write 5 to IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03
/*Configure the electrical properties of IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03
* The address of IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03 is 0x020E_02F4
* bit0: 0 low rate
* bit5-3: 110 R0/6 drive capability
* bit7-6: 10 100MHz speed
* bit11: 0 turns off open-circuit output
* bit12: 1 enable pull/keeper
* bit15-14: 00 100K pull-down
* bit16: 0 turn off hys
* Write 0x10b0 to register IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03
*/
LDR R0 , = 0x020E02F4
LDR R1 , = 0x10b0
STR R1 ,[R0]
/*Set GPIO function
* Set GPIO1_GDIR register Set GPIO1_GPIO03 as output
*The address of register GPIO_GDIR is 0x0209C004
* Set GPIO1_GDIR register bit3 to 1, which means GPIO1_GPIO03 is output
*/
LDR R0 , = 0x0209C004
LDR R1 , = 0x8
STR R1 ,[R0]
/*Turn on the LED, that is, set GPIO1_GPIO03 to 0
*GPIO1_DR register address is 0x0209C000
*/
LDR R0 , = 0x0209C000
LDR R1, =0
STR R1 ,[R0]
loop:
b loop
Previous article:Linux ARM (IMX6U) bare metal assembly LED driver experiment--compile driver
Next article:Introduction to ARM exception and interrupt processing (interrupt is a type of exception)
Recommended ReadingLatest update time:2024-11-16 10:39
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Xianji HPM6750 Review] RT-Thread SDIO driver and file system
- FLASH emulation EEPROM experiment
- How can I reduce noise when the signal generator is giving a small signal?
- (Ended)Touch and grab a building to win gifts: How much do you know about RISC-V manufacturers?
- Summary of configuring 5409's McBSP as an SPI port
- 【FAQ】Microchip Live|Secure configuration of MPU in your factory
- Two MCU Programming Ideas
- How to use TMS320C6416 timer 1 interrupt
- Program burning failed
- What op amp circuit is this?