Preface
In the process of single-chip microcomputer application development, after the source file is compiled successfully, simulation debugging work must be carried out. Simulation debugging can be divided into two categories-chip-level simulation and code-level simulation. Chip-level simulation refers to the use of simulation software and ICE hardware tools to perform simulation debugging work on actual hardware; while code-level simulation is completed entirely on the computer without the participation of hardware. The two types of simulation have their own characteristics and are used in different occasions. Based on VMLAB, this article describes the method of hardware/software co-simulation of AVR single-chip microcomputers.
The full name of VMLAB is VisualMicroLab. It is designed for AVR and ST62 series microcontrollers. It is a virtual prototype framework for microcontrollers. It can provide users with a real virtual microcontroller (MCU) design laboratory. It has a powerful multi-window, multi-file editor, an integrated development environment for microcontrollers, a series of integrated development tools, a graphical interface debugger, a mixed-mode analog-digital circuit simulator, a code quality checker, and so on. Hardware and application software can be simulated concurrently, compared with which, the online hardware emulator (ICE) seems to lose its meaning. VMLAB can simulate more peripherals including analog components based on MCU, and it has interactive device (buttons, potentiometers, LCD display) simulation functions.
Co-simulation in VMLAB
First, let me introduce two concepts:
1) Virtual prototype
A virtual prototype is a concentrated embodiment of a specific application, which is a collection of software and hardware. The role of a virtual prototype is to simulate the behavior of the application before implementing it.
2) Hardware/software co-simulation (hw/swco-simulation)
Hardware/software co-simulation means that for a specific application, all features, including hardware and software, are simulated and implemented using a virtual prototype. VMLAB implements co-simulation based on a co-simulation engine called CCCP (Concurrent Co-simulator of Circuits and Processors).
One of the great benefits of using a virtual prototype based on a specific application is that the hardware part can be simulated through the virtual prototype, which will undoubtedly increase the development speed and no longer require an in-circuit emulator (ICE) tool, and the cost will undoubtedly be greatly reduced.
In VMLAB, simulation is managed through the project file *.prj. Some syntax keywords of the project file are shown in Table 1.
Table 1: VMLAB project file syntax keywords
The simulation experiment needs to be carried out according to the following steps:
1) Generate a project file, select the microcontroller type, and specify the source file.
2) Add or modify the hardware connection relationship of the microcontroller periphery in the project file.
3) In the "view'CodeNotebook" window on the menu bar, create or modify the source file code.
4) Use the "project'build" command on the menu bar (or press F9) to compile and generate the hardware/software database. You can observe error or warning messages through the "CodeMaker" item in the "view'Messages" window on the menu bar.
5) When there are no errors in the compilation, the green light in the VMLAB toolbar will light up. Click this green light and the simulation will continue to run. You can use the toolbar to control the simulation process, or you can use the menu bar "Run'..." to control the simulation process.
6) After all application characteristics are simulated, download the *.hex file to the microcontroller.
Introduction to Basic Hardware Libraries in VMLAB
The basic hardware library in VMLAB is divided into four parts, each part contains different basic hardware.
1) Basic analog devices
It includes resistors, grounding capacitors, grounding buttons, and LEDs. The buttons and LEDs are all connected to the control panel, as shown in Figure 1.
2) Voltage generator
Including pulse voltage source, sinusoidal wave voltage source and potentiometer (sliding resistor).
3) Interactive non-return-to-zero code generator (NRZ-generator)
4) Other macro-models
Includes: Operational Amplifier (OPAMP), Comparator (COMP), Two-input NOR Gate (ND2), 8-bit DA Converter (D2A8), RS232, LCD Model, I2C Monitor, 44 Matrix Keyboard.
Co-simulation Example
As shown in Figure 2, a small AC signal is amplified by the operational amplifier and added to the AD input terminal of the microcontroller Atmega16.
The connection of the peripheral circuit can be achieved by adding the following line information to the project file:
;------------------------------------------------- ----------
XopOPAMPampposampnegPA7; add an operational amplifier
R1GNDampneg100K; add R1
R2PA7ampneg300K; add R2
VsinampposVSSSIN(0.40.220); add a signal source,
PLOTV(PA7)V(amppos); Observe the voltage of PA7 and amppos nodes in the scope window
state
;------------------------------------------------- ----------
In VMLAB, users can define simulation node names themselves. For example, amppos and ampneg above are two user-defined nodes. Letters, underscores, and numbers can be used in node names, and pins of various types of microcontrollers pre-defined in VMLAB can also be used.
Conclusion
Compared with other similar code-level simulation tools, VMLAB has the advantage that hardware simulation is completely computer-based and does not require the addition of actual hardware. As a simulation platform, VMLAB can not only simulate most of the characteristics of MCU and other peripherals, but also perform co-simulation on applications involving analog quantities. The simulation function of VMLAB is even comparable to that of ICE hardware tools, and the use of VMLAB will undoubtedly greatly reduce development costs.
Previous article:Design of BDM Debugging System for Motorola Microprocessor
Next article:Temperature acquisition instrument made of CD4051 and AD595
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- Square wave generator for msp430 microcontroller
- The problem of too small spacing between chip leads in AD
- EEWORLD University----Azure RTOS step by step workshop
- Working principle, functional characteristics and classification of photoelectric liquid level sensors
- EEWORLD University Hall--Detailed explanation of MATLAB image functions and their applications
- I need help, stlink v2 cannot be recognized and the firmware version cannot be seen
- FPGA Power Consumption
- Easily extend the battery life of the charging box of TWS true wireless Bluetooth headsets
- MSP430FR2355 LaunchPad Development Kit
- NUCLEO_G431RB Review - UART Questions