DSPRelated.com
Forums

McBSP clock generation on the C5402

Started by blindf22 September 3, 2003
I want to create a continuous clock (set by the baud rate registers)
and fsync from the MCBSP and im not sure what bits need to be set in
the baud rate registers to make this work. I have tried and got the
fsync working but not the clock. Can anyone help?

Tim King
CES Communications Ltd.
New Zealand



Hi Tim,

I configured the sample rate generator for McBSP2 on
the 5407. Using for one of the two available in 5402
may be similar.

The basic steps are: 1) reset McBSP; 2) configure the sample
rate generator registers; 3) put it back to work

The following C code was used... I hope this helps...
Believer
------ begin of C code -------------

/*--- McBSP0 & McBSP1 Sub-Bank Addressed Registers ---*/
#define SPCR1 0x0000; /* Ser Port Ctrl Reg1 */
#define SPCR2 0x0001; /* Ser Port Ctrl Reg2 */
#define RCR1 0x0002; /* Rx Ctrl Reg1 */
#define RCR2 0x0003; /* Rx Ctrl Reg2 */
#define XCR1 0x0004; /* Tx Ctrl Reg1 */
#define XCR2 0x0005; /* Tx Ctrl Reg2 */
#define SRGR1 0x0006; /* Sample Rate Gen Reg1 */
#define SRGR2 0x0007; /* Sample Rate Gen Reg2 */
#define MCR1 0x0008; /* Multichan Reg1 */
#define MCR2 0x0009; /* Multichan Reg2 */
#define RCERA 0x000A; /* Rx Chan Enable Reg Partition A */
#define RCERB 0x000B; /* Rx Chan Enable Reg Partition B */
#define XCERA 0x000C; /* Tx Chan Enable Reg Partition A */
#define XCERB 0x000D; /* Tx Chan Enable Reg Partition B */
#define PCR 0x000E; /* Pin Ctrl Reg */

/*--- McBSP0 Registers ---*/
volatile int *McBSP0_SPSA0 = (volatile int *)0x0038; /* Sub Bank
Addr Reg */
volatile int *McBSP0_SPSD0 = (volatile int *)0x0039; /* Sub Bank
Addr Reg */
/*--- McBSP1 Registers ---*/
volatile int *McBSP0_SPSA1 = (volatile int *)0x0048; /* Sub Bank
Addr Reg */
volatile int *McBSP0_SPSD1 = (volatile int *)0x0049; /* Sub Bank
Addr Reg */
/*--- McBSP2 Registers ---*/
volatile int *McBSP0_SPSA2 = (volatile int *)0x0034; /* Sub Bank
Addr Reg */
volatile int *McBSP0_SPSD2 = (volatile int *)0x0035; /* Sub Bank
Addr Reg */
*McBSP0_SPSA2 = SPCR2;
*McBSP0_SPSD2 = 0x20; // MSB> 0000 0000 0010 0000 <LSB
*McBSP0_SPSA2 = PCR;
*McBSP0_SPSD2 = 0xA00; // MSB> 0000 1010 0000 0000 <LSB
*McBSP0_SPSA2 = SRGR1;
*McBSP0_SPSD2 = 0x1F;
*McBSP0_SPSA2 = SRGR2;
*McBSP0_SPSD2 = 0x3020; // MSB> 0011 0000 0010 0000
<LSB
*McBSP0_SPSA2 = SPCR2;
*McBSP0_SPSD2 = 0xE1; // MSB> 0000 0000 1110 0001 <LSB

------ end of C code ------------- --- In , "blindf22" <tim.king@p...> wrote:
> I want to create a continuous clock (set by the baud rate
registers)
> and fsync from the MCBSP and im not sure what bits need to be set
in
> the baud rate registers to make this work. I have tried and got
the
> fsync working but not the clock. Can anyone help?
>
> Tim King
> CES Communications Ltd.
> New Zealand