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  [ 10 posts ] 
Author Message
 Post subject: SAM7Sx SPI Slave with PDC
PostPosted: Wed May 18, 2005 4:42 pm 
Offline

Joined: Sat Apr 16, 2005 6:51 pm
Posts: 5
Hi all,

I found a mysterious behavior of the at91sam7s256's SPI port.
When it runs as a slave using PDC, I cant get working the SPI transmit direction reliable (receiver works perfectly).

Example:
*init the SPI as a slave
*initialize a send buffer with 0x30, 0x31,0x32, 0x33, 0x34, 0x35, 0x36 ...
*disable Transmitter / Receiver
*initialize the PDC Transmit Pointer Register with the address of the send buffer and the Transmit Counter Register with the length of this buffer.
*enable transmitter and receiver

Then I receive on the SPI master's side (checked with an ocsilloscope) e.g.:
0x00, 0x30, 0x31, 0x31, 0x33, 0x34, 0x35, 0x35, 0x35, 0x36 ...

The sequence of retransmitted or lost bytes is randomly.

It seems that the PDC doesn't update the transmit register (SPI TDR) correct.
Test patterns, which are received by the slave using PDC at the same time are o.k.
Also the SPI master implementation for this controller (receive and transmit)
is o.k.


Does anybody have an idea?
Can anybody provide an example code for the SPI slave, what works?

Thank you!

Matthias.


Top
 Profile  
 
 Post subject: SPI slave hardware bug
PostPosted: Thu May 19, 2005 4:54 pm 
Offline

Joined: Sat Apr 16, 2005 6:51 pm
Posts: 5
Hi all,

now I did SPI slave tests without PDC.

I write the data byte directly to the Transmit Data Register and enable the Transmit Data Register Empty (TDRE) interrupt.
The remote SPI master reads one data byte per second with a speed of about 115 kbps - very slow, to be sure that there is no performance problem.

On the oscilloscope I can see fine signals (slave select, clock and MISO).
But sometimes (randomly) the slaves SPI doesn't trigger the TDRE interrupt when the data byte is shifted out.
That meens it doesn't load the SPI_TDR contents into the shift register.

This is probably a bug in the SPI hardware.

Matthias.

:cry:


Top
 Profile  
 
 Post subject: did you fix the problem?
PostPosted: Mon Jul 25, 2005 10:26 pm 
Offline

Joined: Tue Jun 14, 2005 7:49 am
Posts: 33
any progress on your work? I am doing similar stuff with an ADC. Wonder if it is the sam chip's problem?


Top
 Profile  
 
 Post subject: same thing here... anything new ?
PostPosted: Wed Oct 04, 2006 11:02 pm 
Offline

Joined: Wed Oct 04, 2006 10:39 pm
Posts: 3
Hi,

I'am using the SAM7S SPI (with PDC, 16 bits per transfer) in slave mode, and have exactly the same behavior here.

Here are my observations : when I prepare a buffer for transmission and enable PDC transmission, in the normal case, the PDC_TCR register immediatly decrease by 1, meaning PDC has writen the first 2 bytes into the serializer. But when the problem occurs, the PDC_TCR register doesn't decrease when I enable PDC. So when the master device starts the transmission, the first 2 bytes transmitted by my slave are incorrect. In fact, those 2 bytes are the last 2 bytes that have been sent into the serializer (during previous transmission). I don't know if that is clear here :oops: ... Sorry for my bad english !

Anyone else having the same problem ?

Any work around ?

Any advise would be welcome ! Thanks !

EricL


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 8:47 am 
Offline

Joined: Tue Jul 18, 2006 2:53 pm
Posts: 28
Location: South Africa
Hi there,
I have not used the SPI in slave mode yet. However, I did discover a hardware bug in using the SPI with PDC. Basically - you cannot use the FDIV bit - if you do, it breaks the hardware statemachine. Wat you are seeing may be the same bug in slave mode. See here
http://www.at91.com/www/phpBB2_mirror/v ... hp4?t=2171
or if the link does not work, here is the thread name
SPI with PDC and AT91C_SPI_FDIV

Hope this helps


Top
 Profile  
 
 Post subject: it works !
PostPosted: Fri Oct 06, 2006 10:30 pm 
Offline

Joined: Wed Oct 04, 2006 10:39 pm
Posts: 3
Thank for your post ! But I was not using FDIV... I had already noticed a lot of people having trouble with this.

It was just an electrical problem. I had the internal pull-up resistor enabled, but it seems it was not enough. I disabled them and installed external pull-up and it start working correctly ! :D

EricL


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 9:04 am 
Offline

Joined: Thu Sep 28, 2006 9:57 am
Posts: 6
I didn't use FDIV, and disable internal pull-up resistor, setting the PIO_PPUDR. I use 4.7KR to be external pull-up resistor, but this problem happen too. How many R pull-up resistor do you use? My VCC is 3.3V.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 9:30 am 
Offline

Joined: Sun Sep 11, 2005 5:16 pm
Posts: 16
I have no idea for the other but the more we dig in SAM7 peripherials the more bugs are coming out

1. the well known reset latch problem (due which Atmel stopped shipping SAM7S128 and SAM7S256)

2. USB engine is mess, the user code and USB engine can read/write in same memory/registers and if user doesn't keep track of who/when/where writes the USB communication will work correctly only from time to time (same thing is made smart in the LPCs where you send your request to the USB engine and only USB engine reads/writes the intern memory/registers)

3. I2C (TWI) interface have undocumented feature - if you are sending your data slow SAM7S will issue automatic STOP

perhaps it's good idea to collect and document these all SAM7S bugs found so far so other peopels who start working not waste their time as we did

Thanks
Tsvetan


Top
 Profile  
 
 Post subject: Which signal line did you put the pull-up on?
PostPosted: Thu Jan 04, 2007 6:13 pm 
Offline

Joined: Tue Jun 14, 2005 7:49 am
Posts: 33
I am using it as slave too. Which signal line did you put the pull-up on?

thanks
Andrew


Top
 Profile  
 
 Post subject: Re: SAM7Sx SPI Slave with PDC
PostPosted: Mon Jul 26, 2010 3:20 am 
Offline

Joined: Tue Mar 17, 2009 9:56 am
Posts: 1
Hello, Matthias, I have used SPI in slave, and fixed your problem. In your master device, if the DLYBCT(Delay Between Consecutive Transfers) in SPI_CSR is long enough to leave time for slave to move new data into SPI_TDR, it will work alright.
In my project, the SPI master is 1Mbps and DLYBCT must > 4.
So leave more time for slave to move new data.


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

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 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: