Is there any way to know when SPI shift register has finished shifting data out in Kinetis E MCU?

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

Is there any way to know when SPI shift register has finished shifting data out in Kinetis E MCU?

637 Views
muhibraza
Contributor I

Hi all,

I am using FRDM-KE02Z to develop a software for driving 3 digit 7 segment display through 74HC595 chip. I am using SPI0 module for this purpose, I first clear the strobe input to the 595 chip, transmit the data and set it high again. But I am facing some challenges. To set it high I need to know when the KE02Z internal shift register has finished transmitting data as there is no interrupt flag for this. The only interrupt flag related to this is SPTEF (SPI Transmit buffer empty flag) which only indicates that transmit buffer is empty but it does not indicate whats happening at the second stage. Is there any way to find out when the shift register has shifted the data out completely?

Thanks,

Muhib

0 Kudos
2 Replies

453 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hello Muhib Rzaz,

   Yes, KE SPI register just have the SPI transmit buffer empty flag, but I think it is not the problem.

   If you want to detect the end of the finished shifting data, you can realize it in your code.

  Take an example, define a flag to indicate the sending is in process, when the SPTEF is 1, then you send the data, set your own defined flag, it means the sending is in process, then check the SPTEF again, if your defined flag is 1, and the SPTEF is also 1, it means the sending is finished.

  Actually, I don't know why you need to check the data is finished,  if you really want to detect it, you also can check the SPTEF from 0 to 1 directly in your code, this also means the shift is finished.

Wish it helps you!

If you still have question about it, please kindly let me know!


Have a great day,
Kerry

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

0 Kudos

453 Views
lpcxpresso_supp
NXP Employee
NXP Employee

You would probably do better posting this question in the Kinetis Microcontroller forum : https://community.nxp.com/community/kinetis  rather than in the MCUXpresso IDE forum.

Regards,

MCUXpresso IDE Support

0 Kudos