Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SPI with DMA TX only doesn't work

Featured Replies

In my spi protocol driver I send large buffers of data to be transferred.  I am not interested in the data received so I leave the rx_buf as NULL. 

 

In the controller driver they have code to implement this use case:

https://github.com/allwinner-zh/linux-3.4-sunxi/blob/6964d467510849e3e262518cb87bff7ef92e01f5/drivers/spi/spi-sunxi.c#L1003

However the transfer never completes and the kernel logs a time out for each transfer after 120 seconds.

 

I have tried modifying the driver with various options like disabling the SPI_GC_TP_EN, which pauses transmit when the receive fifo is full, but it has no effect.  Finally after hours of futile tinkering I decided to change my protocol driver to use what I figured was the better tested code path for both transmit and receive.  After adding a dummy receive buffer to my spi transfers, the transmits finally succeed.

 

I don't mind having to do this, but it was very misleading with the code seemingly supporting the options I was using and silently failing.  The controller driver should instead log an error message that half-duplex transmit is not supported.  This would have saved me a lot of time.

 

 

 

Additionally there is the issue that either the bits_per_word or speed_hz fields of the spi_transfer struct must be set in the  in order for the protocol driver settings to actually be setup.  In the driver, the function that does this is sunxi_spi_xfer_setup, but it's only called if the transfer has those set.  That required functionality should also be performed in the sunxi_spi_setup function which occurs when the protocol driver initialises.

 

 

I'll attach my revised version of the driver soon, in case it might be of benefit to someone.

I realise that this is technically a legacy driver, but seeing as the mainline kernel isn't quite ready on a few things, I believe this driver is still most likely to be used for a while yet.

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.