Zynq.Z-turn

Zynq.Z-turn (in progress)

The z-turn board, is a Zynq PCB, featuring multiple peripherals:

peripherals

Some are accessed through Zynq’s PS part, while others through its PL.

MIO

Contents


Block design

I2C controller


HDMI

In order to find, where the HDMI is connected to, we can reference the schematics.
According to these, they are connected to the PL part (since PS pins would be numbered like MIO_#).

hdmi pins

Looking further down [the schematics], we see that the signals pass through an “HDMI transmitter”.

Sil9022A

As a result, we have to power up the transmitter. In order to do so, we see that it communicates through the I2C-0 bus, thus we’ll need an I2C interface to do so.

I2C-0

I2C-0 is connected to PL as P15 & P16

I2C-0.PL

Activating Sil9022A

The minimal configuration needed is the following:

  1. Raise the RESETn signal [to power up Sil9022A]
  2. Write 0x00 to register 0xC7, in order to enable the TPI (Transmitter Programming Interface)
  3. Wait for ID to stabilize (at 0x1B-1D, 30).
  4. Enable source termination (might be unnecessary, depending on the schematic/ external resistors)
  5. Disable TMDS output (at 0x1A) (default)
  6. Switch from D2 to D0 state (at 0x1E)
  7. Enable TMDS output (at 0x1A)

I2C Address

i2c addresses

It’s important to note that the address is 0x3B. This derives from 0x76 » 1, which means that the datasheet depicts the 8-bit versions.

CI2CA

Needless to say, CI2CA has been raised (assuming R209 is in place).

Raising RESETn

Searching through the schematics for the RESETn pin, we can see it’s connected to MIO51. (The signal passes first through a buffer and then through an AND gate).

RESET 1 RESET 2 RESET 3


Temperature sensor

The temperature sensor, on board, is LM75B (NXP):

LM75B

It’s an 11-bit ADC (with increments of 0.125°C)

The 7-bit [I2C] address is 0x49.

It is connected to I2C0, which is connected to PL pins P15 & P16. The provided contraints file has been set up.

PL I2C0

The sensor’s [temperature] register, is at address 00h. (It is 2 bytes long).

Registers


G-Sensor (acceleration sensor)

Referencing the schematics, the g-sensor, onboard, is the adlx345 from Analog Devices (datasheet).

With 7-bit address 53h, over I2C0.

It has 3 axis of 13 bits, which give a resolution of 3.9 mg/LSB.

I2C mode (disabled SPI)

I2C communication mode is forced, due to C̅S̅ being tied to VDDIO (high).

Resolution

Maximum resolution can be achieved only when measuring around ±2 g.

Settings are through the 0x31 register (named “DATA_FORMAT”), but they default to full resolution.

Sampling rate

With a default sampling rate of 50Hz, maximum sampling rate can be achieved by setting the 0x2C register to 0x0F (which translates to 1600 Hz, due to there being 2 bytes per axis).

Spectral Analysis

DECLINED:

Doing an FFT only on the 32 samples (at maximum sampling rate) of the FIFO, would provide only 16 bins, which is too low a resolution, especially on the 1600Hz span.

FUTURE:

Spectral analysis of nonuniformly sampled data can be achieved. This would be ideal, since it would span (?) the full spectrum of 1600Hz. Details in the docs/GDFT folder.
Wikipedia: Non-uniform discrete Fourier transform
Wikipedia: Least-squares spectral analysis ★★
Matlab: Spectral Analysis of Nonuniformly Sampled Signals

ACCEPTED:

Spectral analysis relative to I/O speed. That is, for a 100kHz I2C speed a 50Hz sampling rate is allowed (half the data rate).

A low data rate of 100Hz should be preferred, against higher ones, due to the latter ones introducing noise.

[Some] Lower (than 100Hz) data rates should also be avoided, since they introduce an offset, relative to temperature.

Low power [operation] should also be avoided as it introduces additional noise.

Data

Data is stored as 3 sets of 2 bytes, at registers 0x32 to 0x37. They should be read as a 6-byte burst, to retain concurrency.

Trigger

For a consistent 100Hz sampling rate, we cannot use an external Timer as a trigger because the 2 interrupt pins are both output.

The 2nd interrupt pin is not connected.

Thus, we shall program the ADXL to 100Hz, by setting the 0x2C register’s “Rate” field to 0b1011.

In order to signal DATA_READY on INT1 pin, we need to enable the “DATA_READY” field on 0x2E and keep it cleared on 0x2F.

The default values are the following.

Conclusion


GPIO

The library being used is called Gpio-PS. API.

(All code has been provided). The general procedure is the following.

Gpio is first initialized:

Next the pins are set:

And written:


I2C

The library that’ll be used is the I2C-PS, with the respective API.

(All code has been provided). The general procedure is the following.

Initialization:

  1. XIicPs_LookupConfig(XIICPS_BASEADDRESS);
  2. XIicPs_CfgInitialize(&Iic, ConfigPtr, ConfigPtr->BaseAddress);
  3. XIicPs_SelfTest(&Iic);
  4. XIicPs_SetSClk(&Iic, IIC_SCLK_RATE);

Reading:

  1. XIicPs_BusIsBusy(&Iic)
  2. XIicPs_MasterSendPolled(&Iic, const_cast<uint8_t*>(v.data()), v.size(), SLAVE_ADDRESS); – Send register address, or an array of bytes (for Page/Offset referencies).
  3. XIicPs_BusIsBusy(&Iic)
  4. XIicPs_MasterRecvPolled(&Iic, result.data(), result.capacity(), SLAVE_ADDRESS); – Read register’s values

Referencies