Regarding uDMA SPI Master
#1
I have been looking into using udma_qpsi (https://github.com/pulp-platform/udma_qspi) logic in SPI_STD mode. I noticed that when in SPI_STD mode for sampling data_rx in udma_spim_txrx module, spi_sdi1_i is used instead of spi_sdi0_i. 


udma_spim_txrx.sv
 line 264: s_data_rx[s_bit_index] = spi_sdi1_i;

However for data_tx spi_sdo0 is used

line 234: s_spi_sdo0 = r_tx_shift_reg[s_bit_index];


Was this intentional? If so, is there a reason behind it?

Thanks!
Reply
#2
(03-04-2020, 06:01 PM)gaumzi Wrote: I have been looking into using udma_qpsi (https://github.com/pulp-platform/udma_qspi) logic in SPI_STD mode. I noticed that when in SPI_STD mode for sampling data_rx in udma_spim_txrx module, spi_sdi1_i is used instead of spi_sdi0_i. 


udma_spim_txrx.sv
 line 264: s_data_rx[s_bit_index] = spi_sdi1_i;

However for data_tx spi_sdo0 is used

line 234: s_spi_sdo0 = r_tx_shift_reg[s_bit_index];


Was this intentional? If so, is there a reason behind it?

Thanks!

I am not among the authors of this block, but I think the reason is pretty straightforward. Standard SPI has one wire defined as MOSI (Master Out, Slave In) and another as MISO (Master In, Slave Out). QPI uses four wires whose role changes depending on the current state of the SPI master. This is implemented as a set of 12 signals: 4 in, 4 out, and 4 output enables acting as direction selectors (https://github.com/pulp-platform/udma_qs...xrx.sv#L59):

Code:
   output logic         spi_oen0_o,
   output logic         spi_oen1_o,
   output logic         spi_oen2_o,
   output logic         spi_oen3_o,
   output logic         spi_sdo0_o,
   output logic         spi_sdo1_o,
   output logic         spi_sdo2_o,
   output logic         spi_sdo3_o,
   input  logic         spi_sdi0_i,
   input  logic         spi_sdi1_i,
   input  logic         spi_sdi2_i,
   input  logic         spi_sdi3_i

The standard SPI mode uses the same signals to map MOSI to spi_sdo0_o (with spi_oen0_o active, which I think means 0 in this case); and MISO to spi_sdi1_i (with spi_oen1_o not active, i.e., 1).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)