USB on STK1000

Go To Last Post
27 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

If I have to do USB communication between PC and STK1000 where do i start from.

What do i need to learn before I start coding.

I have never done this before. Only thing I know is serial communication.

Can anyone tell me where do i start from?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well you do not need to code anything.. You could probably use the linus gdget drivers in linux.

http://www.linux-usb.org/gadget/

You can choose to program something yourselves or just use these drivers.

Life's to short for waiting on slow CPU's

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does anyone has sample program how to use Gadget drivers?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gcet97it234 wrote:
Does anyone has sample program how to use Gadget drivers?

You don't write a program, you configure them.

Your most logical choices would probably be to put the gadget driver in its mode where it emulates serial, or its mode where it emulated ethernet.

You would then write avr32 and host-pc applications that talk to each other just as if they were using serial ports, or just as if they were using the network.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I got it what you saying but I want to write a programme for Windows PC. Does it mean I have to write a Driver for windows for AVR32? what doI do?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nevermind I found it.

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How do you install USB driver on Windows Vista?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That depends on what usb profile you are using.

g_file_storage is already included

Life's to short for waiting on slow CPU's

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to install gadget serial USB driver on Windows Vista..

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I could also not get the serial gadget working with the Windows driver.

On the stk1000:
# modprobe g_serial use_acm=1
# dmesg | tail -n2
gs_bind: Gadget Serial v2.2 bound
gs_module_init: Gadget Serial v2.2 loaded

On Gentoo Linux 2.6.25:
# modprobe cdc_acm
# dmesg | tail -n2
usbcore: registered new interface driver cdc_acm
drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters

On WindowsXP, I get an error message stating the software cannot open the port and that a device attached to the system is not functioning.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try running 2.6.27-rc7 on your STK1000 ... the ACM gadget support has had a number of bugs fixed since the "version 2.2" you're using (it now reports "version 2.4" also).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used following .INF file for vista and it works for me.

