Author Topic: Virtual serial port  (Read 6890 times)

bobricius

  • Newbie
  • *
  • Posts: 49
Virtual serial port
« on: December 29, 2012, 01:14:35 am »
Hi anybody have created any CDC clas library ?
« Last Edit: December 29, 2012, 01:14:35 am by bobricius »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Virtual serial port
« Reply #1 on: December 29, 2012, 10:22:22 pm »
Not an Arduino library version yet - but you can use the cdc code form the v-usb project to turn it into a serial converter.

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Virtual serial port
« Reply #2 on: December 30, 2012, 02:33:05 am »
If people are interested I could write up specific instructions on how to turn a digispark in to a usb-ttl serial converter dongle?

bobricius

  • Newbie
  • *
  • Posts: 49
Virtual serial port
« Reply #3 on: December 30, 2012, 10:04:22 am »
I looking for way how display debug info or sending something to PC terminal form user program. Maybe for processing... which I want to learn soonest

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Virtual serial port
« Reply #4 on: December 31, 2012, 07:43:27 am »
DigiUSB is pretty good for sending out debug info, but installing the tool on the PC side to receive the info can be a bit involved for a beginner.. Digistump are making their own tool which will be much easier to use, but if you\'re interested in doing it right now installing http://rubygems.org/gems/digiusb (requires ruby 1.9.x and libusb 1.x) gives you a \'digiterm\' command line tool which sort of telnet\'s in to a digispark via digiusb.

ukonline2000

  • Newbie
  • *
  • Posts: 2
Virtual serial port
« Reply #5 on: January 06, 2013, 05:53:45 pm »
@ Bluebie  I used the “SoftwareSerial” library for attiny85,but  without success.so if you can write up specific instructions for us, it is very helpful.thanks a lot
« Last Edit: January 06, 2013, 05:54:59 pm by ukonline2000 »

Macjbraun

  • Newbie
  • *
  • Posts: 6
Virtual serial port
« Reply #6 on: January 10, 2013, 11:39:29 am »
I got SoftwareSerial working. You need to edit the .cpp file and change
#if F_CPU == 16000000
to
#if F_CPU == 16000000 || 16500000
I am using pins 0 and 5 for Rx and Tx. I think there may be issues with serial over some of the other pins.
Note: Adding SoftwareSerial will add about 2k to your project. I found using write over print to save a lot of space. Write won\'t work for everything though.
« Last Edit: January 10, 2013, 11:48:02 am by Macjbraun »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Virtual serial port
« Reply #7 on: January 10, 2013, 11:42:34 am »
@Macjbraun  - in the next release support in SoftwareSerial for 16.5mhz will be included, including adjusted timing values to match the speed - but as you found, it does work pretty good even without adjusting the timing

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Virtual serial port
« Reply #8 on: January 10, 2013, 04:20:16 pm »
Emulating a serial port as a way to talk to tools like processing is probably the wrong approach. The digispark is technically not able to implement the serial port usb protocol because it is a low speed device. Some operating systems tolerate it, but others do not. I believe more recent versions of Windows fall in to the category of do not. DigiUSB is designed to be simple and compact, which matters a bit when you\'re dealing with a chip with not very much program memory.

A better approach I think would be to interface processing to digiusb. It\'d be really neat if someone made a processing library for digiusb - there\'s a few existing things which use libusb to talk to usb devices, so it wouldn\'t be too difficult to adapt them. Another way to go would be to open a subprocess to one of the digiusb terminal programs and just chatter through that.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Virtual serial port
« Reply #9 on: January 10, 2013, 04:27:42 pm »
To clarify - to me the usefulness of software serial is for talking to other serial devices (GPS,wifi shield, etc) with the Digispark - I agree with Bluebie about the best way to talk to the PC - though of course I encourage people to try any way they\'d like!