FAQ
- M051 Base Series(95)
- M0518 Series(97)
- M0519 Series(43)
- M0564 Series(1)
- Mini51 Base Series(90)
- Nano100/102 Base Series(101)
- Nano103 Base Series(10)
- Nano110/112 LCD Series(100)
- Nano120 USB Series(111)
- Nano130 Advanced Series(110)
- NUC029 Series(94)
- NUC100/200 Advanced Series(102)
- NUC120/122/123/220 USB Series(116)
- NUC121/125 Series(1)
- NUC126 USB Series(2)
- NUC130/230 CAN Series(103)
- NUC131/NUC1311 CAN Series(98)
- NUC140/240 Connectivity Series(114)
- M451 Base Series(118)
- M451M Series(117)
- M452 USB Series(130)
- M4521 USB Series(1)
- M453 CAN Series(128)
- M463 CAN FD/USB HS Series(1)
- M467 Ethernet/Crypto Series(1)
- M471 Series(1)
- M479 Motor Control Series(1)
- M481 Base Series(4)
- M482 USB FS OTG Series(4)
- M483 CAN Series(4)
- M484 USB HS OTG Series(4)
- M485 Crypto Series(4)
- M487 Ethernet Series(4)
- M4TK Touch Key Series(25)
- NUC442/472 Series(130)
- NUC472 Series(1)
- NUC505 Series(138)
FAQ
How to check and modify the register status by PinView and lua script? Issue Date:2019-10-02
The PinView can access MCU memory with lua file without using KEIL μVision or IAR EWARM. Also, the PinView supports the following operations by lua script:
(1) Access register to verify hardware circuit
(2) Dump SRAM data
(3) Support lua script to quickly implement test program
Lua web site: https://www.lua.org/
Scenario:
(1) User is debugging a customer project but cannot access the source project.
(2) User only has KEIL μVision now but customer uses IAR EWARM to develop projects.
1. Create a lua file. (Lua Example 1)
2. Open the PinView
3. Run the lua file script
4. The PinView log window shows the changes
Lua Example 1: my1.lua – Access GPIOA register to toggle I/O
-- Config
local write_data = 0
local RegAdd = 0x50004008 -- GPIOA_DOUT
-- Print setting
local ext = require("ext")
local print = ext.redirect_print
print(string.format('Hello Nuvoton'));
-- Read register
local read_data = ice:ReadMem32(RegAdd)
print(string.format("ReadMem: addr 0x%08X, data 0x%08X", RegAdd, read_data))
-- Write register
write_data = 0xFFFF-read_data; -- Invert GPIOA data
ice:WriteMem32(RegAdd, write_data)
print(string.format("WriteMem addr 0x%08X, data 0x%08X", RegAdd, write_data))
Lua Example 2: my.lua – Dump SRAM data
-- Config
local RegAdd = 0x20000000 -- SRAM address
local total_size = 256 -- Data length
-- Print setting
local ext = require("ext")
local print = ext.redirect_print
print(string.format('Hello Nuvoton'));
-- Dump SRAM data
local i = 0
while i < total_size do
local read_data = ice:ReadMem32(RegAdd+i)
print(string.format("ReadMem: addr 0x%08X, data 0x%08X", RegAdd+i, read_data))
i = i + 4
end
Products: | Microcontrollers ,8bit 8051 MCUs ,Arm Cortex-M0 MCUs ,Arm Cortex-M23 MCUs ,Arm Cortex-M4 MCUs |
---|---|
Applications: | |
Function: | Software and Tools,Nu Tools,PinView |