element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
NI LabVIEW Community
  • Products
  • Dev Tools
  • NI LabVIEW Community
  • More
  • Cancel
NI LabVIEW Community
NI Forum Getting error when running with custom firmware on pico with labview
  • Blog
  • LabVIEW Challenge Blogs
  • Forum
  • Documents
  • Quiz
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join NI LabVIEW Community to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 33 replies
  • Subscribers 124 subscribers
  • Views 3945 views
  • Users 0 members are here
  • LabVIEW and Test Automation Course
  • pico
  • labview
Related

Getting error when running with custom firmware on pico with labview

cbohra00627
cbohra00627 over 1 year ago

I am trying to create a labview driver for controlling the pi pico led. I went through the Digital Out Control.vi VI in pico_scpi_usbtmc_labtool and tried to replicate it for the led control. I took the blink example from pico-sdk examples directory and added the function to control led (i.e. gpio_put(LED_PIN, 1)) to the SCPI_DigitalOutput() function of gpio_utils.c file in pico_scpi_usbtmc_labtool. I created a new firmware with this change and loaded on pi pico. Now, whenever I do digital write HIGH, the led is turning on.

But when I tried to create a separate driver for led control with a separate SCPI command, I am getting some error while running the VI. The build was successful with my change and I loaded the firmware on the pico, but when I am trying to run my VI (snip attached below), I am getting the below error.

image

Code for led control:

led_utils.c:

image

led_utils.h

image

I have added the led executable and dir path to Cmakelists.txt and also added the INSTRUMENT_LED_OUTP_COMMANDS macro to scpi commands list in scpi-def.c

Am I missing something? Has anyone seen this error before?

  • Sign in to reply
  • Cancel

Top Replies

  • Andrew J
    Andrew J over 1 year ago +4
    This is failing in the init code, so it’s not even reaching your code. One of the installed tools with LabVIEW is NI I/O Trace. Run that, turn on tracing, then run the VI again and see if that gives you…
  • cbohra00627
    cbohra00627 over 1 year ago in reply to Jan Cumps +3
    Its working now!
  • Jan Cumps
    Jan Cumps over 1 year ago in reply to Andrew J +2
    The init block indeed checks for the IDN* string I haven't exposed the connectors to the button that can turn ID Check off. You can do this yourself, by clicking on the connector location in the…
Parents
  • cbohra00627
    0 cbohra00627 over 1 year ago

    I ran the NI I/O trace, in that I am seeing error in alternate VISA read commands.
    image

    Then I ran the existing VI and my VI, I could see that there is some issue in the VISA Write command.

    image

    The VISA Write commands are different even if I am using similar format in the string.

    imageimage

    The string in my command is not proper and I think that is causing the issue for the next run.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Jan Cumps
    0 Jan Cumps over 1 year ago in reply to cbohra00627

    yes.Right-click on the yellow format block, and select Edit Format String

    image

    What do you see (the one from my digital output as example)?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • cbohra00627
    0 cbohra00627 over 1 year ago in reply to Jan Cumps

    Its showing "%s" only.

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Jan Cumps
    0 Jan Cumps over 1 year ago in reply to cbohra00627

    You can type the correct string there. Replace the %s with:

    :LED:OUTPUT %s\n

    then press OK,and test again

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Andrew J
    +1 Andrew J over 1 year ago in reply to cbohra00627

    Shouldn't that be into a terminal on the top of the Format block, not the left?  It may just be the way the wire is shown but there is a terminal on the left there (intro string I think) and it's the wrong one so the default %s is tagged on to the end.  Look at how the :Digital:OUTPUT:... to the left is wired.  Also, you'll need to sort out the \\n: that's a result of setting display codes on when you already had the \n in the string - it's all a bit poor unfortunately, but I found the easiest was to delete the \\n then re-edit the string and just add \n.  I think, it's been a while since I had the problem!

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Jan Cumps
    0 Jan Cumps over 1 year ago in reply to Andrew J

    yes well spotted that's it ! The left top is initial string, top format string.

    Wrong connector used.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Jan Cumps
    0 Jan Cumps over 1 year ago in reply to Andrew J
    Andrew J said:
    Also, you'll need to sort out the \\n: that's a result of setting display codes

    If you use the Edit Format String option, you don't have to care about the "display codes" setting.

    It's less confusing.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Andrew J
    0 Andrew J over 1 year ago in reply to Jan Cumps

    Really?  If that works it is an excellent, truly excellent tip!  

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • cbohra00627
    0 cbohra00627 over 1 year ago in reply to Jan Cumps

    Its working now!

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Andrew J
    0 Andrew J over 1 year ago in reply to cbohra00627

    Great.  Just to convince you - posting the NI I/O Trace helped us spot the error.  If you can't spot the problem with breakpoints and probes, that tool is your go to debugging aid because it shows what is actually happening.  Looking at the trace, you can see how the SCPI command has been mangled.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Andrew J
    0 Andrew J over 1 year ago in reply to cbohra00627

    Great.  Just to convince you - posting the NI I/O Trace helped us spot the error.  If you can't spot the problem with breakpoints and probes, that tool is your go to debugging aid because it shows what is actually happening.  Looking at the trace, you can see how the SCPI command has been mangled.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • cbohra00627
    0 cbohra00627 over 1 year ago in reply to Andrew J

    Yes, after looking at the I/O trace, it became easier to identify the problem for me also.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • 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