Email: helpdesk@telkomuniversity.ac.id

This Portal for internal use only!

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Categories
  • Microsoft
    • Microsoft Apps
    • Office
    • Operating System
    • VLS
    • Developer Tools
    • Productivity Tools
    • Database
    • AI + Machine Learning
    • Middleware System
    • Learning Services
    • Analytics
    • Networking
    • Compute
    • Security
    • Internet Of Things
  • Adobe
  • Matlab
  • Google
  • Visual Paradigm
  • WordPress
    • Plugin WP
    • Themes WP
  • Opensource
  • Others
More Categories Less Categories
  • Get Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • My Account
    • Download
    • Cart
    • Checkout
    • Login
  • About Us
    • Contact
    • Forum
    • Frequently Questions
    • Privacy Policy
  • Forum
    • News
      • Category
      • News Tag

iconTicket Service Desk

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Menu
  • Home
    • Download Application Package Repository Telkom University
    • Application Package Repository Telkom University
    • Download Official License Telkom University
    • Download Installer Application Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • All Pack
    • Microsoft
      • Operating System
      • Productivity Tools
      • Developer Tools
      • Database
      • AI + Machine Learning
      • Middleware System
      • Networking
      • Compute
      • Security
      • Analytics
      • Internet Of Things
      • Learning Services
    • Microsoft Apps
      • VLS
    • Adobe
    • Matlab
    • WordPress
      • Themes WP
      • Plugin WP
    • Google
    • Opensource
    • Others
  • My account
    • Download
    • Get Pack
    • Cart
    • Checkout
  • News
    • Category
    • News Tag
  • Forum
  • About Us
    • Privacy Policy
    • Frequently Questions
    • Contact
Home/Matlab/How do I reconnect USB serial that gets lost programatically.

How do I reconnect USB serial that gets lost programatically.

PuTI / 2025-01-19
How do I reconnect USB serial that gets lost programatically.
Matlab News

