element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Test & Tools
  • Technologies
  • More
Test & Tools
Blog PST.. Experimental event / trigger support for Pico SCPI labTool - 5: Propagation to IEEE488.2 SCPI Registers Test
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Test & Tools to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 22 Sep 2023 8:27 PM Date Created
  • Views 1447 views
  • Likes 7 likes
  • Comments 12 comments
  • pico_usbtmc_scpi
  • pico
  • USBTMC
  • Pico SCPI labTool
  • labview
  • scpi
Related
Recommended

PST.. Experimental event / trigger support for Pico SCPI labTool - 5: Propagation to IEEE488.2 SCPI Registers Test

Jan Cumps
Jan Cumps
22 Sep 2023
PST.. Experimental event / trigger support for Pico SCPI labTool - 5: Propagation to IEEE488.2 SCPI Registers Test

The Pico SCPI labTool (PST) allows you to connect your PC to equipment to control and monitor all sorts of things. It runs on a Raspberry Pico. It would be nice if the PST could supports device dependent SCPI registers. They can be used to notify a LabVIEW flow from the device. I'd be happy if we can notify LabVIEW when a GPIO input changed logic level.
In this post: I continue to test the registers fanout up to the USBTMC Service Request Event generation.

image

part 1: PST.. Experimental event / trigger support for Pico SCPI labTool - 1: investigate 
part 2: PST.. Experimental event / trigger support for Pico SCPI labTool - 2: design the registers 
part 3: PST.. Experimental event / trigger support for Pico SCPI labTool - 3: Instrument Specific Registers Test
part 4: PST.. Experimental event / trigger support for Pico SCPI labTool - 4: let TinyUSB USBTMC code use SCPI-LIB's Status Byte register 
part 5:  PST.. Experimental event / trigger support for Pico SCPI labTool - 5: Propagation to IEEE488.2 SCPI Registers Test 
part 6: PST.. Experimental event / trigger support for Pico SCPI labTool - 6: Service Request from Instrument to LabVIEW flow 
part 7: PST.. Experimental event / trigger support for Pico SCPI labTool - 7: Test Service Request from Instrument to LabVIEW flow 

Test Setup

I continue from post 3  PST.. Experimental event / trigger support for Pico SCPI labTool - 3: Instrument Specific Registers Test. 

We managed to fan a negative transition on Digital In PIN 2 (a button connected to GPI27), to the standard Operation Status register. Let's now test the upstream up to STB and SRE

image

Tests will systematically test

  • can I propagate an event from the Operation Status register to the Status Byte register?
  • did I land in the SCPI-LIB and USBTMC Service Request invocation code?

Test IEEE488.2 Standard Registers

Let's first bring the device in the condition that button presses fan out to OPERATION STATUS EVENT register.

STATus:OPERation:DIGItal:INPut:NTRansition 4\n
STATus:OPERation:DIGItal:INPut:ENABle 4\n
*CLS\n

Do this before each of the test cases. This will take care that the next button push will propagate to that bit.

test 1: OPERATION STATUS ENABLE and STB registers

condition:

  1. When OPERATION STATUS EVENT register Bit 0 is set (see part 3 on how to do that), STB OPS bit (Bit 7) should not be set (we have not enabled it)
  2. Set OPERATION STATUS ENABLE register bit 0 to 1. Query it back.
  3. STB OPS bit (Bit 7) should still be 0,  because we did not generate an OPERATION STATUS event
  4. Push the button to make OPERATION STATUS EVENT Bit 0 go to 1. STB Pin 7 should now be 1

result;

1:Query STB by pressing the VI VISA tool's Read Status Byte button (this does not clear bits)

0

2: Enable the fan-out, and check back

STATus:OPERation:ENABle 1
STATus:OPERation:ENABle?
1

3: Query STB by pressing the VI VISA tool's Read Status Byte button (this does not clear bits)

0

4: Push the button. Push the button STB Bit 7 should be 1

128

pass

