2020-08-18 02:21 AM
I coding in C/C++, and using SPI function through 'HAL_SPI_Transmit' and 'HAL_SPI_Receive'.
TPM module send me only 'ff ff ff ff ... ff ff'.
i see the tpm module's manual, but i can't understand.
plz, tell me a few example code.
Solved! Go to Solution.
2020-08-19 05:41 AM
Look at the timing diagram for your TPM module, in particular the clock edge used to clock in/out data. If you are only receiving 0xFF that's an indication you are either reading back data on the wrong clock edge, or writing data to the TPM on the wrong edge. This affects CPOL and CPHA.
Also, does the TPM receive and send back data at the same time (i.e. full duplex) rather than write command followed by read response (half duplex)?
Jack Peacock
2020-08-18 05:29 AM
One example:
2020-08-19 02:04 AM
Thank you for your reply, TDK!
I entered in that link,
but actually my key question is
'how to set data field to send TPM module through SPI function'
I set environment like this:
The above settings were made because it was recognized as necessary for 'spi communication' with the TPM.
It would be a hassle, but I'd appreciate your re-re-reply.
Thank you.
2020-08-19 05:41 AM
Look at the timing diagram for your TPM module, in particular the clock edge used to clock in/out data. If you are only receiving 0xFF that's an indication you are either reading back data on the wrong clock edge, or writing data to the TPM on the wrong edge. This affects CPOL and CPHA.
Also, does the TPM receive and send back data at the same time (i.e. full duplex) rather than write command followed by read response (half duplex)?
Jack Peacock
2020-08-19 06:26 AM
I don't really want to write code for you.
Look at the example code, try it, make sure you understand what's happening.
If you are still stuck, show what you've tried. Show your code in your post so we have something to go off of.
2020-08-20 01:55 AM
Thank you for your re-re-reply!
2020-08-20 02:02 AM
Thank you for your reply, Jack Peacock_2!
As far as I know, full-duplex is impossible for TPM modules.
So, i set my MASTER node to half-duplex.
I think, data is wrong, When I send to SLAVE(TPM).
I send data like this :
char data[] = "0111111100011010000110000010000012345678901234567890123456789012";
Above data's set is reference to below paper (135 page):
It would be a hassle, but I'd appreciate your reply.
Thank you.
HYoun