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.

TMS320F28035: Looking for SPI example code for the slave on TMS320F28035

this is my C code for the slave 

void spi_init(void)
{
//SpiaRegs.SPICCR.all = 0x0007; //Data is ready on rising edge), loopback is off, 8-bit data
SpiaRegs.SPICTL.all = 0x000A; //Normal SPI clocking scheme(Data in latch on rising edge)slave, 4-pin option, No interrupt
SpiaRegs.SPICTL.bit.CLK_PHASE = 1;
SpiaRegs.SPIBRR = 0x0077; //BateRate 0.5MHz
SpiaRegs.SPICCR.all = 0x0087; //SPI is ready to transmit or receive the next character.
SpiaRegs.SPICCR.bit.CLKPOLARITY = 0; //0
SpiaRegs.SPIPRI.bit.FREE = 1;
}

but this code doesnt work ;(

  • I have now connected both controllers to each other, it is ensured that the master can send, I checked that with a logic analyzer. I am sending some hex numbers for testing purposes. The slave would then have to receive the data in the SPIRXBUF from SPIA. Unfortunately this does not work. The initialization for the slave can be seen above, can someone help me with this? thanks

  • Hi Markus,

    The slave would then have to receive the data in the SPIRXBUF from SPIA. Unfortunately this does not work.

    When you say "this does not work", does that mean that the data is incorrect or you are not able to read any of the incoming data? Could you please elaborate. The initialization seems okay, make sure that both the master and slave have the same clock polarity, clock phase, and baud rate. 

    Best Regards,

    Marlyn

  • I can now send data, it works, but thanks for your help