AnsweredAssumed Answered

MQX 4.2 SPI CLK doesn't work while reading

Question asked by Serge Maslennikov on Apr 15, 2016
Latest reply on Apr 27, 2016 by Serge Maslennikov

Hello Everyone,


I try to send a command via SPI from MCU (K60) with MQX 4.2 to a slave device and receive a response from it.

the command size is 6 bytes (cmdSize)

the response size is 10 bytes (dataSize)


for this operation I've written the code:


int Result = fwrite(cmd, 1, cmdSize, m_SpiHndl);


    if (Result != cmdSize)

   return false;

    Result = fread(data, 1, dataSize, m_SpiHndl);




The problem is that Master MCU CLK works only for fwrite and doesn't work for fread.


It looks like:


But in the SPI registers (SPI2_TCR) it's set that 16 bytes were transferred (6 for cmd and 10 for receiving data):



What can I do in order to solve this problem?


Thanks in advance.


Yours faithfully,