2440 serial port linux programming, related configuration of S3C2440 serial port communication

Publisher:亚瑟摩根Latest update time:2022-10-27 Source: csdn Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The relevant registers for UART configuration are as follows (listed in the order in the s3c2440 manual):

1.ULCONn register: linear control register

Function: Set parity, stop bit, data bit (5-8 bits)

Note: It is generally set to no parity, one stop bit, and 8 data bits, which is often called "8N1". At this time, the register value is 0x3. (bit[6]=0 is normal mode, otherwise it is infrared mode);


2.UCONn register: channel n controller

Function: Select UART clock source, set UART interrupt mode

Note: PCLK, UEXTCLK or FCLK/n can be selected. bit[5]=1 is loopback mode, used for testing; bit[3:2] and bit[1:0] control the transmission and reception modes respectively. Beginners often set it to interrupt request or query mode, bit[3:2 ]=bit[1:0]=01.


3.UFCONn register: FIFO control register

Function: Used to set whether to use FIFO, and set the trigger threshold value of each FIFO, that is, an interrupt will be generated when the amount of data in the sending FIFO is generated, and an interrupt will be generated when the amount of data in the receiving FIFO is received. And each FIFO can be reset by setting the UFCONn register. Reading the UFSTATn register can tell whether each FIFO is full and how much data is in it.

Note: When bit[0]=1, FIFO is enabled, otherwise it is disabled. Beginners do not need to use FIFO


4.UMCONn register: UART MODEM control register

Note: bit[4]=0, AFC is invalid


5.UBRDIVn register: baud rate divisor register

Function: Set baud rate divisor

Note: UBRDIVn=(int)(UART clock/(baud rate*16))-1;

UART clock: PCLK, FCLK/n or UEXTCLK, for example, if the baud rate is 115200bps and the UART clock is 40MHz, then UBRDIVn is:

UBRDIVn=(int)(40000000/(115200*16))-1=(int)(21.7)-1(take the nearest integer)=22-1=21.


5.UTRSTATn register: receive/transmit status register

Function: Display receive/transmit buffer register status

Note: In non-FIFO mode, bit[0]=1 indicates that data has been received; bit[1]=1 indicates that the transmit buffer register is empty. In FIFO mode, for the relevant bits of the UFSTAT register, see the manual for details.


6.UERSTATn register: error status register

Function: Indicates whether various errors occur

Note: Beginners don’t need to pay attention to their status. When they learn in depth, they can check the relevant information.


7.UFSTATn register: FIFO status register

Function: Indicates the relevant status of FIFO

Note: bit[14]=1, indicating that the sending FIFO is full and no more data can be sent temporarily. Bit[6]=0, indicating that there is data in the receiving FIFO (personal understanding, but not very rigorous).


8.UMSTATn register: UART MODEM status register

Note: Beginners can ignore


9.UTXHn register: send cache register

Function: UART will save it to the buffer and automatically send it out

Note: bit[7:0]=send data.


10. URXHn register: receive buffer register

Function: When the UART receives data, the CPU reads this register to obtain the data.

Note: bit[7:0]=receive data;

Note: URXHn and UTXHn are divided into big endian and little endian. Pay attention when defining the register, but generally the little endian method is used.


Reference address:2440 serial port linux programming, related configuration of S3C2440 serial port communication

Previous article:mini2440_LCD_x35 porting
Next article:S3C2440 bare metal serial port

Recommended ReadingLatest update time:2024-11-23 15:01

S3C2440, S3C6410, S5PV210 interrupt analysis
After writing the key interrupt program for S5PV210, I realized that "6410 is just a transitional product" is indeed correct. Why do I say that? Let me explain it in detail below: I will not talk about the interrupt handling process, etc., because it has been explained in great detail in the first video. I suggest tha
[Microcontroller]
S3C2440 bare metal --- NandFlash operation principle
1. Nandflash operation principle The following figure is the connection diagram of NandFlash and S3C2440 in the schematic diagram. Q1. There is only a data line between NAND FLASH and S3C2440 on the schematic diagram.      How to transfer address? Answer 1. Both data and address are transmitted on DATA0~DATA7.      
[Microcontroller]
S3C2440 bare metal --- NandFlash operation principle
How to use JLink to download and burn the boot program to NorFlash
1. Tools and wiring harness preparation 1. Prepare a set of Jlink V8 (try to use this version, other versions have not been verified); 2. Make a JTAG adapter cable from the Jlink downloader to the interface of the mini2440 development board, as shown in Figure 1-3; 3. Install the JLinkARM burning tool (it is recommend
[Microcontroller]
How to use JLink to download and burn the boot program to NorFlash
Record 1--s3c2440 GPIO && UART control
1. Initialize the corresponding UART void Uart_Init(int pclk, int baud) {    if(pclk == 0)     pclk = PCLK;    if(UartNum==0) //Judge whether to use UART0         {     rGPHCON = rGPHCON & (~(0xffff));   //UART0: RXD0 == GPH3  TXD0 == GPH2 rGPHCON = rGPHCON | (0xaaa0); //Set GPH port to UART port     rGPHUP = 0x0;
[Microcontroller]
Linux-2.6.32 key driver transplantation on mini2440 development board
Editor: The key driver involves the writing of Linux interrupt programs. 1. Button schematic diagram. 2. Writing and transplanting drivers. Create a new driver file mini2440_buttons.c in the /linux-2.6.32.2/drivers/char/ directory. The content and detailed comments are as follows: span styl
[Microcontroller]
Linux-2.6.32 key driver transplantation on mini2440 development board
TQ2440 uboot---6.start.S in relocate part analysis, adr and ldr difference
There is such a paragraph in u-boot's start.S relocate: /*relocate U-Boot to RAM */        adr r0, _start /*r0 - current position of code */        ldr r1, _TEXT_BASE /* test if we run from flash or RAM */        cmp r0, r1 /* don't reloc duringdebug */        beq clear_bss        ldr r2, _armboot_start        ldr r3,
[Microcontroller]
S3C2440 serial communication configuration
The relevant registers for UART configuration are as follows (listed in the order in the s3c2440 manual): 1. ULCONn register: linear control register Function: Set parity, stop bit, data bit (5-8 bits) Note: Generally, it is set to no parity, one stop bit, and 8 data bits, which is often called "8N1".
[Microcontroller]
GNU ARM Assembly--(VI) Clock Control of s3c2440
        In the previous few articles, I used GNU ARM assembly to control LED and the design of ARM interrupt processing, which gave me a certain understanding of ARM assembly and architecture. The following assembly learning will be combined with specific chips, one is to use assembly more flexibly and skillfully, and
[Microcontroller]
GNU ARM Assembly--(VI) Clock Control of s3c2440
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号