Hi,
I see you mention using an external GPIO as chip select pin in the event we want to send a multi-word frame. How do I setup the mcbsp to ignore the FSX?
Rohit.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I see you mention using an external GPIO as chip select pin in the event we want to send a multi-word frame. How do I setup the mcbsp to ignore the FSX?
Rohit.
// McBSP register settings
pmcbsp->reg->SPCR2.all =
0x0000; // Reset FS generator, sample rate generator & transmitter
pmcbsp->reg->SPCR1.all =
0x0000; // Reset Receiver, Right justify word, Digital loopback dis.
// Transmit frame synchronization is generated internally by the
// sample Rate generator
pmcbsp->reg->PCR.bit.FSXM = 1;
// Receive frame synchronization is supplied by the sample rate generator
pmcbsp->reg->PCR.bit.FSRM = 1;
// Internal MCLKR is driven by the sample rate generator of the McBSP
pmcbsp->reg->PCR.bit.CLKRM = 1;
// Internal CLKX is driven by the sample rate generator of the McBSP
pmcbsp->reg->PCR.bit.CLKXM = 1;
// SCLKME is used in conjunction with the CLKSM bit to select the input
// clock.
pmcbsp->reg->PCR.bit.SCLKME = 0;
pmcbsp->reg->RCR2.bit.RDATDLY =
1; // FSX setup time 1 in master mode. 0 for slave mode (Receive)
pmcbsp->reg->XCR2.bit.XDATDLY =
1; // FSX setup time 1 in master mode. 0 for slave mode (Transmit)
pmcbsp->reg->SPCR1.bit.CLKSTP = 2; // SPI mode, no delay
pmcbsp->reg->PCR.bit.CLKXP = 0; // low inactive state, xmit on rising edge
pmcbsp->reg->PCR.bit.CLKRP = 0; // rcv falling edge
pmcbsp->reg->XCR2.bit.XPHASE = 0;
pmcbsp->reg->RCR2.bit.RPHASE = 0;
pmcbsp->reg->XCR1.bit.XFRLEN1 = 0;
pmcbsp->reg->RCR1.bit.RFRLEN1 = 0;
// set read word length
pmcbsp->reg->RCR1.bit.RWDLEN1 = 2;
// set write word length
pmcbsp->reg->XCR1.bit.XWDLEN1 = 2;
pmcbsp->reg->SRGR2.bit.CLKSM = 1; // CLKSM=1
pmcbsp->reg->SRGR1.all = baudrate; // CLKGDV=x
pmcbsp->reg->SPCR2.bit.GRST = 1; // Enable the sample rate generator
delay()
pmcbsp->reg->SPCR2.bit.XRST = 1; // Release TX from Reset
pmcbsp->reg->SPCR1.bit.RRST = 1; // Release RX from Reset
pmcbsp->reg->SPCR2.bit.FRST = 1; // Frame Sync Generator reset
delay()
Hi,
Not sure if this belongs in this post or should be moved, but I am trying to send 16 16bit data over one chip select period, but the mcbsp seems to be breaking it up into 32 bits at a time. Could you suggest what could be going wrong?
Rohit.
Hi Mark,
I used the example program with my config and it is working as expected. See screenshot. I am confused what could be going on.
Rohit.
McbspbRegs.SPCR2.all = 0x0000; // Reset FS generator, sample rate
// generator & transmitter
McbspbRegs.SPCR1.all = 0x0000; // Reset Receiver, Right justify word,
// Transmit frame synchronization is generated internally by the
// sample Rate generator
McbspbRegs.PCR.bit.FSXM = 1;
// Receive frame synchronization is supplied by the sample rate generator
McbspbRegs.PCR.bit.FSRM = 1;
// Internal MCLKR is driven by the sample rate generator of the McBSP
McbspbRegs.PCR.bit.CLKRM = 1;
// Internal CLKX is driven by the sample rate generator of the McBSP
McbspbRegs.PCR.bit.CLKXM = 1;
// SCLKME is used in conjunction with the CLKSM bit to select the input
// clock.
McbspbRegs.PCR.bit.SCLKME = 0;
//McbspbRegs.PCR.bit.FSXP = 1;
McbspbRegs.RCR2.bit.RDATDLY =
1; // FSX setup time 1 in master mode. 0 for slave mode (Receive)
McbspbRegs.XCR2.bit.XDATDLY =
1; // FSX setup time 1 in master mode. 0 for slave mode (Transmit)
McbspbRegs.SPCR1.bit.CLKSTP = 2; // SPI mode, no delay
McbspbRegs.PCR.bit.CLKXP =
0; // low inactive state, xmit on rising edge
McbspbRegs.PCR.bit.CLKRP = 0; // rcv falling edge
McbspbRegs.RCR1.bit.RWDLEN1 = 2; // 32-bit word
McbspbRegs.XCR1.bit.XWDLEN1 = 2; // 32-bit word
McbspbRegs.SRGR2.bit.CLKSM = 1; // CLKSM=1
McbspbRegs.SRGR1.all = (Uint16)((200/2) + 0.5f);
McbspbRegs.SPCR2.bit.GRST = 1; // Enable the sample rate generator
delay_loop(); // Wait at least 2 SRG clock cycles
McbspbRegs.SPCR2.bit.XRST = 1; // Release TX from Reset
McbspbRegs.SPCR1.bit.RRST = 1; // Release RX from Reset
McbspbRegs.SPCR2.bit.FRST = 1; // Frame Sync Generator reset