AnsweredAssumed Answered

SPI get stuck on MQX 4.2 and K66

Question asked by Ohad Benjamin on Sep 2, 2015
Latest reply on Mar 7, 2016 by Cecylia Wati

Hello all,

I am in the process of porting our application from K60 to K66.

We are using MQX 4.2 and I have encountered a problem with the SPI.

In order to get our application with MQX 4.2 working on our board I had to set the OSC0 clock source (EXTAL0) to a 50 MHz clock instead of a crystal and to change the PRDIV value to divide by 5 to make the clock between 8 and 16 MHz at the PLL entrance and than set the VDIV to 24/36 for RUN/HSRUN modes.


Like in the MQX SPI example, we have a NOR Flash connected to SPI2 and after a few reading and writing cycles it gets stuck at the following code segment where the semaphore is never released:

    if (rx_len)     {         /* finish the transfer using ISR */         dspi_info_ptr->TX_BUF = txbuf;         dspi_info_ptr->TX_LEN = tx_len;         dspi_info_ptr->RX_BUF = rxbuf;         dspi_info_ptr->RX_LEN = rx_len;             /* enable interrupt and wait for ISR state machine to finish the job */         dspi_ptr->RSER = DSPI_RSER_RFDF_RE_MASK;         _lwsem_wait(&dspi_info_ptr->EVENT_IO_FINISHED);     }


Attached is a zip file of the files based on the example code that shows how the SPI gets stuck.


Message was edited by: Ohad Benjamin I updated the file

Original Attachment has been moved to: