SPI MKL25Z NO OUTPUP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI MKL25Z NO OUTPUP

477 Views
piergiusepperan
Contributor II

HI, I'm trying to use the spi of the MKL25Z, but I can't get any output. I used the kinetis design studio and processore expert, so I setted the SPIMasterLDD: disable the Input Pin, enable and set  the Output pin and the same for clock pin, chip select pin and clock rate. Now I attach my main code:

/* ###################################################################

**     Filename    : main.c

**     Project     : spi1

**     Processor   : MKL25Z128VLK4

**     Version     : Driver 01.01

**     Compiler    : GNU C Compiler

**     Date/Time   : 2015-10-06, 12:38, # CodeGen: 0

**     Abstract    :

**         Main module.

**         This module contains user's application code.

**     Settings    :

**     Contents    :

**         No public methods

**

** ###################################################################*/

/*!

** @file main.c

** @version 01.01

** @brief

**         Main module.

**         This module contains user's application code.

*/        

/*!

**  @addtogroup main_module main module documentation

**  @{

*/        

/* MODULE main */

/* Including needed modules to compile this module/procedure */

#include "Cpu.h"

#include "Events.h"

#include "SM1.h"

#include "Bit1.h"

#include "BitIoLdd1.h"

/* Including shared modules, which are used for whole project */

#include "PE_Types.h"

#include "PE_Error.h"

#include "PE_Const.h"

#include "IO_Map.h"

/* User includes (#include below this line is not maintained by Processor Expert) */

void spi_send(uint8_t spiMsg);

/*lint -save  -e970 Disable MISRA rule (6.3) checking. */

int main(void)

/*lint -restore Enable MISRA rule (6.3) checking. */

{

  /* Write your local variable definition here */

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/

  PE_low_level_init();

  /*** End of Processor Expert internal initialization.                    ***/

  /* Write your code here */

  uint8_t c1 = 0xFF;    //1010000000000000

  spi_send(c1);    //send c1 high

    /* For example: for(;;) { } */

  /*** Don't write any code pass this line, or it will be deleted during code generation. ***/

  /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/

  #ifdef PEX_RTOS_START

    PEX_RTOS_START();                  /* Startup of the selected RTOS. Macro is defined by the RTOS component. */

  #endif

  /*** End of RTOS startup code.  ***/

  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/

  for(;;){}

  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/

} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/

/* END main */

/*!

** @}

*/

/*

** ###################################################################

**

**     This file was created by Processor Expert 10.5 [05.21]

**     for the Freescale Kinetis series of microcontrollers.

**

** ###################################################################

*/

void spi_send(uint8_t spiMsg)

{

   //while(!(SPI_S_SPTEF_MASK & SPI0_S))

  //{

  //asm("nop");

  //}

   SPI0_D = spiMsg;

}

If I connect the output pin of spi to an oscilloscope, I can see anything. I can do the debug but nothing happens. I removed the part

//while(!(SPI_S_SPTEF_MASK & SPI0_S))

  //{

  //asm("nop");

  //}

because i want to send only one data for now. (I don't know if it is correct)

Plese, can you help me?

0 Kudos
1 Reply

334 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I would recommend to refer attached KL25 SPI example code.

Wish it helps.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos