AnsweredAssumed Answered

Hard Fault When config SPI1_C1 on MKL33

Question asked by Bruno Aguiam on Apr 12, 2017
Latest reply on Apr 13, 2017 by Bruno Aguiam

Hello guys,

 

I am having a problem getting SPI1 as Slave, on PORTD, to work on a MKL33Z128VHL4.

 

When I try to configure the SPI Control Register 1 (SPI1_C1) , HardFault happens imediatly.

 

In first BOARD_InitPins();

 

// Config SPI1

     SIM_SCGC4_SPI1(1);

    PORT_SetPinMux(PORTD,4u, kPORT_MuxAlt2);
    PORT_SetPinMux(PORTD,5u, kPORT_MuxAlt2);
    PORT_SetPinMux(PORTD,6u, kPORT_MuxAlt2);
    PORT_SetPinMux(PORTD,7u, kPORT_MuxAlt2);

 

Late I'm trying to config SPI Control Register 1 (SPI1_C1) 

   SPI1->C1=~SPI_C1_SPE_MASK; (In this instruction HardFault happens imediatly)
    SPI1->C2=0;
    SPI1->C1=SPI_C1_CPHA_MASK;

...

 

I can't understand this HardFault happens, since exist clock on SPI1 module, and the pins are configurable.

 

I'm using KDS 3.2.0, SDK 2.0 and FreeRTOS V9.0.0 on the project.

 

Can semeone help me.

 

Best Regards,

Outcomes