News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

TE0720 SHA_IO control

Started by firstname, May 06, 2026, 06:16:56 PM

Previous topic - Next topic

firstname

Hello everyone,my main problem is achieving ability to control onboard ATSHA204A (U10) over SWI via CPLD -> FPGA -> PS
I followed trenz documentation and found an ability to route U10 SDA to XIO4 (PL_pin_M15). In my vivado project I have a System Controller SC0720 + Processing System (Zynq7).
What is the correct way to control U10 under baremetal C driver on PS? Is there any AXI SWI implementations, otherwise how to connect PL_pin_M15 to PS to be able to manage this bidirectional PIN by the right way?
Thanks in advance!

mch

Hi,

The ATSHA204A in the 3-lead SOT package can only communicate via the Single-Wire Interface and does not support I²C. To use the chip in the Vivado design, the SDA pin of the chip (MEM_SHA), which is connected to CPLD pin N14, must be routed through the CPLD to the FPGA:

MEM_SHA of the crypto chip (SDA) / MEM_SHA (N14) ---------→ CPLD X2 pin (C2) / FPGA M15

To achieve this, the register CR2[3:0] must be set to the value "0010". The following command in the Linux console enables two functions simultaneously:

CPLD pin X2 (C2) as a read path: the FPGA receives the serial data from the crypto chip.
CPLD pin X3 (B1) as a write path: the FPGA can control the crypto chip through the CPLD.

phytool write eth0/0x1A/6 0x0002

0x1A --> Address of the Ethernet PHY chip on the MDIO bus
0x6 --> Address of the CR2 register
(See: https://wiki.trenz-electronic.de/display/PD/TE0720+CPLD#TE0720CPLD-SCMDIOInterface)
)
0x0002 --> Corresponds to the bit pattern "0010" for CR2[3:0]

Please note that the X3 pin is referred to as the XIO5 signal in the CPLD documentation.

Since a pull-up resistor is connected to MEM_SHA, the bus operates according to the open-drain principle. After setting CR2[3:0] = "0010", the following applies:

X3 = '0' → The CPLD actively drives MEM_SHA to logic '0' (the FPGA sends a 0 to the crypto chip)
X3 = '1' → The CPLD places MEM_SHA into High-Z state → the pull-up resistor pulls the line to logic '1' (the FPGA sends a 1 to the crypto chip)

Reading the chip response via CPLD pin X2 (C2) and FPGA pin M15 is only possible when X3 = '1' (High-Z), because only in this state can the crypto chip control the line itself. As long as X3 = '0', the CPLD actively drives SHA_IO to '0', and the read path will also always return '0', regardless of the chip state.

The X3 pin (B1) of the CPLD chip is directly connected in the hardware design to FPGA pin N15.

Communication with the ATSHA204A therefore takes place through two FPGA pins:

FPGA pin (N15) / CPLD pin X3 (B1) ====> FPGA transmits to the chip (write)
FPGA pin (M15) / CPLD pin X2 (C2) ====> FPGA reads the MEM_SHA line state (reading is only meaningful when X3 = '1')

You can control the crypto chip either with a bare-metal C driver or under Linux using a single-wire interface IP core in the Vivado design. However, we do not have any example code or reference project available for the single-wire communication interface.

Best regards,
Mohsen Chamanbaz

firstname

@mch Thanks a lot, it was useful, now I see 1.8V control on the line. However I have further problem: chip doesn't respond on the line after waking-up process (checked by the oscilloscope).
1) Does ATSHA204A on TE0720-04 configured to SingleWire by default or not? As far as I know, it configures by manufacturer?
2) According to schematics, It must be SingleWire. But there is another question on the surface: Vcc = 3.3V and SDA pulled-up externally to 1.8V as well as CPLD Bank1 for MEM-SHA control.
ATSHA204A default configuration for SWI (when "I2C_Enable<0> = 0") TTL Enable is '1', means "Input level uses the Vcc as reference". Is it good to communicate over SWI pulled-up to 1.8V? Have I missed something?

Looking forward for any useful information and thanks in advance!
 

mch

Hi,

1) The ATSHA204A chip package on the TE0720-04 module is SOT. Therefore, the SWI interface is available only in this case. The ATSHA204A is configured by the chip manufacturer. All configuration data can be read; however, some configuration data, such as the serial number and I2C Enable, cannot be written. The I2C Enable byte also cannot be written and can only be read. If bit 0 of the I2C Enable byte is already set to 1, the chip can communicate via the I2C interface; otherwise, the chip will communicate via the SWI interface.
2) That is not a problem. According to the ATSHA204A datasheet, the SDA pin can be pulled up to the same supply voltage or to a lower voltage rail. Please refer to page 25 of the datasheet. The CPLD chip can also operate up to 3.75 V.

Best regards,
Mohsen Chamanbaz