Discussion:
mt7621: Full duplex spi data corruption
(too old to reply)
Tobias Schramm
2018-05-03 01:36:34 UTC
Permalink
Hi,

I'm currently working on bringing OpenWRT support to the RouterBOARD RBM33G [1].

The device is based on the mt7621 SoC and has two spi nor-flash chips.
The first chip is very small (512 kB) and connected to CS0. The second
chip is a lot larger (16 MB) and connected to CS1.
The mt7621-spi driver utilizes half-duplex mode for all devices
connected to CS0 and full-duplex mode for devices connected to CS1.
This leads to my first question:
Why is full-duplex mode only used for devices connected to CS1?

Additionally I found that full-duplex mode seems to be extremely
problematic. Any time a transfer starts by TXing a byte starting with
the MSB but not the second most significant bit set the MSB gets
"lost" and is transmitted as a zero bit on the SPI bus. This was
tested with falling edge clock, MSB first.

Furthermore transfers do not work as expected. When a transfer is set
up from userspace using SPI_IOC_MESSAGE and an array of
spi_ioc_transfer structs the clock and CS signal of the SPI
transceiver remain only actice as long as there is data to send. If
there are any spi_ioc_transfer structs with rx_buf but not tx_buf set
there will be more bytes to receive than transmit and the transfer
ends before those bytes are clocked in.

My current "solution" is to simply remove/disable full-duplex mode.

Anyone have experience with the problems mentioned above?


[1] https://mikrotik.com/product/rbm33g

Loading...