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.

turn on and off periodically SPI in delfino

Other Parts Discussed in Thread: TMS320F28335

If I turn on and off more time and periodically an SPI peripheral

is there some problems ?

PS I'm using delfino dual

  • Hi,

    What method you are planning to use to turn SPI module on/off ?

    Regards,

    Vivek Singh

  • I want to use the same SPI for more devices that use different BAUD, CLKPOLARITY and CLK_PHASE

    I have to polling this devices

    I want to write a single routine

    void Spi_SetUp(Spi spi, int CLKPOLARITY, int CLK_PHASE, int SPIBRR ) // imposta registri
    {
    	EALLOW; // codice per F2837xD
    	if(spi==&SpiaRegs) { CpuSysRegs.PCLKCR8.bit.SPI_A = 0; asm(" RPT #3 || NOP"); CpuSysRegs.PCLKCR8.bit.SPI_A = 1; }
    	if(spi==&SpibRegs) { CpuSysRegs.PCLKCR8.bit.SPI_B = 0; asm(" RPT #3 || NOP"); CpuSysRegs.PCLKCR8.bit.SPI_B = 1; }
    	if(spi==&SpicRegs) { CpuSysRegs.PCLKCR8.bit.SPI_C = 0; asm(" RPT #3 || NOP"); CpuSysRegs.PCLKCR8.bit.SPI_C = 1; }
    	EDIS;
    
    	(*spi).SPIFFTX.all				= 0xE040;
        (*spi).SPIFFRX.all				= 0x2044;
        (*spi).SPIFFCT.all				= 0x0;
    
    	(*spi).SPICCR.all				= 0x0007;			// Reset on, rising edge, 16-bit char bits
    	(*spi).SPICTL.all 				= 0x0006;			// Enable master mode, normal phase, enable talk, and SPI int disabled.
    
        (*spi).SPICCR.all				= 0x0097;			// Relinquish SPI from Reset
    
        (*spi).SPIFFTX.all				= 0xE040;
        (*spi).SPIFFRX.all				= 0x2044;
        (*spi).SPIFFCT.all				= 0x0;
    	(*spi).SPICCR.bit.SPILBK		= 0;				// loop back disabled
    
    	(*spi).SPICCR.bit.CLKPOLARITY	= CLKPOLARITY;		//1900 di SPRUHM8C–December 2013–Revised December 2014
    	(*spi).SPICTL.bit.CLK_PHASE	= CLK_PHASE;		//1902 di SPRUHM8C–December 2013–Revised December 2014
    
    (*spi).SPIBRR = SPIBRR ;
    }

    is it too much ?

  • Hello Mauro,

    I am using the SPIA (TMS320F28335) with two different clock polarities and it seems to be working ok (for many many months).

    Changing the spi registers are changed as shown below.

    HTH,

    Stephen

        SpiaRegs.SPICCR.bit.SPISWRESET = 0;      // Clear SPI Status Flags
        SpiaRegs.SPIFFTX.bit.SPIRST = 0;
    
        ...Change SPI registers....
    
        SpiaRegs.SPIFFTX.bit.SPIRST = 1;
        SpiaRegs.SPICCR.bit.SPISWRESET = 1;      // Ready to tx or rx the next character.

  • Hello Mauro,

    I didn't read your second post, so I misunderstood what you were trying to do.

    There's no problem with using a single function to initialize any one of the three SPI peripherals.  There's only one SPI on the TMS320F28335, so  I didn't do it that way.  However, I did do it for the Serial port (i.e. SCI).

    What did you originally mean by periodically turning the SPI on and off?

    Stephen

  • Hello Mauro,

    Why do you disable the SPI clock, add 3 NOPs and then enable the SPI clock?  Also, think you should add code for SpiaRegs.SPICCR.bit.SPISWRESET and SpiaRegs.SPIFFTX.bit.SPIRST (as I previously mentioned in my previous message).  Otherwise, I don't see anything wrong with what your doing.  

    Stephen

  •  thankyou very much,

    here my acquire,

    the code is ok

    at page 1880 of SPRUHM8C–December 2013–Revised December 2014