dektronics / printalyzer-timer

F-Stop enlarging timer and print exposure meter
24 stars 6 forks source link

Some USB-to-serial adapters send garbage when first connected #21

Closed dkonigsberg closed 11 months ago

dkonigsberg commented 3 years ago

This issue has been observed with both the FTDI FT232R and SI CP2102 adapters that have been tested, but does not appear to happen with the PL2303 adapter.

Whenever one of these adapters is plugged in and powered up, a garbage character (typically 0xFF) is sent out its serial port. After this, it seems to behave normally. (This does not happen when connecting the same adapters to the USB ports of any of my computers.)

Attempting to narrow down the cause via firmware tinkering seems to correlate this behavior to toggling the VBUS connection. If everything else about the USB port is disabled, except for that, toggling the associated GPIO triggers the issue. The most likely root cause is some sort of transient on the VBUS line, or nearby interference. This will need to be debugged with an oscilloscope to be sure of what is going on.

In a worst case scenario, this issue can likely be worked around. It will confuse certain X-Rite densitometers, but their serial interface can be recovered by sending the right command to them.

dkonigsberg commented 3 years ago

After some lab testing, it isn't clear that this issue has an obvious cause or is worth fixing.

It seems like the cause could very well be an extreme sensitivity (only at startup) to power supply (or ground) behavior/noise in a way that's proving hard to pin down.

When powering the dongle via a quality bench supply, the issue does not manifest the majority of the time. However, it still does happen on rare occasion.

While this issue does not happen if the FT232R dongle is plugged into one of my desktop's USB ports (as stated above), it absolutely does happen if I plug that same dongle into one of my laptop's USB ports. Therefore, it may be practically unavoidable.

If this issue is left unfixed, then a comment should be added to the user manual. If the dongle is connected to a densitometer in output-only mode, this issue does no harm. However, if that densitometer has remote-control enabled, it may lock up the local user interface. It is possible to unlock that interface via the remote control serial protocol, but only once we actually start supporting that protocol.

dkonigsberg commented 11 months ago

Closing as this is likely just a known issue with these parts, and not something that can be resolved.