I remember that the teacher of this course first talked about the basic application and programming of single-chip microcomputers, and then introduced us to the tiny6410 development board at the end of the course. Later, I went to check the relevant information and felt that it was feasible to use this board to make a remote-controlled robot, so I just bought the tiny6410 development board of Friendly Arm (ps: This cost me 600 yuan, teacher, you have to change my grade to a passing grade). For detailed information about this development board, please refer to the attachment or the relevant documents released by the official website of Friendly Arm.
Hardware Resources
First, let's take a look at the interfaces of tiny6410:
From the layout of tiny6410, we can see that it provides quite a lot of hardware resources.
Software Resources
Next, let's take a look at the software resources of tiny6410.
Tiny6410 can be equipped with Linux, Android, and WinCE systems. The following is a brief introduction to the Linux system.
Development Road--Network
1. Development ideas
When it comes to Linux, many people will think of embedded development and network servers under Linux. However, embedded development is somewhat difficult for people who study electronics, so we can use network servers under Linux to do some development. [page]
The web servers for Linux include Hapd, Thttpd and Boa. Among them, the Boa server has open source code, excellent performance, and supports CGI common gateway interface technology, making it more suitable for web development. The Boa server can interact with external applications and scripts through CGI. According to the method used by the client browser when making a request, the server will collect the information provided by the client and send the information to the specified CGI extension program. The CGI extension program processes the information and returns the result to the server. The server then analyzes the information and sends the result back to the client to display on the browser. In fact, this is the B/S (browser/server) model, which can be represented by the following figure:
This mode will be the main mode for remote robot control development based on Boa-web server. The following is the description of this mode!!!
As shown in the figure:
1. The browser can be a browser under Windows or a browser on a mobile phone. The control end is just an HTML web page.
2. Web server is Boa server under Linux. Based on Boa server, a dynamic website can be established, through which information exchange between embedded devices and users can be carried out.
3. CGI part. CGI is a scripting language that can be used with Perl, PHP, and C language. In order to facilitate the construction of dynamic websites, this development is mainly based on PHP+CGI.
4. Application program. In fact, in this development, the application program is a CGI program. These CGI programs process the information transmitted by the user through the Boa server, and then call the hardware device of the development board through the hardware driver.
2. Construction of Boa and tftp server
BOA server is to run on ARM embedded devices, so it is necessary to cross-compile BOA source files. The compilation tool uses the arm-linux-gcc-4.3.2 cross-compilation tool chain. Copy the file arm-lin-ux-gcc-4.3.2. tgz to the directory /tmp, and execute the command cd /tmp; tar zxvfarm-linux-gcc- 4.3.2. tgz-C /. In this way, the cross-compilation tool is installed in the directory /usr/local/arm/4.3.2. To ensure that the cross-compilation tool chain can be directly applied after opening the terminal, add the compiler path to the system environment variable in the /root/.bashrc file. Run the command gedit/root/.bashrc to edit the file /root/.bashrc. Add export PATH=$PATH:/usr/local/arm/4.3.2/bin at the end of the file. Save and exit. Then execute the source/root/.bashrc command to make the settings effective. Finally, check whether the cross-compilation tool is installed successfully. The command is to enter arm-linux-gcc-v in the terminal; if you can see the arm-linux-gcc version number 4.3.2 in the output information, it means that the installation is successful.
Secondly, cross-compile BOA source code, copy BOA source code package boa-0.94.13.tar.gz to /tmp directory, decompress mask package tar zxvf boa-0.94.13.tar.gz; after decompression, enter the directory where BOA is located in the Linux terminal, first execute command ./con-figure to generate Makefile file, then open the folder, find Makefile file, open it with text editor, find CC=gcc, CPP=gcc-E two lines, set them to the cross-compilation tool path CC=/usr/local/arm/4.3.2/bin/arm-linux-gcc and CPP=/usr/local/arm/4.3.2/bin/arm-linux-gcc-E generated in the previous step, then save Makefile and exit, return to the terminal to execute make command, cross-compile to get executable program BOA, it is the executable file that can run on arm embedded device. You can view the file information through command fileboa. Copy this BOA file to the /bin directory of target board.
Next, configure the boa server. The main purpose of configuring BOA is to enable it to support the execution of CGI programs. Create a BOA directory in the /etc directory of the file system with mkdir boa, copy the boa.conf file in the BOA source directory to the /etc/boa directory of the file system, and then modify it based on this configuration file according to the needs of the embedded BOA. When modifying this configuration file, you need to ensure that other files and settings must be consistent with the configuration file, otherwise the embedded Web server BOA cannot run normally.
After the Boa server is built, a www folder will appear in the root directory of the Linux file management. This folder is the storage directory of the dynamic website system mentioned above. If you want to read and write files of this website system, you need to use a tftp server. Through the tftp service, we can easily read and write files of the dynamic website system in the www folder. I will not introduce the construction of the tftp server here.
3. Boa server transplantation test
From the hardware resources of tiny6410, we can see that the development board provides four LEDs. Let's simply write a program to test remotely controlling the LEDs on the development board through the Boa server.
The procedure is as follows:
<input type=“radio” name=“speed” value=“show” checked>Slow
<input type=“radio” name=“speed” value=“normal”>Medium speed
<input type=“radio” name=“speed” value=“rast”>High speed
<input type="submit" value=confirm "name="submit>
The leds.cgi program is as follows:
#!/bin/sh
Period=1+case$QUERY-STRING in
*slow*)
period=0.25
;;
* normal *)
period = 0.125
;;
* fast *
period=0.0625+;
*fast * ) + period = 0.0626
;;
esac
/bin/echo $ period ? /tmp/led-control // passed to the application through the Query_String environment variable.
echo “Content-type:texe/html;charset=gb2312”
echo
/bin/cat led =result.template
exit 0
LED-control is a compiled executable application that controls the LED through the LED driver. These hardware data can be found in the PDF file provided by Friendly Arm. If other hardware devices on the development board are used, you can refer to the relevant data and call other hardware devices.
Next, assuming the IP of the development board is 192.198.1.230, you can directly visit http://192.198.1.230 to access the webpage of the Boa server, through which you can control the flashing speed of the LED on the development board. I won't post the pictures for this test for now, if you want to see them, you can come to my dormitory, hehe.
Conclusion
Previous article:SST25VF driver program with stm32
Next article:NXP_LPC1114 delay function collection
- Popular Resources
- Popular amplifiers
- Network Operating System (Edited by Li Zhixi)
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- LabVIEW Programming and Application (Ji Shujiao, Shang Weiwei, Lei Yanmin)
- Beej\'s Guide to C Programming-Chinese version
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