Special Function Registers
In this topic:
Special function register (SFR) is a register within a microcontroller that controls or monitors various aspects of its function. winIDEA provides a specialized Special Function Registers (SFR) window to observe the registers of the SoC you are using. This can help you to determine what state the SoC and its peripherals are in.
SFR window allows you to:
•View and modify special function register values
•Search for special function registers by name or by address
•Save the SFR contents
•Generate an initialization script
To open it select View | Debug | SFRs | Special Function Registers or click the SRF Window button in the Debug Toolbar.
By default the SFR Window is populated with the SFRs based on the CPU you are debugging. If a different set of SFRs is required, you can override this selection.
A register corresponds to a CPU's special function register. Along with the name, its address and current value are displayed. Where a special function register contains fields of bits, it can be expanded to show sub-registers.
Name - Names of the (sub-)groups or (sub-)registers.
Value - Displays values and names of the register (if selected in the 'sub-register display' of the context menu). If the value can not be read, appropriate message is displayed. In case that reading of this SFR was skipped due to refresh abort, skipped is written instead of the value. You can disable refresh aborts in the SFR Options. To modify register value, double click on its value and enter the new value. Whenever possible, sub-registers are modified without writing the entire register (bit addressable registers). If a sub-register can not be accessed independently of its register, the register is first read, sub-register bits are adjusted, and the whole register is written back.
Address - Displays address of the SFRs, as well as bit position (O) and size (S) for the sub-registers.
Description - Displays a description of the peripheral group, register or a field (if it is available in the SFR specification file).
SFR Window allows to search SFR in three different ways.
Select Find from the context menu by right-clicking in within SFR Window or press CTRL+F to search for the SFR either by name or address.
Alternatively you can use filters to quickly look for the SFR you are looking for. Select Show Filter from the context menu (if it is not already visible) and enter the name of the SFR/sub-SFR you are looking for. When filtering SFRs and a SFR matches the criteria all its bit fields are also shown.
Searching for SFRs can be time consuming, so you can create a custom SFR window and populate it only with the SFRs you are interested in.
Right-clicking within SFR opens context menu.
Sub-register display - Display/Hide sub-registers in values/names and values.
Edit value - Enter (if available) new value.
Copy - Copies the contents of the underlying cell to the clipboard.
Display Mode - Switch between binary, hexadecimal, decimal and character display.
Create Initialization Script - All selected SFRs which can be read and written are exported to a Python file along with their current values.Monitor access is used to perform the modification. This setting can be manually overridden by editing the Python file.
Show Filter - Show/hide filter above in the display pane of the SFR Window.
Real time update - If you wish to monitor SFRs in the real-time enable this option.
Find - Search SFRs by name or address.
Properties - Shows Name, Address, Size (bits), Offset (bits), Access, Value of selected register.
Save - Save SFR content.
Auto Fit - Adjusts the width of columns to fit the content into the available space.
Options - Customize display, colors and fonts of the SFR Window.
To display or hide columns, right-click on a column header and select what you want to see. |
With custom SFR window you can manage a large number of SFRs and monitor only a few registers. Whole groups or standalone registers from the main SFR Windows can be added to the new window using drag-and-drop. If several custom SFR windows are created, they can be selected from the View | Debug | SFRs drop-down menu.
To monitor the contents of only a few SFRs, you can drag and drop them to Watches, where they behave just as any other Watch item. |
For every SFR Window you create, a configuration file is written in the project directory with the name of <window name>.CSF. This file can be shared to anyone who would need the new window. Only the .CSF file needs to be copied to the project directory of the other user. Upon opening the project the next time, the new SFR window will be available in the View | Debug | SFRs.
If a custom SFR window should be deleted, delete the <window name>.CSF file in the project directory.
You can save all the values displayed in the window to text or CSV file. If you have a lot of registers you can first use filter and than save option. Configure the export parameters before saving:
•File - Specify the file name and location.
•Format - Select between Text, Text(all) and CSV file format. Text(all) has the same information as the Text, plus register address/mode and bit field size/offset/mode.
•Scope - Select the scope you wish to export: All, Visible, Selection.
•Items - Select the amount of information you wish to export: Group names, Sub registers, Short names.
Registers and values are saved exactly as displayed in the SFR.
Exporting all SFRs will probably take a few minutes. |
•Special Function Registers in winIDEA - Video Tutorial