BASICtools and USB connect/disconnect

Questions on UARTs, and serial communication
Post Reply
basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

BASICtools and USB connect/disconnect

Post by basicchip »

BASICtools checks the registry for serial ports when it starts up.

If your device is not connected at that time, it will not be in the list of available serial ports.

BASICtools does not currently detect changes in hardware (like disconnecting or connecting USB devices).

So if you connect a device or change connections, you must REFRESH the serial ports under options for BASICtools to recognize that change.

There may be ways we can add this at some future date, but for now if you change USB connections, you must do the REFRESH and then choose the proper serial port; even if it appears to be the same port. When disconnected Windows closes the port, but does not flag that as an event, so BASICtools just gets an error when it tries to access it without having been re-opened.



Richard
Posts: 1
Joined: Sun Sep 02, 2018 8:58 am

Re: BASICtools and USB connect/disconnect

Post by Richard »

And I thought that I had problems with the system, and that's just not supporting the device with software. Got it. That's how it was. :? :? :? Thank you for solving the problem!

TodWulff
Posts: 70
Joined: Fri Oct 19, 2012 4:03 am
Location: The Mitten State - Shores of Lake Huron

Re: BASICtools and USB connect/disconnect

Post by TodWulff »

Pseudo related: I've seen some weirdness WRT forcing a hardware reset on a 11U37 ARMstamp and USB enumeration of the (virtual) serial port for the ARMstamp, subsequent to said hardware reset. I understand that the MCU has the USB UART peripheral internal thereto.

I suspect that when the /RESET/ line is toggled low, that the internal USB peripheral hardware is resets too.

I am wondering if there is a way to reset the core, but to leave the state of the enumerated USB peripheral device instance alone? That sort of grinds against the concept of a hardware reset, but, given our context, it seems to possibly be a means to reduce the drama related to having to re-instantiate connectivity with the device after every reset.

My use case has been that as I dev code, and flash it, that stroking a reset button to restart the user app is how I've always done it - as part of my code/debug/loop dev process. I have experienced that doing so with an ARMstamp now imputes having to physically disconnect/reconnect the device, and then iterate with BT to get connectivity with the device reinstantiated. It is a bit of a kludge, I perceive.

However, given that I've been away from the embedded dev side of the house for a bit, I solicit the audience for input: Is there a different process I could adopt that would enable this sort of ease (stroking a button to reset the core, while leaving the enumerated BT peripheral's state alone, ensuring connectivity with the target is maintained)?

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: BASICtools and USB connect/disconnect

Post by basicchip »

On the LPC11U37 or ARM Stamp the USB serial device is built in, so there is no separate serial lines, or control lines. So a hard reset would always cause a re-enumeration from the PC.

On the ARM Stamp, we handle the STOP button, but RESET button really doesn't do much.

If your BASIC program is running on the ARM Stamp and you STOP it, if you hit RUN it will recompile and run the program.

If your BASIC program had ended, and you hit RUN, it will just run the last program loaded. In this case what is really happening is when you hit RUN a ^ is sent to the ARM Stamp, and if it is not executing a program it will start up the last one loaded.

TodWulff
Posts: 70
Joined: Fri Oct 19, 2012 4:03 am
Location: The Mitten State - Shores of Lake Huron

Re: BASICtools and USB connect/disconnect

Post by TodWulff »

Understood. Yeah, I get it. Makes sense. Thank you, sir.

Post Reply