Preface:
J-Scope Introduction
What is J-Scope:
J-Scope is a free software launched by Segger, which is used to display the waveform of data in real time when the MCU is running.
Application Scenario
In actual projects, we often need to display the values of fast sensors or ADC in the form of waveforms. The usual solution is to use the USB interface to host the computer or store to sort out part of the collected data, which is cumbersome. Or the serial port virtual oscilloscope software is usually used, that is, the data on the microcontroller is sent to the PC through the serial port communication, and then the software on the PC draws the serial port data into the corresponding waveform. Although it is also very convenient, it has several disadvantages:
The transmission speed is slow, usually 115200 baud rate, of course there are higher baud rates, but the transmission speed is indeed a bottleneck; it takes up CPU, because if you want to send serial port data at a high speed, it will take up a lot of CPU resources, which may affect other tasks, which is not what we expect to see. Of course, it can also be done through DMA and serial port interrupts, but the interrupt frequency is too high, and the stack is frequently popped and pushed, which is also very expensive; in addition, it also needs to occupy a serial port resource;
Therefore, when we do not have a serial port and the waveform we need to capture requires a very high sampling frequency, and the CPU does not have extra resources for us to run the task of sending via the serial port, JSCOPE can meet the needs.
It needs to be used together with jlink. For the jlink emulator with V8 firmware, the sampling speed is relatively slow. Here we recommend using the jlink emulator with V9 firmware.
Module Description
J-Scope Description:
J-Scope can display the values of multiple variables like an oscilloscope. It reads an elf file and allows multiple variables to be selected to visualize them. We can simply connect the target microcontroller to the J-Link, flash the application and start J-Scope.
In a few steps you can configure J-Scope and select the variables to be displayed. The configuration can be stored in a project file to facilitate reuse and portability.
Each symbol selected in J-Scope can be configured individually. Move the graph up or down to change the zero baseline or change its resolution. Choose whether to visualize the symbol in the graph or just show its value in the monitoring panel.
Analyze the collected data, scroll through the visualized graphs, zoom in and out or save the data to a file for further analysis.
J-Scope can be used in parallel with the debugging environment and extends the debugging experience of the IDE.
Functional principle
Two working modes:
Acquire data in HSS (High-Speed-Sampling) mode
The HSS mode is relatively simple. You only need to load the executable file xxx.axf generated by MDK or the executable file xxx.out generated by IAR into the JScope software.
Devices supported by HSS mode:
Advantages
The target board can be connected anytime and anywhere without affecting the normal function of the target board and without requiring additional resources.
Code.
No need to use SWO pin, use standard download interface. Take our development board as an example, use VCC, GND,
SWDIO, SWCLK and NRST. It is also OK to use three-wire JLINK-OB, only GND, SWDIO
and SWCLK.
Disadvantages
Compared with RTT mode, the speed is slow.
The sampling speed is basically fixed at around 1KHz, which is slow and only suitable for situations where the sampling variable changes at a speed lower than 1KHz.
Get data in RTT mode
This method is similar to uploading data via the serial port, but with a SWD interface. The target board can be connected anytime and anywhere without affecting the normal function of the target board. It allows higher data throughput than HSS. Up to 2 MB/s can be achieved. Even if there is a small buffer of 512 bytes on the target,
to achieve 1 MB/s.
J-Scope data acquisition is synchronized with the execution of the target board application because the application determines when and how to sample data.
J-Scope does not need to know the location of the variable. The location of the RTT buffer is automatically detected by J-Scope.
Data such as timestamps can be added to the data samples.
The SWO pin is not needed, and the standard download interface can be used.
Software Configuration
J-Scope Installation
1) Unzip _JScope_V6xxm.zip;
2) Double-click Setup_JScope_V6xxm.exe to start the installation.
3) Click NEXT to continue the installation.
4) Click I Agree to accept the agreement.
Install click I Agree
5) Select the location to add the shortcut. Here, select Add to Start Menu, then click NEXT to continue the installation.
7) Select the path in the pop-up interface, and then click OK. Users can choose the installation path by themselves. This example chooses to install it in D: oolJ_Scope.
8) Click Install to start the installation.
9) Click Finish to complete the installation.
J-Scope is turned on
Open the J-Scope icon on the desktop:
New Construction
Select the device. Please note that you can just input the text directly. Do not click on the frame to select, or it will crash!
Type *.ELF, *.axf, or *.out file,
In the configuration dialog, select your elf file (or AXF file if using Keil). For most targets, you do not have to specify the configuration. If there are any questions, select your target device and configure the interface accordingly (specify target device).
(If you do not want to select your chip type every time, it is recommended to determine the chip type in advance here.
You may also be prompted to select a device after entering
Continue clicking to select the variable you want to view.
Engineering Testing
Functional Description
Just open a development board demo file
Code Analysis
Test Results
Waveform
The function is very powerful, and can display various variables, key values, timer benchmarks, etc., various waveforms,
Interface function operation
There are three most commonly used operations in the interface function operation:
1) Horizontal scaling
You can hold down the Ctrl key on the keyboard and use the mouse wheel to zoom in or out, or you can use the left and right arrow keys on the keyboard to zoom in or out.
2) Vertical scaling
For vertical zooming, you need to select the waveform to be zoomed in the numerical area. Blue indicates selection. After selection, you can set the vertical zooming using the + and - keys on the keyboard.
国民单片机N32GX系列联合Jlink之JScope测试