hello,
I am using device simulator 5510 with CCS v3.1. i configured McBSP0 to be Master SPI , then transmit data through DXR after checking the transmit ready bit according to the following source code:
// adjust port McBSP_0 32 bits mode
void McBSP_0_setup()
{
short i;
i=0;
// reset port
/*SPCR1*/*(ioport unsigned volatile int*)0x2805=0x0000;
/*SPCR2*/*(ioport unsigned volatile int*)0x2804=0x0000;
// initial
/*SPCR1*/*(ioport unsigned volatile int*)0x2805=0x1000;
/*SPCR2*/*(ioport unsigned volatile int*)0x2804=0x03C0;
/*PCR*/ *(ioport unsigned volatile int*)0x2812=0x0A00;
/*RCR1*/ *(ioport unsigned volatile int*)0x2807=0x0040;
/*RCR2*/ *(ioport unsigned volatile int*)0x2806=0x0004;
/*XCR1*/ *(ioport unsigned volatile int*)0x2809=0x00A0;
/*XCR2*/ *(ioport unsigned volatile int*)0x2808=0x0004;
/*SRGR1*/*(ioport unsigned volatile int*)0x280B=0x0000; // not div by 2
/*SRGR2*/*(ioport unsigned volatile int*)0x280A=0xA01F;
/*MCR1*/ *(ioport unsigned volatile int*)0x280D=0x0000;
/*MCR2*/ *(ioport unsigned volatile int*)0x280C=0x0000;
i++; i++; i++; i++; // wait 12 clocks CPU
// work mode
/*SPCR1*/*(ioport unsigned volatile int*)0x2805=0x1001;
/*SPCR2*/*(ioport unsigned volatile int*)0x2804=0x03C1;
i++; i++; i++; i++; // wait 12 clocks CPU
////===============================================
}
//////////////////////////////////////////////////////////////////////////////////////////
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
main()
{
unsigned long k=0;
McBSP_0_setup();
while(k<1000)
{
while(((*(ioport unsigned volatile int*)0x2804)&(0x0002) )==0x0000); // test transmit ready bit
*(ioport unsigned volatile int*)0x2802=0x00FF; // for 8 clock generating
*(ioport unsigned volatile int*)0x2803=0x00FF; // for 8 clock generating
k++;
}
}
the problem is the while loop is never exit, although the transmit ready bit value read
from tools -->c55x peripherals --> McBSP0 --> SPCR2 --> xRDY shows 1.
this probelm also occurs with CCS v4 & v 2.2