Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: SPI lockup/hang issue on AT91SAM9263
PostPosted: Sat May 10, 2008 3:52 am 
Offline

Joined: Sat May 10, 2008 3:23 am
Posts: 3
Hi,

We have been using the AT91SAM9263-EK board for some development and have Linux running on it. We use the available SPI bus to interface to one of our devices with the atmel_spi driver. The application involves having large data transfers over the SPI bus. We utilize the SPI/PDC pair to perform these operations but have been observing a failure/lockup of the SPI controller after it completes a couple of hundred such data transfers. This seems to be very consistent with large data packets (150 bytes or more) and not observed for smaller sized transfers. The SPI bus is currently running at 5MHz. The SPI controller locks up and does not respond to even a software reset.

The output on the logic analyzer shows that the data was transfered but the interrupt is never generated. A dump of the SPI registers after the lockup shows the RCR register stuck at 1.

We have been unable to understand the cause of this problem and were wondering is anybody else has seen similar issues?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 10, 2008 12:10 pm 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 204
Location: USA
Hi there

What version of Linux are you using?

The latest Atmel patch for 2.6.25 finally consolidates 4 SPI patches that missed the 2.6.24 release.

Regards

Correction: the changes are already in the mainline 2.6.25 kernel. The at91 patch for 2.6.25 has no changes for atmel_spi.c


Last edited by blue_z on Tue May 20, 2008 11:30 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun May 11, 2008 2:41 am 
Offline

Joined: Sat May 10, 2008 3:23 am
Posts: 3
We are using 2.6.22 with the patches from linux4sam.org.

I did notice on a different forum (http://www.avrfreaks.net/index.php?name ... c&p=429965) that there were issues in 2.6.24 with the chained DMA transfer patch (http://lkml.org/lkml/2008/4/6/98).

I'm not sure if they are related but both the cases look similar. In the case of the chained DMA trasfers we would have a number of smaller DMA transfers chained together and in our case we have a single large DMA transfer.

As I mentioned in the previous post, the RCR register gets stuck at 1 and does not generate the ENDRX interrupt.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 12, 2008 3:07 am 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 204
Location: USA
Hi there

Linux 2.6.22 is a bit stale for the atmel_spi.c driver. There have been quite a few source code changes since that version. Most of the changes have been for performance (e.g. the DMA chaining), but there also have been at least 2 bug fixes. One of these fixes SPI overrun because the SPI tx and rx registers are loaded in the improper order.

BTW when the AVR people mention an "Atmel patch" for a Linux release, they are actually refering to an "Atmel patch for AVR". On this site, an "Atmel patch" means "Atmel patch for AT91". These patch files may not contain the same code. The AVR patch for Linux 2.6.24 apparently had the DMA chaining patch. The AT91 patch for 2.6.24 (at maxim.org) does not have the DMA chaining patch; in fact there are no patches for atmel_spi.c in the AT91 patch for 2.6.24. The SPI overrun fix and the DMA chaining patch have to be manually retrieved and applied if you wanted them in your 2.6.24 kernel for AT91 (which I have done). All of these patches for atmel_spi.c did make it into the mainline kernel for 2.6.25.

Even though you think that your problem looks similar to what the AVR guys reported, they have already solved their problems by removing the DMA chaining patch. You are running a older version of the driver that does not have DMA chaining. The cases are only superfically related.

I do see an occasional SPI hang on my AT91SAM9260 board when accessing serial flash memory. A tftp transfer of 500MB to a JFFS2 file on the serial flash might hang about 1 in a dozen transfers (both Ethernet and SPI are contending for the PDC). This is with the DMA chaining patch in the SPI driver that is now availble in 2.6.25. I have not seen the consistent SPI hangs that you or the AVR folks report. But I have also been tweaking interrupt priorities and Bus Matrix parameters.

IMO you should try 2.6.25, and then back out the DMA chaining patch (like the AVR guys did) to see if that makes any difference in your case.

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 20, 2008 11:25 am 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 204
Location: USA
sam9263user wrote:
As I mentioned in the previous post, the RCR register gets stuck at 1 and does not generate the ENDRX interrupt.


Hi there

Someone much more knowledgeable than me mentioned that there is an known SPI issue with the at91sam9263. Check the Atmel documentation, Rev A chip erratum: "49.2.13.1 PDC Data Loss": One byte data can be lost when PDC transmits. This occurs when write accesses are performed on the base address of any peripheral,during the PDC transfer.

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 21, 2008 6:37 pm 
Offline

Joined: Sat May 10, 2008 3:23 am
Posts: 3
Thanks for the info blue_z. I did notice the PDC Data Loss issue in the Atmel datasheet. The problem is definitely a hardware issue. I got a char based SPI driver working, with the PDC completely removed from the picture and it seems to operate very reliably.

I have contacted Atmel about the issue. Let's see how it goes.

Thanks


Top
 Profile  
 
 Post subject: Re: SPI lockup/hang issue on AT91SAM9263
PostPosted: Tue Apr 28, 2009 8:00 am 
Offline

Joined: Mon Aug 21, 2006 8:09 am
Posts: 22
hi,
i am also using at91sam9263 rev.b controller and facing the data missing problem. It is been used in interrupt mode. But it never hangs.

If you have any ideas then let me know about this how to handle.

Regards
SNR


Top
 Profile  
 
 Post subject: Re: SPI lockup/hang issue on AT91SAM9263
PostPosted: Fri Jun 19, 2009 11:11 pm 
Offline

Joined: Wed Apr 01, 2009 12:27 am
Posts: 8
Have you heard back from atmel on this? I'm seeing this same issue while using a micro sdcard as the SPI device our at91rm9200 is communicating with. I could use the char interface, but the FS would be very slow as apposed to using the DMA controller.


Top
 Profile  
 
 Post subject: Re: Any response from atmel regarding SPI issue?
PostPosted: Mon Aug 08, 2011 1:27 pm 
Offline

Joined: Mon Aug 08, 2011 1:24 pm
Posts: 1
[quote="sam9263user"]
I have contacted Atmel about the issue. Let's see how it goes.

Thanks[/quote]

Hi,

Even I am facing similar issue, any response from Atmel regarding this??

Regards,
Deepika


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: