Hi, I got some problems using SPI. I use the following code:
#include <AT91SAM9260.H> /* AT91SAM9260 definitions */ #include <lib_AT91SAM9260.h> /* Library function definitions */ int main (void) { // configure I/O lines for SPI AT91F_SPI0_CfgPIO(); // configure PMC to enable SPI clock AT91F_SPI0_CfgPMC(); // configure SPI mode AT91F_SPI_CfgMode(AT91C_BASE_SPI0, AT91C_SPI_MSTR); // configure chip select registers AT91F_SPI_CfgCs(AT91C_BASE_SPI0, 0, AT91C_SPI_CPOL | AT91C_SPI_BITS_16 | (AT91C_SPI_SCBR * 10)); // switch to the right PCS AT91F_SPI_CfgPCS(AT91C_BASE_SPI0, 0); // configure AIC for using SPI interrupt AT91F_SPI_Enable(AT91C_BASE_SPI0); while (1) { AT91F_SPI_PutChar(AT91C_BASE_SPI0, 0x8F, 0); } }
SAM9260.s, retarget.c were included.
Now the problem: When running form external RAM with optimization Level 0 there is not data on the SPI-line (measured with an oscilloscope). And the SPI-registers are set to different values. (A memory dump can be attached if needed. ) In any other configuration (other optimization level or from internal RAM) there are no problems.
Can someone reproduce the problem? Can someone give a solution?
Many thanks, Stefan