UART via USB disconnects on its own during Read/Write to Modem

Frequent questions asked online, offline, in forums are answered here
Post Reply
Ren
Posts: 2
Joined: Fri Oct 27, 2023 3:38 am

UART via USB disconnects on its own during Read/Write to Modem

Post by Ren »

Hello,

I am suffering from the phenomenon in the title.
I am trying on Windows 10 with SW v7.700, and the Dashboard is working fine, but when I do a Read on a USB-connected modem with our C# program with c-library, the USB connection disconnects by modem and reconnects again. (This does not occur with Dashboard).
May possibly Read/Write is not supported by the virtual via USB, so is it necessary to use a pin header?
The following are the commands I tried.
- Read Firmware Version (Code of data in packet: 0xfe00)
- Read Modem Configuration (Code of data in packet: 0x5000)
- Read Submap Configuration (Code of data in packet: 0x60xx)
All of them can be received up to the first half of the response, but then a TimeoutException occurs and the device disconnect/connect sound is emitted...
I tried to capture the communication between the Dashboard and the Modem to see if there is any etiquette before performing a Read/Write to the Modem (for example, stopping the stream that automatically flows upon connection), but there does not seem to be any particular command to stop it, so I am at a bit of a loss.
*However, the code of data in packet of the first read command thrown from the Dashboard is 0xfe01, which is not listed in the interface document, so I am guessing that some special exchange is necessary.
If you have any knowledge on this, we would appreciate it if you could provide us with some guidance.

I was wondering if the following statement in the "interfaces and protocols" is relevant.
" 3.1 ‘Marvelmind’ protocol for streaming
All packets described in corresponding section for UART are also available via USB (virtual UART).
Note these data are also available for mini-Tx and for mini-Rx without ‘UART Cable for Mini-Rx’.
Streaming is terminated for 5 seconds if Marvelmind device receives any request according to
this protocol. "

My guess is that it stops for 5 seconds, and if I don't send the same Read packet again during that time, it will be automatically disconnected, etc...?

[Our Already Checked Document]
interfaces and protocols : 2023.07.16
Operating Manual : v2023_08_09

[Our Already Checked Topics]
viewtopic.php?f=2&t=35696
viewtopic.php?t=35407

Thanks for your continuous support.
Ren @ iXs
Attachments
Dashboard's initial read command (yellow highlight).jpg

kalyl
Posts: 2
Joined: Fri Dec 08, 2023 5:00 am

Re: UART via USB disconnects on its own during Read/Write to Modem

Post by kalyl »

Ren wrote:
Fri Oct 27, 2023 4:24 am
Hello,

I am suffering from the phenomenon in the title.
I am trying on Windows 10 with SW v7.700, and the Dashboard is working fine, but when I do a Read on a USB-connected modem with our C# program with c-library, the USB connection disconnects by modem and reconnects again. (This does not occur with Dashboard).
May possibly Read/Write is not supported by the virtual via USB, so is it necessary to use a pin header?
The following are the commands I tried.
- Read Firmware Version (Code of data in packet: 0xfe00)
- Read Modem Configuration (Code of data in packet: 0x5000)
- Read Submap Configuration (Code of data in packet: 0x60xx)
All of them can be received up to the first half of the response, but then a TimeoutException occurs and the device disconnect/connect sound is emitted...
I tried to capture the communication between the Dashboard and the Modem to see if there is any etiquette before performing a Read/Write to the Modem (for example, stopping the stream that automatically flows upon connection), but there does not seem to be any particular command to stop it, so I am at a bit of a loss.
*However, the code of data in packet of the first read command thrown from the Dashboard is 0xfe01, which is not listed in the interface document, so I am guessing that some special exchange is necessary.
If you have any knowledge on this, we would appreciate it if you could provide us with some guidance.