test 2: SERVICE REQUEST ENABLE register (and do we land in the Service Request code?)

condition:

  1. Start the firmware in a debugger. Set a breakpoint in first line of SCPI lib source file ieee488.c, function writeControl(). Run the test case initialisation commands.
    Enable the Operation Status propagation too.
    Debugger should not break yet.
  2. Set SERVICE REQUEST ENABLE register OPER Bit 7 to 1. Query it back.
    Push the button to make OPERATION STATUS EVENT Bit 0 go to 1. The debugger should break

result;

1: I use VSCode. Started the firmware in debug mode with the breakpoint set. Executed the 3 initialisation SCPI commands

STATus:OPERation:DIGItal:INPut:NTRansition 4
STATus:OPERation:DIGItal:INPut:ENABle 4
*CLS
STATus:OPERation:ENABle 1
debugger doesn't break

2: Enable propagation by setting SRE Bit 7 (OPER Bit) to 1, and control if it is set

*SRE 128
*SRE?
128
#push
code breaks :)

image

pass

link to all posts

  • Sign in to reply

Top Comments

  • ggabe
    ggabe over 2 years ago +1
    If I can ever get SWD up and running, I would look here:
  • ggabe
    ggabe over 2 years ago in reply to Jan Cumps +1
    The readSTB "timeout" I referred to was when I faked sending it's response to mimic an SRQ. So the timeout/erroron readSTB is absolutely legitimate and expected, as the readSTB was not responded to. …
Parents
  • ggabe
    ggabe over 2 years ago

    If I can ever get SWD up and running, I would look here:

    image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago in reply to ggabe

    If you use SDK 1.5, I could share my setup with you.

    I use a second Pico (in this case a XIAO Pico  - but works with a Raspberry Pico too) as a debugger. With VS Code integration.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ggabe
    ggabe over 2 years ago in reply to Jan Cumps

    Thx for offering! Now I'm up and running with SWD. Magic line 858 only gets invoked when I call read_stb() in PyVisa. Seems to be the only way to get the interrupt endpoint firing anything. This is what I think: When the BP stops on line 858, stack trace might show an opportunity to find the loop to dequeue an SRQ send request. We should find or define one if none exist. Also, we might need an appropriate bTag, if 7F is not the one. That's where I'm at. A little complication is the when CFG_TUSB_DEBUG is turned on USB times out, presumably to the slow UART. Ant there's no SWO on the Pico.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ggabe
    ggabe over 2 years ago in reply to Jan Cumps

    Got an SRQ event fired in PyVisa! Faked a response of an incoming status request to match the bTag of an async SRQ. Did it by setting the tag to 0x01 as in Table 6 of the USB488 specs, and voila, NI IO Trace and PyVisa both identified it as an SRQ!

    image

    image

    The read status byte request timed out, however it's encouraging to see PyVisa got it!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • ggabe
    ggabe over 2 years ago in reply to Jan Cumps

    Got an SRQ event fired in PyVisa! Faked a response of an incoming status request to match the bTag of an async SRQ. Did it by setting the tag to 0x01 as in Table 6 of the USB488 specs, and voila, NI IO Trace and PyVisa both identified it as an SRQ!

    image

    image

    The read status byte request timed out, however it's encouraging to see PyVisa got it!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • Jan Cumps
    Jan Cumps over 2 years ago in reply to ggabe

    When I implemented the registers, I used up all my free brain capacity Slight smile.

    Now that's finished, can spend time trying to fully understand the communication.

    > The read status byte request timed out

    I need to check that. It seems to work with the NI VISA Interactive Control application...

    There is more to check. I think that the application currently not always removes the MAV flag. Maybe I can run the original TinyUSB example and see if it's my code or the example framework...

    edit: I think it's a library manco:

    // TODO:
    // ...
    // Clear message available status byte at the correct time? (488 4.3.1.3)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago in reply to ggabe

    > The read status byte request timed out, however it's encouraging to see PyVisa got it!

    Without changing code, the ReadSTB doesn't time out for me

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube