Topic: Interrupt mode of TPM


I’m trying to understand how the interrupt system work in TPM.  The specification seems to me a bit confusing on this subject and during some of my tests using WolfTPM native test I observed a lot of polling.

To keep things simple let’s say I want to generate random numbers and get an interrupt when these are available.

Is there a simple way using WolfTPM to be able to enable this type of interrupt for a command and then disable it to switch back to polling for the next command?

Is there a particular register in the TPM to allow such interruptions to be requested?

I use ST TPMs (ST33TP SPI TPM2) communicating in SPI.

Thanks in advance,


Re: Interrupt mode of TPM

Hi François,

This is a great question! Currently our TIS layer uses polling to detect data ready, however some TPM's do have an interrupt pin available. I have the ST33 TPM and will look into adding this feature. Aside from the physical GPIO it will also depend on how the ST33 enables the IRQ pin use.

Until then another option is to implement a delay in the polling period using the `XTPM_WAIT` macro, which you can define like this

#define XTPM_WAIT() usleep(1000)


If you do end up making changes to wolfTPM for IRQ support and would like to contribute them back, you are welcome to open a PR and sign a contributor agreement.

David Garske, wolfSSL


Re: Interrupt mode of TPM

Hi David,

Thanks you for your reply.
I will try to activate the interrupts on my TPM when I have time.

Thanks again,