SPI Driver Help

hudson2009 wrote on Thursday, April 03, 2008:


I am using using AT91SAM7 (as SPI master)trying to talk to another Micro(MSP430: SPI slave)

Q1, Do i need PDC for this?

Q2, What are the different for the ISR handler using PDC and Non PDC?

Q3: Any one has sample Driver code for this?

Many Thanks!

chaalar wrote on Thursday, April 03, 2008:


A1) You don’t need to use PDC, but it is easier and more CPU friendly.

A2) The difference is that you don’t need ISR for the PDC that much. You
will probably want to know end of transfer so you will only handle PDC related
ENDTx or ENDRX flag in the ISR for the PDC. For the other case, you will need to
handle many more flags in the interrupt handler.

A3) There are some example codes posted to this forum(or to theAT91SAM yahoogroup)
If you are asking for a complete freeRTOS driver, then you have to do it yourself.
I have never seen any. But mechanism is similar for any driver.
For example you can take a serial driver as basis and replace usart related calls with
the spi ones.


hudson2009 wrote on Friday, April 04, 2008:

Hi Caglar,

Thanks for your reply.
I think i have configure the but not the ISR.

I Refer a sample code From atmel that write/ read external flash through SPID (PDC) and it only service SPI_RXBUFF flag in its SPID handler.

I am a bit confuse which flag to service on ISR.

Do u mind to show me where can i get more detail on how to handle SPI PDC ISR.

Thanks again.

kind regards

chaalar wrote on Friday, April 04, 2008:

Yes that’s correct. You can use either RXBUFF or ENDRX. RXBUFF means both of the buffers are completed, ENDRX means only current buffer completed.

Do you have a code without interrupt using dma(pdc) to transfer/receive from sam7x to msp430?

hudson2009 wrote on Friday, April 04, 2008:

Ok I am clearer now.

I am trying the SPI driver with onboard at45 dataflash
to help my self understand how SPI work.

Next step will be then to get the SAM7x and MSP430 talking to each others.