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.

SPI communication protocal, intial junk values.

Hello Team,

I am working on motor control application, using F28069F microcontroller with master and slave configuration, using SPI protocol.
When the communication starts, slave starts to receive junk value initially, which I probably think values stored in the SPIDAT from the previous operation. After some 4 to 5 samples, the data received from the slave microcontroller will be same as that of the master.
If hardware CPU reset is done, after the program is terminated or if the microcontroller is powered down and powered up before flashing the program once again into the microcontroller. Data received by slave microcontroller will be same as that of the master.
What I would like to know, why I am receiving the junk values in the beginning if the microcontroller is used continuously without CPU reset or powering it down ?
Is there a way to achieve software reset of the peripherals, when the program is terminated or when the program is flashed again into the microcontroller ?

Thanks and best regards,
Chetan..

  • Chetan,

    I would like to clear a few things up first.

    You are saying that after some period of time, Your SPI data received on the slave becomes garbage. Correct?
    When the incorrect data is occurring, does the master appear to be transmitting the proper data?
    What is the system doing before the SPI transmission becomes corrupted?
    Are you actively toggling SPISTE, or is the Slave Chip Select pin tied to ground always?

    It sounds like after some time of operation, the Slave and master become out of sync. A power cycle, or a reset of both the master and the slave should allow you to synchronize again. It is important to find the exact point at which the communication becomes unreliable. Is this cause repeatable, can you trigger it on demand? If you can find out the cause of the failure, you can prevent the trigger from happening.

    To directly address your questions, yes, you can reset the peripheral without power cycling or reprogramming. You can reset the entire SPI module by cycling the Peripheral Clock enable bit. Alternately, you also can reset the SPI FIFO pointers if they are enabled by cycling the SPI TX FIFO RESET bit in the SPIFFTX register.


    Thanks,
    Mark
  • Chetan,

    Was I able to address your concerns?

    -Mark