HI3531 serial port test program (arm)

Publisher:RadiantBeautyLatest update time:2023-09-06 Source: elecfansKeywords:HI3531 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

#include
unsigned int UART0_ADDR = 0x20080000;
unsigned int retu=0;
int i=0;
void delay_x(unsigned short cycles)
{    
    unsigned short t;
    t = cycles;
    while ( --t != 0 );
}

int  main()
{
///////////初始化部分////////////////////////////////////////////////////
    retu = *(unsigned int *)(UART0_ADDR  + 0X30);//uart_cr
    *(unsigned int *)(UART0_ADDR  + 0X30) = 0x300;
  //  retu = *(unsigned int *)(UART0_ADDR  + 0X24);//ibrd
  //  retu = *(unsigned int *)(UART0_ADDR  + 0X28);//fbrd
   *(unsigned int *)(UART0_ADDR  + 0X24) = 1;
   *(unsigned int *)(UART0_ADDR  + 0X28) = 40;
   *(unsigned int *)(UART0_ADDR  + 0X30) = 0x300;
  
   *(unsigned int *)(UART0_ADDR  + 0X2c) = 0x60;//UART_LCR_H
   *(unsigned int *)(UART0_ADDR  + 0X34) = 0x12; //UART_IFLS
   *(unsigned int *)(UART0_ADDR  + 0X38) = 0x0;//UART_IMSC
  
  
    retu = *(unsigned int *)(UART0_ADDR  + 0X30);//uart_cr
   
    *(unsigned int *)(UART0_ADDR  + 0X30) = retu | 0x01;//使能串口
//////////////////////////////////////////////////////////   
    while(1)
    {
   // retu = *(unsigned int *)(UART0_ADDR  + 0X18);
  //  retu = retu&0x40;
    if(((*(unsigned int *)(UART0_ADDR  + 0X18))&0x40)==0x40)
    {
        retu = *(unsigned int *)(UART0_ADDR  + 0X00);
        retu = retu&0xff;
        *(unsigned int *)(UART0_ADDR  + 0X00) = retu;
    }
    retu = 0;
    delay_x(0X7000);
    }
    return 0;
}


Keywords:HI3531 Reference address:HI3531 serial port test program (arm)

Previous article:How to use JLink to indirectly program Nor and Nand Flash of S3C2410 and S3C2440 development boards
Next article:Comparison of hi3531spi flash startup and bootrom startup

Recommended ReadingLatest update time:2024-11-16 20:50

Building an ARM Linux cross-compilation toolchain
Readers may wonder why we need a cross compiler? Cross compilation is generally speaking to compile a program on one platform that can run on another platform with a different architecture. For example, a program that can run on a CPU platform with ARM as the core can be compiled on a PC platform (X86 CPU). The compile
[Microcontroller]
Design of automobile speed management system using infrared light sensor and ARM
Recently, an anti-radar speed measuring device called "electronic dog" has appeared in the automobile market. When approaching the radar speed measuring area, this device can capture the radar speed measuring information in advance and issue an alarm, allowing the illegal vehicle to escape punishment, which has seriou
[Microcontroller]
Design of automobile speed management system using infrared light sensor and ARM
The latest "statement" from Arm, Arm China and Huawei HiSilicon: We will not cut off supply to Huawei HiSilicon!
Arm is a British chip architecture company founded in 1990. It was acquired by SoftBank of Masayoshi Son in 2016, but its headquarters is still in Cambridge, UK. It is reported that Arm itself does not manufacture computer chips. Its main business is to license its semiconductor technology to others, and sell the tech
[Embedded]
The latest
ARM interrupt processing
 ARM has seven types of exception interrupts, with different priorities, working modes (there are seven working modes), addresses, and functions. For example, the software interrupt SWI has a priority of 6, a working mode of management mode, an exception vector address of 0x00000008, and a user-defined interrupt instr
[Microcontroller]
ARM processor architecture------implementation of nested interrupts
In traditional ARM, IRQ appears as a system exception. For the ARM core, there is only one system exception called IRQ. ARM generally finds the IRQ interrupt handler through the exception vector when processing IRQ. After entering the IRQ interrupt handler, ARM automatically masks IRQ, which means that subsequent inte
[Microcontroller]
ARM assembly instruction MCR/MRC learning
The MCR instruction transfers the data in the register of the ARM processor to the register of the coprocessor. If the coprocessor cannot successfully perform the operation, an undefined instruction exception interrupt will be generated. The syntax format of the command is: MCR{} p15, 0, , , {,} MCR2 p15, 0, , , {
[Microcontroller]
ARM GPIO interface setting method
As shown in the following code, why is sending port SDA to SDA a set operation? In fact, SDA is an offset, which is based on GPIO_PORTB_BASE. SDA defines a certain pin, such as #define SDA 0x20H This is a hexadecimal number, which is 0010 0000B when expanded into binary. It can be seen that the offset 0x20H can actual
[Microcontroller]
A brief discussion on ARM pseudo-instruction address reading
1. ADR pseudo-instruction --- small range address reading The ADR pseudo-instruction reads the address value based on the PC relative offset or the address value based on the register relative offset into the register. When the assembler compiler compiles the source program, the ADR pseudo-instruction is replaced by a
[Microcontroller]
A brief discussion on ARM pseudo-instruction address reading
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号