I am having difficulty getting the PDC to work correctly. My microcontroller is the SAM4N16C and I am using USART-0 in Master SPI mode. I have successfully used the PDC to have the SPI bus transmit bytes from a buffer. My problem is that no bytes are being transferred in the opposite direction, to my receive buffer. I have checked the PDC registers and can confirm that the PDC_TCR (transmit counter) register has decremented to 0; however, the PDC_RCR (receive counter) remains at the original value it was set to.
I have checked that both the SPI transmitter and receiver have been enabled. I have also checked that the PDC_PTSR register is set to both receive and transmit.
Sorry, no C code for this one: the application is written in another language.
USART-0 has been set up as follows:
US_CR = 0x0000:0050
US_MR = 0x0000:00CE
US_IER = 0x0000:1000
US_BRGR = 0x0000:007C
Has anybody tried this particular peripheral configuration or know of any relevant silicon issues? Perhaps I am missing something obvious.
UPDATE: Ok, I missed setting the US_CLKO bit in the mode register. Despite being in "SPI Master" mode, setting this bit enables the receive operations to work. Clearly, I should not make assumptions about the Atmel's internal wiring.