Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:24 08 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Sending data to PC - with USB Terminal enabled - Port replication

Author Message
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 419
Posted: 11:59am 01 Jun 2025
Copy link to clipboard 
Print this post

So I did a thing - now looking to see if there is an easier way..

I have a vanilla Picomite connected to a PC, accessed via TeraTerm.  As always, works well, rock solid.

I am collecting data and saving to a txt file. Happens to be temp (from thermocouple), pressure and timestamp - but the data itself is irrelevant to this.

Once the collection is over, XModem to send the data to TeraTerm.  Works well - never any issues, especially as the datafile is saved on the 'mite.

But that requires the user to initiate an Xmodem Receive.  Now, users being users, I can't seem to cement in their minds that this is the work flow - so I rewrote the code to include the XModem command and a user prompt to start the down load.  A little bit better, but still.. users!

Ideally what I want is the ability to simultaneously use the 'mite in terminal mode and receive data down the same terminal session.

My first stab at this was to install another serial adapter on the mite (FT232RL based) and open another com port on the PC.  This works, but still the data needs TeraTerm to save it out.

So **Python** to the rescue - open the new port, grab the data and save to file.  Works as expected.

BUT this requires another board on the 'mite.

Googling led me to "port replication" where you can effectively clone a COM port and have two programs monitoring the same port.  For eg - clone COM3 into COM4 & COM5.

Picomite on COM4 (really COM3 under the hood) and Python on COM5 (again COM3 under the hood).  

To stop all the 'mite editor etc being sent to Python and saved, the Python script looks for the string "Starting Logging" in the received data and then records all terminal output to a text file.  When it then receives "Stopped" it closes the file.

That way I can remove the need for telling the user to XMODEM etc and they have a file ready to use in Excel.

Now, I imagine this port cloning is easy in Linux - but never come across it in Windows.

Used the free version of Port cloning, Windows << dont need the features of the premium version.

Phew - so the questions are:  

(1) Is there an easier way to do this without Python?  Can you force XModem transfer without user intervention?
(2) Would a WebMite interface work for this?  But in a similar manner can I connect the 'mite to COM port and use terminal for running AND also connect to an IP address -- suspect not but need to ask.
Entropy is not what it used to be
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10223
Posted: 12:20pm 01 Jun 2025
Copy link to clipboard 
Print this post

If you use a webmite it supports a tftp server by default. You can then initiate transfer from the PC using any simple tftp client.
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 419
Posted: 12:22pm 01 Jun 2025
Copy link to clipboard 
Print this post

  matherp said  If you use a webmite it supports a tftp server by default. You can then initiate transfer from the PC using any simple tftp client.


Nice -- and this will work at the same time as the 'mite connected to TeraTerm?
Entropy is not what it used to be
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10223
Posted: 12:24pm 01 Jun 2025
Copy link to clipboard 
Print this post

yes
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 419
Posted: 12:41pm 01 Jun 2025
Copy link to clipboard 
Print this post

  matherp said  yes


Perfect - now to get a new Pico  (always a good day)

Thanks
Entropy is not what it used to be
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 419
Posted: 01:24pm 01 Jun 2025
Copy link to clipboard 
Print this post

Digger further...

Now compiled the Python to an exe (1.5Mb) so that Python does not need to be installed on the host computer.

Prototype for the client:

Picomite connected to a cloned com port
EXE running on the computer all the time monitoring the cloned com port
Evertime the test routine is run a new .txt file is created and saved locally on the host pc

No downloads needed - user just needs to click the icon for the exe and off they go.

Love how flexible the 'mites are and how quick it is to spin up prototypes.

Off for a celebratory cup of tea.
Entropy is not what it used to be
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025