Ubuntu 10.04 SAM-BA GUI problem

Microchip in-system programming solution: SAM-BA

Moderators: nferre, fab

ralley
Posts: 8
Joined: Tue Oct 27, 2009 3:59 am

Re: Ubuntu 10.04 SAM-BA GUI problem

Tue Jun 08, 2010 10:57 pm

Well I opened a ticket with Atmel (ATTicket: 596839) and their response is "
Yes, this is a known issue with Ubuntu 10.04 which changes the usb driver.
So, I'd like to suggest you come back to Ubuntu 9.04 which is stable according to our tests."

Not much help but at least it was quick.

I'll keep fiddling as and when I get time but doubt I'll make much progress - don't know USB at all.

Rob.
mgdaubo
Posts: 3
Joined: Sun Oct 17, 2010 8:20 am

Re: Ubuntu 10.04 SAM-BA GUI problem

Sun Oct 17, 2010 2:18 pm

Hi, i am new here.
I have just clean installed ubuntu 10.10 with kernel 2.6.35.22, and have sam-ba 2.10 freeze when connect at91sam9260 board.
Follow your posts, i try to modify usb-serial.c, but when i remove the flip arg in tty_port_close(&port->port, tty, filp);. it becomes: tty_port_close(&port->port, tty); and when i compile it, i got error: too few argument tty_port_open.

Follow another post to add a new line after line 274, the line 274 in usb-serial (kernel 2.6.35.22 is the comment line).

Can anyone show me exactly what shoud i modify?

*** and also i got a problem with usb-to-serial cable, i posted here: http://ubuntuforums.org/showthread.php?t=1598647. Could you take a look and give me some idea.

Thanks in advance.
mgdaubo
Posts: 3
Joined: Sun Oct 17, 2010 8:20 am

Re: Ubuntu 10.04 SAM-BA GUI problem

Tue Oct 19, 2010 7:31 am

I try to comment out 2 lines in linux-2.6.35/drivers/char/tty_port.c, funtion tty_port_open(...):
//if (!tty_hung_up_p(filp))
// ++port->count;
but nothing changed. my sam-ba still freeze when connect to my board at91sam9260.

with sam-ba v2.10 in window 7, i can success communicate to my board.
amenabletochange
Posts: 1
Joined: Wed Oct 20, 2010 2:12 pm

Re: Ubuntu 10.04 SAM-BA GUI problem

Wed Oct 20, 2010 2:36 pm

I just spent a lot of time on this when trying to get the Android image up on running on a AT91SAM9M10-EKES board and thought I should share a few pieces of info since it was not all that straight forward even if this thread was really helpful.

My setup is a development machine running Ubuntu 10.04 (64 bit). The module modification suggested by tbosserman seems to solve the problem for me but rebuilding the module was not that straight forward, my ubuntu kernel hacking experience is somewhat limited. Below is what I did, there are probably easier ways to rebuild a specific module but I found it hard to google up something. So if anyone got suggestions on how to get just the source for the module I want to modify and build that against the correct Linux headers quickly feel free to comment.

----------------------------------------------------
First get the correct kernel for the distribution to get the driver. Git kernel repos for different distributions can be found at https://wiki.ubuntu.com/Kernel/Dev/Kern ... itGuide%20. For my setup (10.04):

mkdir mykernels
cd mykernels
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-lucid.git

This creates a folder in mykernels named ubuntu-lucid which contains the source code for the 10.04 kernel. In this case we do not want to build the entire kernel, just the usbserial driver with a modification. At this point I run in to issues with module version numbers, just building the module directly in the kernel source will use the wrong header set and that will cause a problem when we try to install it. Instead it should be built against the kernel headers for the distribution. To get these headers run

uname -a

Which should result in something like this:

Linux selunwsmpetlinux 2.6.32-25-generic #44-Ubuntu SMP Fri Sep 17 20:05:27 UTC 2010 x86_64 GNU/Linux

Now we now what version of the kernel headers we need so download them by running (I already had my kernel headers available so this may be incomplete)

sudo apt-get install linux-headers-2.6.32-25-generic

Remember to replace the version above with the one for your system throughout this example. The header files will end up in /usr/src and can be used for building modules and programs that make use of kernel features. In this case we want to use them to rebuild a driver module and I copied them to my home folder in order not to mess up the standard installation.

cd ~
mkdir modulehack
cp -r /usr/src/linux-headers-2.6.32-25-generic modulehack/
cp -r /usr/src/linux-headers-2.6.32-25 modulehack/

I built the the new module from this modulehack directory by first copying the source files to it.

cd mykernels/ubuntu-lucid/drivers/usb/serial
cp * ~/modulehack/linux-headers-2.6.32-25/drivers/usb/serial/

Now it is time to do the modification of the usbserial driver that we are going to build. Open and edit usbserial.c

cd ~/modulehack/linux-headers-2.6.32-25/drivers/usb/serial/
gedit usbserial.c

Add this line

serial->type->max_in_flight_urbs = 1;

