SPI Usar dentro de una interrupción del temporizador

0
  • Microcontrolador: XMC4700
  • Interfaz: DAVE

Me gustaría enviar una secuencia SPI a otra placa en diferentes intervalos de tiempo. Para hacer eso estoy usando Dave 4.3.2 , la aplicación Timer y la aplicación de interrupción. Conecté el evento de tiempo a la interrupción y cambié la configuración de recepción y transmisión de SPI para dirigir.

Probé diferentes posibilidades. El temporizador sin el SPI funciona. Tan pronto como agregué el SPI Transmit, ya no.

¿Es posible iniciar una transmisión SPI en una interrupción? Aquí están los enlaces y el código:

el código para la interrupción del temporizador:

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);
}

Pensé en no poner el SPI en el evento del temporizador y activar la transmisión SPI cada vez que el temporizador termina. También es una posibilidad. Sin embargo, me gustaría entender por qué no funciona en este entorno. Intenté colocar puntos de quiebre para ver qué pasa. Pero no está pasando por los valores.

¿Es posible, en principio, colocar el PSI dentro de la Interrupción?

gracias por la ayuda.

    
pregunta nesrine ghajati

0 respuestas

Lea otras preguntas en las etiquetas