[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%LINUX%
DriverVer=08/17/2004,0.0.2.0
; Copyright (C) 2004 Al Borchers ([EMAIL PROTECTED])

[Manufacturer]
%LINUX%=GSerialDeviceList

[GSerialDeviceList]
%GSERIAL%=GSerialInstall, USB\VID_0525&PID_A4A7

[DestinationDirs]
DefaultDestDir=10,System32\Drivers

[GSerialInstall]
include=mdmcpq.inf
CopyFiles=GSerialCopyFiles
AddReg=GSerialAddReg

[GSerialCopyFiles]
usbser.sys

[GSerialAddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"

[GSerialInstall.Services]
include=mdmcpq.inf
AddService = usbser,0x0002,GSerialService

[GSerialService]
DisplayName = %GSERIAL_DISPLAY_NAME%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\System32\Drivers\usbser.sys
LoadOrderGroup = Base

[Strings]
LINUX = "Linux"
GSERIAL = "Gadget Serial"
GSERIAL_DISPLAY_NAME = "USB Gadget Serial Driver"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have installed Gadget Serial ACM driver on vista using INF file as above. But Is there any way I can install linx Generic Driver for Gadget serial (not ACM) and as per gadget_serial.txt file it is for linux not for Windows. and I want to do Bulk In/Out using gadget serial.

Thanks in advance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I load gadget serial driver using modprobe g_serial use_acm = 1 command.

Now when I connect USB to my Vista machine it gets connected to COM4. now when I try to connect COM4 using C# program it gives me following error.

"The device connected to system is not functioning."

Even when I use putty software to connect to COM4 port it says "Unable to configure COM4 port".

Does anyone have any idea why does it give me that error?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The results of using current code (2.6.27-rc) were ... what?? We seem to have missed that rather important information.

Remember, the reason it was suggested in the first place is because it's known to fix bugs.

If you're not going to pay attention to the suggestions you're given, why are you even asking for help???

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've tried linux-2.6.27-rc5 with similar results.

# modprobe g_serial use_acm=1
# dmesg | tail -n2
g_serial gadget: Gadget Serial v2.4
g_serial gadget: g_serial ready

; I now plug the USB cable in
# dmesg | tail -n1
g_serial gadget: high speed config #2: CDC ACM config

# microcom -D/dev/ttyGS0

; As soon as I try to open the serial port on Windows, the following is printed to the device console:
udc: ep0: TXCOMP: Invalid endpoint state 2, halting endpoint...

On Windows, PuTTY gives the following error:
Unable to open connection to COM11
Unable to configure the serial port

I've also tried RealTerm and HyperTerminal.

Any idea what could be the cause? Not sure if this is applicable:
http://support.microsoft.com/kb/...

my version of usbser.sys is 5.1.2600.5512.

EDIT: If I open the port from Linux, the same error message is printed to the console on the device (invalid endpoint state), but I can send and receive data.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was reading gadget_serial.txt file and I came across following section

Quote:
On the gadget side run "minicom -s" to configure a new minicom
session. Under "Serial port setup" set "/dev/ttygserial" as the
"Serial Device". Set baud rate, data bits, parity, and stop bits,
to 9600, 8, none, and 1--these settings mostly do not matter.
Under "Modem and dialing" erase all the modem and dialing strings.

If I want to apply this section on my STK1000 How do I do that?
basically How do i set /dev/ttygserial to Serial Device?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was reading gadget_serial.txt file and I came across following section

Quote:
On the gadget side run "minicom -s" to configure a new minicom
session. Under "Serial port setup" set "/dev/ttygserial" as the
"Serial Device". Set baud rate, data bits, parity, and stop bits,
to 9600, 8, none, and 1--these settings mostly do not matter.
Under "Modem and dialing" erase all the modem and dialing strings.

If I want to apply this section on my STK1000 How do I do that?
basically How do i set /dev/ttygserial to Serial Device?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

can anyone help me??

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

# microcom -D/dev/ttygserial

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When I execute this command on Hyperterminal it gives me "command not found" error ... does it mean I have to install it on my STK1000.

If yes then How do i do that?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To open the 2 way communication, you have to set the link up the same way at both ends. Are you doing that? On the STK1000 end, you have to set up the port to the desired specs. Either minicom can do this for you (this is all that quoted paragraph says) or else you can do it yourself either in your own code or using a utility like stty. What ever you use (minicom/microcom/stty/ your own code) it must be installed on the stk1000 yes.

Do you have a /dev/ttygserial device? If so then this is the device you should be setting up using, eg, minicom. If not then I guess it's /dev/ttyGS0.

I can't really tell what you're doing to know which bit is going wrong, sorry. If the above doesn't help you, please let us know exactly what you're doing on the STK1000 end from modprobe onwards. If nothing, then that is a problem, you must set the port up as above.

-S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your reply..

Yes I am not doing anything afer modprobe call. I think that should be the problem as you said.

How do you Install minicom on STK1000? I ctry to copy minicom executable from Ubuntu it says can not execute binary file..

Thanks again I really appreciate.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can't just copy a executable to another architecture and expect it to work.

I think you need to RTFM. A good place to start would be avr32linux.org.

I suggest you get buildroot up. It makes the whole cross-compiling much easier.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I am still stuck.
Here is what i do for with g_serial module.
on STK1000

modprobe g_serial use_acm=1

Then plug in USB cable to PC.
i have to plug in this before running microcom because when i open microcom with ttygserial it does not open untill it is connected with PC.

then I have installed microcom so I run microcom with

microcom -D/dev/ttygserial

then I set speed to 9600
No flow control.

then I run putty on windows vista and STK1000 is connected as COM4.
SO i try to connect COM4 with 9600 and No flow control but still it gives me same error "can not configure COM4".
I am not sure if i am doing anything wrong.
Thanks in advance for your help.

Regards.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is there anyone who can help me...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I would like to know what is the meaning of following error.. I dont know its error or warning.

I am getting this error after executing modprobe g_serial use_acm = 1 command.

atmel_usba_udc: exports duplicate symbol usb_gadget_unregister_driver (owned by kernel)

insmod: can not insert '/lib/modules/2.6.25.10.atmel.2/kernel/drivers/usb/gadget/atmel_usba_udc.ko' : Invalid module format (-1): Exec format error

Am I doing anything wrong.

Thanks in advance..