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.

McBSP working as SPI slave



Hello, I trying to configure a 28335, using the McBSp module, as a SPI Slave. The 28335 talks with an ARM device. The ARM sends a 32bit packet every 2ms, but the RRDY bit never set.... This is my configuration

// McBSP-B register settings
	McbspbRegs.SPCR2.all=0x0000;		 // Reset FS generator, sample rate generator & transmitter
	McbspbRegs.SPCR1.all=0x0000;		 // Reset Receiver, Right justify word, Digital loopback dis.
	McbspbRegs.SPCR2.bit.GRST=0;         // Enable the sample rate generator
	delay_loop();
	McbspbRegs.PCR.all=0x0008;           
	McbspbRegs.SPCR1.bit.DLB = 0;		// Loopback mode disabled
	McbspbRegs.SPCR1.bit.CLKSTP = 2;     // Together with CLKXP/CLKRP determines clocking scheme
	McbspbRegs.PCR.bit.CLKXP = 0;		 // CPOL = 0, CPHA = 0 rising edge no delay
	McbspbRegs.PCR.bit.CLKRP = 0;
	McbspbRegs.RCR2.bit.RDATDLY=0;      // FSX setup time 1 in master mode. 0 for slave mode (Receive)
	McbspbRegs.XCR2.bit.XDATDLY=0;      // FSX setup time 1 in master mode. 0 for slave mode (Transmit)

	McbspbRegs.RCR1.bit.RWDLEN1=5;     // 32-bit word
	McbspbRegs.XCR1.bit.XWDLEN1=5;     // 32-bit word

	McbspbRegs.SRGR2.all=0x2000; 	 	 // CLKSM=1, FPER = 1 CLKG periods
	McbspbRegs.SRGR1.all= 0x000F;	     // Frame Width = 1 CLKG period, CLKGDV=16

	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

Anybody can help me? I think that the configuration is ok, but not works... Thanks!

  • Hello again, I still trying to configure the McBSP module as a SPI Slave, and now I can communicate two devices, but I have other problem. The bytes that the DSP receive, are left shifted 1 bit, that is, when the master sends me 0xAA, the DSP reads 0x55.

    I read here http://e2e.ti.com/support/microcontrollers/c2000/f/171/t/261637.aspx That is not a new problem , but the solution is that give him few clock cycles generate (up to 16 LSPCLK) , before start to send the data , but the SPI module of ARM can not to do this. Someone knows other solution or there isn't? Thanks!