After line 274 in the serial_open function to make the code look something like:

if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags)) {
if (mutex_lock_interruptible(&port->mutex))
return -ERESTARTSYS;
mutex_lock(&serial->disc_mutex);
if (serial->disconnected)
retval = -ENODEV;
else {
retval = port->serial->type->open(tty, port);
serial->type->max_in_flight_urbs = 1;
}
mutex_unlock(&serial->disc_mutex);
mutex_unlock(&port->mutex);
if (retval)
return retval;
set_bit(ASYNCB_INITIALIZED, &port->port.flags);
}

Now we have the headers and the modified driver file all in the modulehack folder and we are ready to build. The build itself is started from the <linux_headers..>-generic folder to get the version info right. This contains symbolic links to the drivers folder where we put the modified driver. Build the module by

cd ~/modulehack/linux-headers-2.6.32-25-generic
make M=drivers/usb/serial/

Hopefully we now have a working modified module. Last step is to install but first backup the current module.

sudo cp /lib/modules/2.6.32-25-generic/kernel/drivers/usb/serial/usbserial.ko ~/backupusbserial.ko

Now if everything worked out alright copy the modified module and install it using the instructions for the Atmel SAM boot assistant.

cd ~/modulehack/linux-headers-2.6.32-25/drivers/usb/serial/
sudo cp usbserial.ko /lib/modules/2.6.32-25-generic/kernel/drivers/usb/serial/usbserial.ko
sudo rmod usbserial
sudo modprobe usbserial vendor=0x03eb product=0x6124

If everything works out alright it should now be possible to follow the instructions in with the SAM-BA tool to reflash the board.
mgdaubo
Posts: 3
Joined: Sun Oct 17, 2010 8:20 am

Re: Ubuntu 10.04 SAM-BA GUI problem

Thu Oct 28, 2010 4:33 am

amenabletochange, thank you very much.
But i am still not success to make M=drivers/usb/serial/
terminal report here:
CC [M] drivers/usb/serial/usb-serial.o
drivers/usb/serial/usb-serial.c: In function ‘serial_open’:
drivers/usb/serial/usb-serial.c:268: error: ‘struct usb_serial_port’ has no member named ‘mutex’
drivers/usb/serial/usb-serial.c:275: error: ‘struct usb_serial_driver’ has no member named ‘max_in_flight_urbs’
drivers/usb/serial/usb-serial.c:278: error: ‘struct usb_serial_port’ has no member named ‘mutex’
drivers/usb/serial/usb-serial.c: In function ‘serial_down’:
drivers/usb/serial/usb-serial.c:304: error: ‘struct usb_serial_port’ has no member named ‘console’
drivers/usb/serial/usb-serial.c:313: error: ‘struct usb_serial_port’ has no member named ‘mutex’
drivers/usb/serial/usb-serial.c:316: error: ‘struct usb_serial_port’ has no member named ‘mutex’
drivers/usb/serial/usb-serial.c: In function ‘serial_cleanup’:
drivers/usb/serial/usb-serial.c:363: error: ‘struct usb_serial_port’ has no member named ‘console’
drivers/usb/serial/usb-serial.c: In function ‘port_release’:
drivers/usb/serial/usb-serial.c:630: error: incompatible type for argument 1 of ‘IS_ERR’
include/linux/err.h:32: note: expected ‘const void *’ but argument is of type ‘struct kfifo’
drivers/usb/serial/usb-serial.c:631: error: incompatible type for argument 1 of ‘kfifo_free’
include/linux/kfifo.h:110: note: expected ‘struct kfifo *’ but argument is of type ‘struct kfifo’
drivers/usb/serial/usb-serial.c: In function ‘usb_serial_probe’:
drivers/usb/serial/usb-serial.c:928: error: ‘struct usb_serial_port’ has no member named ‘mutex’
drivers/usb/serial/usb-serial.c:971: warning: passing argument 1 of ‘kfifo_alloc’ makes pointer from integer without a cast
include/linux/kfifo.h:108: note: expected ‘struct kfifo *’ but argument is of type ‘long unsigned int’
drivers/usb/serial/usb-serial.c:971: warning: passing argument 3 of ‘kfifo_alloc’ makes integer from pointer without a cast
include/linux/kfifo.h:108: note: expected ‘gfp_t’ but argument is of type ‘struct spinlock_t *’
drivers/usb/serial/usb-serial.c:971: error: incompatible types when assigning to type ‘struct kfifo’ from type ‘int’
drivers/usb/serial/usb-serial.c:972: error: incompatible type for argument 1 of ‘IS_ERR’
include/linux/err.h:32: note: expected ‘const void *’ but argument is of type ‘struct kfifo’
make[1]: *** [drivers/usb/serial/usb-serial.o] Error 1
make: *** [_module_drivers/usb/serial] Error 2
i am new in compile kernel, hope your help. thanks.

Return to “SAM-BA”

Who is online

Users browsing this forum: No registered users and 2 guests