AnsweredAssumed Answered

SPI Driver Not working Arm M0+ MKL15Z128VFT4

Question asked by Jonathan Guinta on Apr 6, 2016
Latest reply on Apr 6, 2016 by xiangjun.rong

I'm in the process of debugging a SPI peripheral I'm using with the ARM M0+ uC MKL15Z128VFT4. The OS is BareMetal and the SysTick is at 1ms. The clock speed for the SPI peripheral is 23.405714 kHz. I keep running into an issue where an exception is thrown when the hit the SPI_HAL_SetIntMode(base, kSpiRxFullAndModfInt) and then the debugger jumps to DefaultISR. I have the instruction set in Thumb mode and the debug level at Default -g. Also I do initialize the peripheral driver before this with:

 

//Install interrupt handler for SPI comm

    OSA_InstallIntHandler(SPI0_IRQn, SPI_COM1_IRQHandler);

    //Initialize SPI to Master control

    if(SPI_DRV_MasterInit(*m_instance, &SPI_COM1_MasterState) == kStatus_SPI_Success)

    {

//Configure the SPI bus
SPI_DRV_MasterConfigureBus(*m_instance, &SPI_COM1_MasterConfig0, &SPI_COM1_calculatedBaudRate);
return true;

    }

    return false;

 

So I can't imagine it's the proper initialization of the peripheral that's the cause of this exception being thrown, but I won't rule it out. Any pointers/ideas to help solve this would be much appreciated. BTW, if I manually step through the code with the debugger, the exception isn't thrown, since the debugger is controlling the execution. I've seen this issue arise in the past with the SysTick timer, or the debugger symbol file not being aligned. I'm not sure.

Outcomes