1. Experimental Principle
You may wonder, isn't the mem_init_tiny4412.S in the BL2 directory already implemented the serial port initialization, and also has the serial port output function, otherwise how can there be print information on the serial port debugging assistant, why do we need to re-initialize here? In fact, I think it is not necessary to re-initialize, but at least the serial port output function to be called in the standard function Printf() should be implemented, because the initialization work can be initialized only once when the clock does not change, but when it comes to the LCD initialization step, the CPU has been relocated to DRAM for execution, and the functions uart_asm_putc and uart_asm_putx implemented in mem_init_tiny4412.S should not be located now, so they should not be called, so I think it is necessary to re-initialize, at least to implement the serial port output function.
The code implementation method is copied and modified from U-BOOT, and also refers to the code method in Chapter 24 of " Mini210S Bare Metal Program Development Guide under Linux Platform". In this chapter, I will not explain in detail how to implement the serial port in the code, etc. I just want to find out why the LCD cannot be initialized successfully using another code style? I believe that everyone should understand the code implementation process with the explanations in the previous chapters.
2. Program Description
1、UART.C
The code adds uart.h and uart.c as well as some related files extracted from the Linux system. Although I re-implemented the serial port initialization function here, I did not call this function to initialize the serial port in the main execution phase of the user_bin.bin program. Instead, it only calls the putc() output function and the getc() function for input through the printf() function. So this also verifies the previous assumption that the serial port has been initialized at the beginning. We did not change the clock or anything, so there is no need to initialize it again. The program implementation brief will not explain too much.
test process, I found that the drawn text has not been very clear, and this is the case for the three fonts. There may be some problems in the program, which needs to be carefully investigated.
I modified the lcd_draw_bmp() drawing function in lcd.c to make it more flexible. It can draw character array files with 8-byte picture information headers converted by the popular online picture to LCD data software "img2lcd". This function automatically extracts the image height and width information from the 8-byte information header and then draws. Since I now provide a 24-bit picture of 800*480, the user_bin.bin file generated by the compilation will be relatively large. The file size is already relatively large, about 1149K, so it is necessary to modify mmc_relocate.c in BL2 to increase the sector size of the copied sector. One sector is 512 bytes. Everyone can modify it according to their own program, but it cannot be too large, because I don't know how big the first partition allocation size is when the SD-Flasher.exe provided by FriendlyARM is formatted. I am not sure. When I used a partition tool to check, I found that the size was about 150M, as shown in Figure 9-1 below. It is safer for everyone to control the program within 5M.
Figure 9-1, SD card partition diagram
I changed the copy size to 2048K, so the number of sectors is 4096, and the code is as follows:
SDMMC_ReadBlocks(49,4096,0x43e00000);
3、main.c
The main.c program has also been modified, mainly copying the code provided in Chapter 24 of the "Mini210S Bare Metal Program Development Guide for Linux Platform". The program draws different graphics by inputting different numbers, and the characters are displayed on the screen. The program implementation is also very simple, so I won't explain it in detail here.
3. Complete burning process
The SD card has been inserted into the computer. Assume that Linux recognizes the SD card and its identification number is sdb. Execute the following command:
# chmod 777 –R 8_sdram_LCD_Char
# cd 8_sdram_LCD_Char
# make
# ./ fast_fuse /dev/sdb
Since the program user_bin.bin is relatively large, it will take longer to burn. It usually takes me two or three minutes. Please wait patiently. During the burning process, if the screen does not respond, it is not because the burning sh has died.
4. Power-on experiment
Insert the SD card into Tiny4412, select the SD card to start, connect it to the computer through serial port 0, open a serial port debugging assistant, and then power on. You can see the following phenomenon:
The serial port assistant not only displays the information read from the memory, but also inputs the print information added during the LCD initialization process. I have captured part of the output as shown in Figure 9-2. From the figure, we can see that the initialization value of the VIDTCON2 register is different in the two styles. This is where the problem lies.
Figure 9-2, LCD initialization output information
Looking at the code, it turns out that the code is as follows. It turns out that LINEVAL<< 11 is written as borrowed. EXYNOS_VIDTCON2_LINEVAL(x) has already shifted the value left by 11 bits. Here I shifted it left by 11 bits again, resulting in an initialization error.
//VIDTCON2 = ( EXYNOS_VIDTCON2_LINEVAL(LINEVAL<<11) |
EXYNOS_VIDTCON2_HOZVAL(HOZVAL));
Modify it to:
//VIDTCON2 = ( EXYNOS_VIDTCON2_LINEVAL(LINEVAL)|
EXYNOS_VIDTCON2_HOZVAL(HOZVAL));
Recompile the power-on experiment. From the part captured in Figure 9-3 below, you can see that the initial values are now the same.
Figure 9-3, LCD initialization output information
Finally, I modified the code of this chapter into the second writing style and provided it to everyone. I also compiled and powered it on to verify it myself, and now the program can work normally.
After completing this step, you can verify the main program, as shown in Figure 9-4 below, which shows the effect of drawing a picture after sending character 5.
Figure 9-4, Tiny4412 implementation effect diagram
So Sexy ??? Oh haa??
Chapter 10: Epilogue
At the beginning, I said that I always wanted to successfully transplant the LCD function in U-BOOT, but I could not do it. I thought of using bare metal program to experiment first, verifying that the LCD program can work properly, and then debugging U-BOOT. That is why I found the document "Mini210S Bare Metal Program Development Guide under Linux Platform" on the Internet, and this bare metal program learning record document. So far, my purpose has been achieved. The following documents and programs of Mini210S are burned through Minitools, but our Tiny4412 cannot. I will not go into the implementation of other bare metal codes, but the document provides a method of relocating to DRAM for running, which can also implement some slightly larger bare metal programs. Interested friends can refer to the document "Mini210S Bare Metal Program Development Guide under Linux Platform" to implement all functions and benefit the majority of learning friends. I have spent some time here. I have a purpose for learning this and do not want to spend too much time in other programs. The next step is to return to the debugging of U-BOOT. Thank you!
Previous article:tiny4412 bare metal program 7. Relocate code to DRAM
Next article:tiny4412 learning (I) building a linux system from scratch
Recommended posts
- [Digi-Key Follow me Issue 1] + Formatting
- //Content1:3-5minutesshortvideo// Shortvideo:https://training.eeworld.com.cn/video/37028 GPSdebuggingvideo:https://training.eeworld.com.cn/course/68020 //Content2:Projectsummaryreport// Task1:Familiarizeyourselfwiththeb
- 白无常120 DigiKey Technology Zone
- Subscribe to live replay: TI FPD-Link III automotive chipset, ideal solution for automotive video transmission
- Livebroadcasttime:September24,10:00-11:30 LiveTopic:TIFPD-LinkIIIautomotivechipset,idealsolutionforautomotivevideotransmission Livebroadcastcontent: TIFPD-LinkIIIchipsetallowsvideosignalstobetransmittedthroughhigh
- EEWORLD社区 TI Technology Forum
- My question is, does IoT need a server? Is Alibaba Cloud better or Tencent Cloud? Can anyone recommend one?
- IsacloudserverneededintheInternetofThings?Iwouldliketoaskanexperttointroduceittome.Yes.YoucancomparethesupportofAlibabaCloudandTencentCloudforIoT.Theofficialwebsiteshaveintroductions,andyoucancheckthechar
- 15003214995 TI Technology Forum
- Prototyped a PCB expansion board
- Inordertofacilitatetesting,aPCBexpansionboardwasdesignedandproofed.TheboardisdesignedwithfemaleheaderscorrespondingtothepinheadersoftheSTM32F401developmentboard,sothatthedevelopmentboardcanbedirectlypluggedint
- hujj MEMS sensors
- [Industrial-grade intelligent control MCU D133CBS] 8 - Audio Codec Test
- Preface IboughtanonboardWifiandBluetoothchiptwodaysago,whichisspecifiedonthedevelopmentboardschematic.Isoldereditbadly,andoriginallyplannedtodoareviewoftheWifiandBluetooth.WhenIoperatedaccordingtothe
- 御坂10032号 Domestic Chip Exchange
- EEWorld invites you to dismantle - Summary of previous dismantling reports
- @秦天qintian0303 EEWorldinvitesyoutodisassemble(Issue14)-Comprehensivedisassemblyandevaluationofsmartelectricmasks @lugl4313820 DisassemblyoftheHorn-X2ProLiDARfromBenewake @North AnalysisofZhengyunBa
- okhxyyo Making friends through disassembly
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- Breaking through the intelligent competition, Changan Automobile opens the "God's perspective"
- The world's first fully digital chassis, looking forward to the debut of the U7 PHEV and EV versions
- Design of automotive LIN communication simulator based on Renesas MCU
- When will solid-state batteries become popular?
- Adding solid-state batteries, CATL wants to continue to be the "King of Ning"
- The agency predicts that my country's public electric vehicle charging piles will reach 3.6 million this year, accounting for nearly 70% of the world
- U.S. senators urge NHTSA to issue new vehicle safety rules
- Giants step up investment, accelerating the application of solid-state batteries
- Guangzhou Auto Show: End-to-end competition accelerates, autonomous driving fully impacts luxury...
- Lotus launches ultra-900V hybrid technology "Luyao" to accelerate the "Win26" plan
- GD32L233C-START Evaluation——02_1. Build development environment and simple debugging
- National Semiconductor's new Boomer audio subsystem features RF suppression circuitry to block high-frequency signal interference
- what(): couldn't open /dev/video0
- The Painful Experience of DSP Connecting to Emulator
- C2000 floating point calculation notes - differences between CPU and CLA and error handling techniques
- When Kicad moves a line individually, the line is actually disconnected when moving. How to solve this problem?
- EEWORLD University ---- Theoretical basis of IoT terminal development
- About the serial port problem of MSP430F5529 microcontroller
- Mercury-containing thermometers will be banned from 2026? What do you think is the best alternative?
- [Repost] Learn about active oscilloscope probes and passive oscilloscope probes in one article