1

The application uses serial communication over USB and works fine when the PC boots from HDD.

I have created a liveUSB image (.iso) of the working OS. Booted the same PC from USB drive which contains the .iso image.

Now, the DUT is connected and the application is run, which reports that there is Garbage on the Line most of the times. However, it does work on some attempts, it is very inconsistent.

I couldn't understand how does a boot from a Live USB is different from a HDD boot.

FYI, PC has Fedora Core 22 with 4.0.4 Linux kernel.

Serial communication: baudrate is 115200 with 1 stop bit.

Any help is much appreciated.

Thanks,

Shahab

Edit

I have checked dmesg and found a difference,

cdc_acm : failed to set dtr/rts on Live USB boot. It is not seen in the other case. Similar to this question on stackoverflow.

Another observation, the serial communication works fine when the device is connected and PC boots from the Live USB stick. If the USB cable to the device is unplugged and plugged in again, it reports the issue.

Community
  • 1
  • 1
user3612463
  • 149
  • 1
  • 7
  • Live USB and HHD have different MBR. This also depend on how USB stick is formatted or visible by BIOS. Some BIOS may allow you to choose: HDD, FDD etc. – Eugen Konkov Oct 19 '16 at 20:06
  • @EugenKonkov thanks for the comment. However, I couldn't understand how does an MBR cause serial communication to break. – user3612463 Oct 20 '16 at 09:04
  • Your application expects data in format like HDD has, but you get it at different format (ISO). Because of that is not expected you get error shown above. May you compare byte-by-byte what you receive in both cases? Dump received data to file and then redirect data from file into your app. In case your app will not issue error when you redirect data from file you will be sure problem is in line. If error will be issued so problem is in data. – Eugen Konkov Oct 20 '16 at 09:40
  • @EugenKonkov sorry I forgot to add a detail in the question. "The garbage is not reported always, sometimes it just works fine. I just keep disconnecting/connecting the USB cable of the device and sometimes it works". While it works 100% on native OS. – user3612463 Oct 20 '16 at 13:23

1 Answers1

0

After reconnecting the USB cable your serial ports number will probably be incremented and you will have a dead /dev/ttyUSB0 and probably a new working /dev/ttyUSBX. As your application keeps the /dev/ttyUSB0 open it will not be removed until you restart your app. Keep reading the old ttyUSB0 and you will get the garbage. A second hint would be, that you probably have a read-only filesystem when booting from live so you are not able to create anything new in the /dev folder so the new device will not show up.

dungo
  • 1
  • 3
  • thanks for the answer. However, I have observed the device does show up as `/dev/ttyACM0` each time using `dmesg` command. – user3612463 Nov 17 '16 at 06:39
  • I restart my application each time, I replug the device. I kill my application and then I replug the device; only after it got detected as `/dev/ttyACM0` I start the application. – user3612463 Nov 17 '16 at 06:44