I was wondering if the following statement in the "interfaces and protocols" is relevant.
" 3.1 ‘Marvelmind’ protocol for streaming
All packets described in corresponding section for UART are also available via USB (virtual UART).
Note these data are also available for mini-Tx and for mini-Rx without ‘UART Cable for Mini-Rx’.
Streaming is terminated for 5 seconds if Marvelmind device receives any request according to
this protocol. "

My guess is that it stops for 5 seconds, and if I don't send the same Read packet again during that time, it will be automatically disconnected, etc...?

[Our Already Checked Document]
interfaces and protocols : 2023.07.16
Operating Manual : v2023_08_09

[Our Already Checked Topics]
viewtopic.php?f=2&t=35696
viewtopic.php?t=35407 geometry dash

Thanks for your continuous support.
Ren @ iXs
The use of an undocumented command in the Dashboard ("Read Firmware Version" with a code of 0xFE01) might indeed suggest a specific exchange or initialization. It's not uncommon for manufacturers to use proprietary commands for certain operations.

woozyinfinity
Posts: 3
Joined: Tue Nov 29, 2022 5:57 am

Re: UART via USB disconnects on its own during Read/Write to Modem

Post by woozyinfinity »

Thank you for the clear explanationhappy wheels. :)
Last edited by woozyinfinity on Mon Jan 08, 2024 5:56 am, edited 1 time in total.

Ren
Posts: 2
Joined: Fri Oct 27, 2023 3:38 am

Re: UART via USB disconnects on its own during Read/Write to Modem

Post by Ren »

Thanks for the reply kalyl.
I am still investigating, but it still seems that a significant amount of commands are not written in the communication specification <marvelmind_interfaces.pdf (2023.11.26)>.
https://marvelmind.com/pics/marvelmind_interfaces.pdf

Also, the c and c# sample code seems to be communicating with a configuration that does not use FlowControl, but as you can see in the attached screenshot of the serial monitor, the stock Dashboard seems to be using at least the control line with RTS/DTR.
https://marvelmind.com/pics/marvelmind_c_sharp.zip

Let me guess, the command to transition from streaming mode to Write-Read mode seems to be hidden in the attached log < Marvelmind_Dashboard_Initiation.pdf >.

Until these packet structures are known, I think it will be difficult to adopt them into embedded devices without operation of Dashboard...
MarvelmindPortMonitoring.jpg
Marvelmind_Dashboard_Initiation.pdf.zip
(781.95 KiB) Downloaded 65 times

smoker77
Posts: 392
Joined: Sat Feb 06, 2016 3:03 pm

Re: UART via USB disconnects on its own during Read/Write to Modem

Post by smoker77 »

Hello Ren,

I will copy here my email reply on similar question:

Yes, some commands in the modem protocol are not described in the document, because after releasing the API we recommend using the API instead of implementing communication using the low level protocol.
The API is described in section 10 of the document:
https://marvelmind.com/pics/marvelmind_interfaces.pdf

For example, the command with code 0xFE01 is the updated version of the 0xFE00 'read version' command. Answer on 0xFE01 includes the CPU ID of the device in addition to the version.

Switching from streaming mode to Write-read mode is executed by any command.
Switching from Write-read mode to streaming mode is executed after 5 seconds without any commands.

Additionally, some versions of software have had a bug causing restarting of the USB communication by the modem after 5 seconds of commands absence.
Please update to the latest version to fix this issue:
https://marvelmind.com/pics/marvelmind_SW.zip

Another case when a modem can restart a USB port is if the host sends more than 3 'read version' (0xFE00 or 0xFE01) commands subsequently.
Modem treats it as the host can't receive modem's replies, the USB communication is not operational and needs to be restarted.
So please don't send 'read version' commands to the modem more than 3 times without any other commands between 'read version' requests.

You can check the C example for the API, it can be found in the software package and available in sources and I also attached it to this mail.
This example is a tiny console 'dashboard' and its communication sequence is similar to the dashboard.
You can start exploring it from the function 'marvelmindCycle()' in marvelmind_example.c.

Post Reply