I'm using the M52233Demo board talking to an SPI Slave device. When I try to send 9 packets over SPI using the queue. the data that comes out of the Coldfire part is not what I expect. My code is below;
 
My Clock is good, my CS is help for the whole duration, but the data that comes out is skipping the 1st 3 btyes.
 
If i change my "do" loop to "for" loops I get the same issue.  If I remove the loops and use the code
 
change 1st loop to
MCF_QSPI_QDR   = MCF_QSPI_QDR_CONT |  MCF_QSPI_QDR_BITSE ;
MCF_QSPI_QDR   = MCF_QSPI_QDR_CONT |  MCF_QSPI_QDR_BITSE ;
MCF_QSPI_QDR   = MCF_QSPI_QDR_CONT |  MCF_QSPI_QDR_BITSE ;
 
change 2nd loop to
MCF_QSPI_QDR   = data[0];        
MCF_QSPI_QDR   = data[1];    
MCF_QSPI_QDR   = data[2];
 
It works fine.  ANy suggestions as to how i can do it in a loop? so i can use the saem function for different size transfers.
 
Code:
int spi_flash_program_array(long addr, char* data, int bytecount){ int i, ii; char addr1, addr2, addr3;  char SPI_Command;  if (SPI_FLASH_MODEL == AT25F)  SPI_Command   = AT25F_PROGRAM;               // Status Command else if (SPI_FLASH_MODEL == AT26DF)  SPI_Command   = AT26DF_PROGRAM;               // Status Command      addr1 = (addr & 0xFF0000)>>16;    addr2 = (addr & 0xFF00)>>8;    addr3 = addr & 0xFF;   MCF_QSPI_QMR   = (MCF_QSPI_QMR_MSTR | MCF_QSPI_QMR_BITS(8)  | MCF_QSPI_QMR_BAUD(2)); // Master, 16bits/transfer, 3.75Mhz MCF_QSPI_QDLYR = 0x0000;                // default delays MCF_QSPI_QIR = MCF_QSPI_QIR_SPIF;  MCF_QSPI_QAR   = MCF_QSPI_QAR_CMD; MCF_QSPI_QDR   = MCF_QSPI_QDR_CONT |  MCF_QSPI_QDR_BITSE ; MCF_QSPI_QDR   = MCF_QSPI_QDR_CONT |  MCF_QSPI_QDR_BITSE ; MCF_QSPI_QDR   = MCF_QSPI_QDR_CONT |  MCF_QSPI_QDR_BITSE ; MCF_QSPI_QDR   = MCF_QSPI_QDR_CONT |  MCF_QSPI_QDR_BITSE ;  i=0; do {  MCF_QSPI_QDR   = MCF_QSPI_QDR_CONT |  MCF_QSPI_QDR_BITSE ;   printf("setting up commadn Register...\n",i, i );  i++; } while (i<bytecount); printf("Writting at Address=%#x...\n", addr ); MCF_QSPI_QAR   = MCF_QSPI_QAR_TRANS;              // TX Address MCF_QSPI_QDR   = SPI_Command;               // Status Command MCF_QSPI_QDR   = addr1;                 // Status Command MCF_QSPI_QDR   = addr2;                 // Status Command MCF_QSPI_QDR   = addr3;                 // Status Command  i=0; do {  MCF_QSPI_QDR = data[i];   printf("Writting %#x at Address=%#x...\n",data[i], addr+i );  i++; } while (i<bytecount);    MCF_QSPI_QWR    = MCF_QSPI_QWR_CSIV | MCF_QSPI_QWR_NEWQP(0) | MCF_QSPI_QWR_ENDQP(3+bytecount); // Active Low CS, Transfer 1st slot of Queue   MCF_QSPI_QDLYR = MCF_QSPI_QDLYR_SPE;             // Start Transfer  while( !(MCF_QSPI_QIR & MCF_QSPI_QIR_SPIF )) {  // Spin here waiting for completion      }; printf("Write Complete\n");   return 0;}