MatLab R2024b using AppDesigner on Windows 10 Enterprise
My GUI app connects to an Arduino which sometimes looses it’s connection or reboots itself.
I’m trying to detect when connection is lost and reconnect, but after getting an error message in the Command Window:
Unable to detect connection to the serialport device. Ensure that the device is plugged in and create a new serialport object.
My program (at least interacting with it in the CW is hung until I Ctrl-C.
I have set a dummy breakpoint so I can see variables from the Command Window (It doesn’t seem to know anything about my app until I break, but at least the program still runs after the break button is pushed)
So here’s what happens in CW with my comments added in bold and extra blank lines removed:
2513 pause(0.5); Pressed the Break Button
K>> app.PicoCom Look at my Serial Port connection
ans =
Serialport with properties:
Port: "COM11"
BaudRate: 57600
NumBytesAvailable: 0
etc… Now I reboot my Arduino and get:
Unable to detect connection to the serialport device. Ensure that the device is plugged in and create a new serialport object.
K>> app.PicoCom Try to look at serial port (or do ANYTHING)
[CW hangs until I hit Ctrl-C – WHY?
Operation terminated by user during MouseOdor61/RunOneTrial (line 1131)
In MouseOdor61/DoSession (line 1238)
etc
In matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 60)
newCallback = @(source, event)executeCallback(ams, …
^^^^^^^^^^^^^^^^^^^^^^^^
Interrupt while evaluating Button PrivateButtonPushedFcn.
ans =
Serialport with properties:
In
‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for parameter
{0}.
Now I can try to see the handle again.
K>> app.PicoCom
ans =
Serialport with properties:
In
‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for
parameter {0}.
Not very helpful. At this point I can see:
K>> serialportlist()
ans =
1×2 string array
"COM1" "COM11"
To recover this seems to work:
K>> delete(app.PicoCom)
Let’s check
K>> app.PicoCom
ans =
handle to deleted Serialport
Reconnect
K>> app.PicoCom = serialport
[ shows every object in app! If I don’t add the ;]
K>> app.PicoCom
ans =
Serialport with properties:
Port: "COM11"
BaudRate: 57600
Tag: ""
NumBytesAvailable: 0
OK, it’s back, all I need to add, it appears is the callback
K>> configureCallback(app.PicoCom,"terminator",@app.PicoInput)
I’ve tried putting things in my callback for input (like try … catch) but it never gets there.
It’s stuck in matlab.apps.AppBase not my code
I also added checks in the output routine to the Arduino, but it doesn’t seem to be helpful. That thread is stuck! I can press another button in the app the forces a reconnect but I want it to happen without user intervention.
How can I detect and trap the loss of COM in my program? (Obviously I want to stop the Pico from rebooting, but meanwhile my users need some decent work around).MatLab R2024b using AppDesigner on Windows 10 Enterprise
My GUI app connects to an Arduino which sometimes looses it’s connection or reboots itself.
I’m trying to detect when connection is lost and reconnect, but after getting an error message in the Command Window:
Unable to detect connection to the serialport device. Ensure that the device is plugged in and create a new serialport object.
My program (at least interacting with it in the CW is hung until I Ctrl-C.
I have set a dummy breakpoint so I can see variables from the Command Window (It doesn’t seem to know anything about my app until I break, but at least the program still runs after the break button is pushed)
So here’s what happens in CW with my comments added in bold and extra blank lines removed:
2513 pause(0.5); Pressed the Break Button
K>> app.PicoCom Look at my Serial Port connection
ans =
Serialport with properties:
Port: "COM11"
BaudRate: 57600
NumBytesAvailable: 0
etc… Now I reboot my Arduino and get:
Unable to detect connection to the serialport device. Ensure that the device is plugged in and create a new serialport object.
K>> app.PicoCom Try to look at serial port (or do ANYTHING)
[CW hangs until I hit Ctrl-C – WHY?
Operation terminated by user during MouseOdor61/RunOneTrial (line 1131)
In MouseOdor61/DoSession (line 1238)
etc
In matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 60)
newCallback = @(source, event)executeCallback(ams, …
^^^^^^^^^^^^^^^^^^^^^^^^
Interrupt while evaluating Button PrivateButtonPushedFcn.
ans =
Serialport with properties:
In
‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for parameter
{0}.
Now I can try to see the handle again.
K>> app.PicoCom
ans =
Serialport with properties:
In
‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for
parameter {0}.
Not very helpful. At this point I can see:
K>> serialportlist()
ans =
1×2 string array
"COM1" "COM11"
To recover this seems to work:
K>> delete(app.PicoCom)
Let’s check
K>> app.PicoCom
ans =
handle to deleted Serialport
Reconnect
K>> app.PicoCom = serialport
[ shows every object in app! If I don’t add the ;]
K>> app.PicoCom
ans =
Serialport with properties:
Port: "COM11"
BaudRate: 57600
Tag: ""
NumBytesAvailable: 0
OK, it’s back, all I need to add, it appears is the callback
K>> configureCallback(app.PicoCom,"terminator",@app.PicoInput)
I’ve tried putting things in my callback for input (like try … catch) but it never gets there.
It’s stuck in matlab.apps.AppBase not my code
I also added checks in the output routine to the Arduino, but it doesn’t seem to be helpful. That thread is stuck! I can press another button in the app the forces a reconnect but I want it to happen without user intervention.
How can I detect and trap the loss of COM in my program? (Obviously I want to stop the Pico from rebooting, but meanwhile my users need some decent work around). MatLab R2024b using AppDesigner on Windows 10 Enterprise
My GUI app connects to an Arduino which sometimes looses it’s connection or reboots itself.
I’m trying to detect when connection is lost and reconnect, but after getting an error message in the Command Window:
Unable to detect connection to the serialport device. Ensure that the device is plugged in and create a new serialport object.
My program (at least interacting with it in the CW is hung until I Ctrl-C.
I have set a dummy breakpoint so I can see variables from the Command Window (It doesn’t seem to know anything about my app until I break, but at least the program still runs after the break button is pushed)
So here’s what happens in CW with my comments added in bold and extra blank lines removed:
2513 pause(0.5); Pressed the Break Button
K>> app.PicoCom Look at my Serial Port connection
ans =
Serialport with properties:
Port: "COM11"
BaudRate: 57600
NumBytesAvailable: 0
etc… Now I reboot my Arduino and get:
Unable to detect connection to the serialport device. Ensure that the device is plugged in and create a new serialport object.
K>> app.PicoCom Try to look at serial port (or do ANYTHING)
[CW hangs until I hit Ctrl-C – WHY?
Operation terminated by user during MouseOdor61/RunOneTrial (line 1131)
In MouseOdor61/DoSession (line 1238)
etc
In matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 60)
newCallback = @(source, event)executeCallback(ams, …
^^^^^^^^^^^^^^^^^^^^^^^^
Interrupt while evaluating Button PrivateButtonPushedFcn.
ans =
Serialport with properties:
In
‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for parameter
{0}.
Now I can try to see the handle again.
K>> app.PicoCom
ans =
Serialport with properties:
In
‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for
parameter {0}.
Not very helpful. At this point I can see:
K>> serialportlist()
ans =
1×2 string array
"COM1" "COM11"
To recover this seems to work:
K>> delete(app.PicoCom)
Let’s check
K>> app.PicoCom
ans =
handle to deleted Serialport
Reconnect
K>> app.PicoCom = serialport
[ shows every object in app! If I don’t add the ;]
K>> app.PicoCom
ans =
Serialport with properties:
Port: "COM11"
BaudRate: 57600
Tag: ""
NumBytesAvailable: 0
OK, it’s back, all I need to add, it appears is the callback
K>> configureCallback(app.PicoCom,"terminator",@app.PicoInput)
I’ve tried putting things in my callback for input (like try … catch) but it never gets there.
It’s stuck in matlab.apps.AppBase not my code
I also added checks in the output routine to the Arduino, but it doesn’t seem to be helpful. That thread is stuck! I can press another button in the app the forces a reconnect but I want it to happen without user intervention.
How can I detect and trap the loss of COM in my program? (Obviously I want to stop the Pico from rebooting, but meanwhile my users need some decent work around). reconnect usb MATLAB Answers — New Questions

​

Tags: matlab

Share this!

Related posts

How do I find the corner points of an mask
2025-05-09

How do I find the corner points of an mask

Upper limit on the number of UIAxes children allowed
2025-05-09

Upper limit on the number of UIAxes children allowed

Running Simulink Online on Selfhosted Docker MATLAB Online Instance
2025-05-09

Running Simulink Online on Selfhosted Docker MATLAB Online Instance

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Categories

  • Matlab
  • Microsoft
  • News
  • Other
Application Package Repository Telkom University

Tags

matlab microsoft opensources
Application Package Download License

Application Package Download License

Adobe
Google for Education
IBM
Matlab
Microsoft
Wordpress
Visual Paradigm
Opensource

Sign Up For Newsletters

Be the First to Know. Sign up for newsletter today

Application Package Repository Telkom University

Portal Application Package Repository Telkom University, for internal use only, empower civitas academica in study and research.

Information

  • Telkom University
  • About Us
  • Contact
  • Forum Discussion
  • FAQ
  • Helpdesk Ticket

Contact Us

  • Ask: Any question please read FAQ
  • Mail: helpdesk@telkomuniversity.ac.id
  • Call: +62 823-1994-9941
  • WA: +62 823-1994-9943
  • Site: Gedung Panambulai. Jl. Telekomunikasi

Copyright © Telkom University. All Rights Reserved. ch

  • FAQ
  • Privacy Policy
  • Term

This Application Package for internal Telkom University only (students and employee). Chiers... Dismiss