Topic: SPI communication with Asus E15028 (Nuvoton NPCT750) via RPi 3

Hi,
I'm trying to talk to Asus E15028 with Nuvoton NPCT750 via Raspberry Pi, butalways get no data back (only zeros). Have somebody experience with this board? I found pinout here
WolfSSL is compiled with

--enable-wolftpm --enable-opensslextra --enable-libwebsockets --enable-certgen --enable-certreq --enable-certext --enable-pkcs7 --enable-cryptocb --enable-aescfb


and wolfTPM with

--enable-debug=io --with-wolfcrypt=../wolfSSL/inst --enable-nuvoton


I also see that wolfTPM can open /dev/spidev0.0 and sets 43MHz. I tried to connect WP and HOLD to Vcc and to GND (from more detailed pinout that I found in docs for compatible motherboard, is in attachment).
Output I always have:

pi@raspberrypi:~/build/wolfTPM/examples/native $ ./native_test 
TPM2 Demo using Native API's
TPM2_IoCb: Ret 257, Sz 5
    80 d4 00 00 00                                  | .....
    00 00 00 00 00                                  | .....
TPM2_Init failed 0x101: TPM_RC_FAILURE: Commands not being accepted because of a TPM failure

Share

Re: SPI communication with Asus E15028 (Nuvoton NPCT750) via RPi 3

Hi r-type,

That is a great little module ASUS has for their motherboard. The steps you listed for wolfTPM with direct /dev/spi access looks great. Make sure you have the right SPI chip select. The PI has two and they are "/dev/spidev0.0" and "/dev/spidev0.1". The modules Nuvoton provides for the Pi use CS0 (Pin 24).

Also the reset line is active low, so if pulled low it will hold in reset, so make sure it is high. Also you should make sure you have a pull-up on the Chip Select pin to make sure it is only active when the Pi drives it. I would leave the IRQ line alone and not tie to anything. Use 3.3v for VCC.

Thanks,
David Garske, wolfSSL

Share

Re: SPI communication with Asus E15028 (Nuvoton NPCT750) via RPi 3

Hi David,
thank you for your response. I connected RST with VCC to put it high. Or should I put pull-up resistor instead? I also put 10k resistor between VCC and CS0. But still no answer from device. I attached image with connections. May be I have to try with another Raspi ...

Post's attachments

Screenshot at 2021-09-21 09-44-31.png
Screenshot at 2021-09-21 09-44-31.png 571.59 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Share

Re: SPI communication with Asus E15028 (Nuvoton NPCT750) via RPi 3

Hi r-type,

Were you able to get wolfTPM working with the Asus E15028 (Nuvoton NPCT750) on a Pi? Make sure you have the SPI wait state build option enabled `WOLFTPM_CHECK_WAIT_STATE` or use the `./configure --enable-nuvoton` option. Note: I pushed a wolfTPM v2.3 release this week, which does have some Nuvoton Fixups.

Thanks,
David Garske, wolfSSL

Share

Re: SPI communication with Asus E15028 (Nuvoton NPCT750) via RPi 3

Hi David,
I just tried 2.3.0, but unfortunately I had no success with. Output is the same as I posted above. I also tested SPI and it seems to work with loopback:

pi@raspberrypi:~/spi_test/new $ ./spidev_test -D /dev/spidev0.0 -v -s43000000
spi mode: 0x4
bits per word: 8
max speed: 43000000 Hz (43000 kHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  |......@.........................|
RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  |......@.........................|

I also got a 100MHz oscilloscope (but the wrong one, with 2 channels) and trying to see MOSI/MISO pulses, but I'm still dummy in osci setup, If I find something, I'll post it.
Thanks,
Roman

Share

Re: SPI communication with Asus E15028 (Nuvoton NPCT750) via RPi 3

On oscilloscope I don't see any signal on MISO line, only on MOSI. Sending init command via spidev_test shows no answer as well:

pi@raspberrypi:~/spi_test/new $ ./spidev_test -D /dev/spidev0.0 -v -s43000000 -p "\x80\xd4\x00\x00\x00"
spi mode: 0x4
bits per word: 8
max speed: 43000000 Hz (43000 kHz)
TX | 80 D4 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  |.....|
RX | 00 00 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  |.....|

I tested this TPM on ASUS board and BIOS could detect it, so it should be OK. Some connection should be a problem. I tried to set almost all undocumented pins high, but it didn't help. In attachment I push photo of setup with connections as you described.

Post's attachments

npct750.jpg
npct750.jpg 1.3 mb, 1 downloads since 2021-11-17 

You don't have the permssions to download the attachments of this post.

Share

Re: SPI communication with Asus E15028 (Nuvoton NPCT750) via RPi 3

Hi Roman,

Did you try a lower SPI bus speed like 2 MHz? With longer wires the SPI bus impedance will be high and not function correctly.

Thanks,
David Garske, wolfSSL

Share

Re: SPI communication with Asus E15028 (Nuvoton NPCT750) via RPi 3

Hi David,
I also thought last week about too long wires and ordered GPIO Breakout HAT to avoid long wires to breadboard. Unfortunately I still have no reply on MISO. With spidev_test I tried 2 MHz and even 200 kHz, but it didn't help.

pi@raspberrypi:~/spi_test/new $ ./spidev_test -D /dev/spidev0.0 -v -s2000000 -p "\x80\xd4\x00\x00\x00"
spi mode: 0x4
bits per word: 8
max speed: 2000000 Hz (2000 kHz)
TX | 80 D4 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  |.....|
RX | 00 00 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  |.....|
pi@raspberrypi:~/spi_test/new $ ./spidev_test -D /dev/spidev0.0 -v -s200000 -p "\x80\xd4\x00\x00\x00"
spi mode: 0x4
bits per word: 8
max speed: 200000 Hz (200 kHz)
TX | 80 D4 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  |.....|
RX | 00 00 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  |.....|
Post's attachments

npct750_1.jpg
npct750_1.jpg 140.49 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Share

Re: SPI communication with Asus E15028 (Nuvoton NPCT750) via RPi 3

Hi David,
could you please point me to the proper pinout? I found one for TPM module on asus site, but it differs from pinout I have in asus b550m-a mainboard manual.

Thanks,
Roman

Post's attachments

npct750_pinout1.jpg
npct750_pinout1.jpg 20.95 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Share

Re: SPI communication with Asus E15028 (Nuvoton NPCT750) via RPi 3

Second one (only single attachment per post is allowed)

Post's attachments

npct750_pinout2.png
npct750_pinout2.png 8.48 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Share