Hi,
I’m trying to understand the usage of the spi functions.
My SPI slave expects on the MOSI the following data:
RD_WN, ADDR[6:0], DATA[7:0]
With spi_transmit_only I can prepare the data by concatenation into one data word
i.e.
v_data:= SPI_WRITE, WRITE_ADDRESS, WRITE_DATA;
spi_master_transmit_only(VVCT, vvc_instance_idx, v_data, message);
When I use the spi_master_receive_only() I don’t know how
- to tell it is a READ
- to give the READ_ADDRESS
- to collect the data.
I also see in the waveform that MOSI signal is a straight line of ‘0’ for the 16 clock cycles, where I would expect a ‘1’ for READ, and the READ_ADDRESS (if that was possible to specify).
See for example (and ignore the different length of clocks, w.r.t. my example) ST Community where the SDO start to respond after having received the address and read the instruction
When I use the spi_transmit_and_receive_function(VVCT, vvc_instance_idx, v_data, message), it samples already on the first clock the MISO, which is then still undefined.
This, because my slave first needs to receive the correct address, which is after 8 clocks.
So how can I read from my SPI_SLAVE device?
Rgds,
Eric