infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 2 of 2

Thread: Send an SPI Sequence inside an interrupt in XMC4700

  1. #1
    Beginner Beginner xmc_Nes is on a distinguished road
    Join Date
    Sep 2016
    Posts
    7
    Points
    76.25

    Send an SPI Sequence inside an interrupt in XMC4700

    Hello,

    I would like to send an SPI sequence to an another board in different time Intervalls.
    To do that I'm using Dave 4.3.2, the Timer APP and the Interrupt APP.
    I connected the time event to the interrupt and changed the SPI receiving and transmitting settings to direct.

    I tried different possibilities. The timer without the SPI works. As soon as I add the SPI TRansmit it doesn't anymore.

    Is it possible to start an SPI Transmit in an Interrupt?
    Here are the seetings and the code :

    Click image for larger version

Name:	SPI.PNG
Views:	2
Size:	16.3 KB
ID:	2703
    Click image for larger version

Name:	Interrupt.PNG
Views:	1
Size:	8.0 KB
ID:	2704

    the code for the timer interrupt:

    Code:
    void Time_Interval_Event(void)
    {
      /* Acknowledge Period Match interrupt generated on TIMER_CCU_1 */
      TIMER_ClearEvent(&TIMER_0);
      /* When we Arrive at the end of the send values  we repeat*/
      if (index_count == NumValues){
     	  index_count = 0;
       }
      /* if the new time starts, send the signal */
      if (Timer_Tick_Count == 0){
    	 SPI_MASTER_TransmitWord(&SPI_MASTER_0,IArr[index_count]);// send the wanted current Value
    
      	  }
    
      Timer_Tick_Count++;
    
      /* when the current time step ends, reset the tick count, change the maximum tick count to the new value and move to the next current value */
      if (Timer_Tick_Count == Max_Tick_Count ){
    	  Timer_Tick_Count = 0;
    	  index_count++;
    	  Max_Tick_Count = idxMAXValues[index_count];
    	  //new Max_Tick_Count value
      }
    
    /*disable CS to latch data */
    
       TIMER_Start(&TIMER_0);
    
    }

    I thought about not putting the SPI in the timer event ans trigger the SPI transmit every time the timer finishes. It is also a possibility. I would like though to understand why it is not working in this setting. I tried placing break points to see what
    happens. But it is not going through the values


    thanks for the Help.

  2. #2
    Beginner Beginner xmc_Nes is on a distinguished road
    Join Date
    Sep 2016
    Posts
    7
    Points
    76.25
    For those who will have the problem in the future:

    As the SPI is interrupt based you can't use it in an Interrupt with the standard settings. Change the Mode to dierct and be careful how you build the function in the time event iunterrupt.

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.