Jump to content

SPI on BPI M2Berry


KlGrom

Recommended Posts

Hi all,

 

I try to use SPI on the BananaPi M2 Berry. The devices are activated in the configfile and the devices spidev0,0 and spidev1.0 are shown in the /dev .directory but the spi-bus did not work.

DMESG shows the following error - messages :

[    0.944871] sun6i-spi 1c05000.spi: Failed to request TX DMA channel
[    0.944893] sun6i-spi 1c05000.spi: Failed to request RX DMA channel
[    0.945987] sun6i-spi 1c06000.spi: Failed to request TX DMA channel
[    0.946006] sun6i-spi 1c06000.spi: Failed to request RX DMA channel

 

OS version is 6.2.12-sunxi

 

Any idea what's wrong ?

Link to comment
Share on other sites

I looked to the I/O -Pins with an oscilloscope and got no signals.

The devicet-ree looks good to me.I have seen that it is not neccessary to have DMA active in the SPI-driver it's only a warning. 

But I got no signals.

 

Any help would be appreciated. 

Link to comment
Share on other sites

14 часов назад, KlGrom сказал:

Any help would be appreciated.

 

Please publish the output to a file under the spoiler:

grep -n DMA /boot/conf*6.2.12-sunxi >> DEBUG-CONF.txt
grep -n SPI /boot/conf*6.2.12-sunxi >> DEBUG-CONF.txt

 

Link to comment
Share on other sites

@KlGrom

This patch is for a different architecture.

 

Maybe you want to tell me more details?

 

HardWare Specification of Banana pi BPI-M2 Berry

SocAllwinner A40i/R40/V40 ?

 

What are you connecting to SPI. Master\Slave ?
How was the verification carried out?

Link to comment
Share on other sites

SoC Allwinner R40/V40 , 1GB DDR3, no emmc, system on SDCard

 

attached to SPI0 is an small Display with an SSD1306 controller. SSD1306 can act on I2C or SPI.

The displaycontroller is connected to SPI0 - SCLK,MOSI,CS0 and two more I/O pins for reset and Data/Command switch. BananaPi acts as master.

 

I have connected an oscilloscope to the SCLK line to see what happens. Regardless of the Display is connected or not, I can't see any changes on the clock line. If I use the SCLK line as output via /sys/class/gpio/gpio66 (created with export for GPIO PC2) I can change the level manually and trigger the oscilloscope.

 

I checked also the spi0 statistics under /sys/class/spi_master/spi0/statistics. I have written a small test which sends 3 Bytes to spidev0.0. After calling the test, bytes_tx increases by 3 and messages by 1. So I think the driver is called correctly but there is no change on the clock line.

 

THX for your help

Edited by KlGrom
Link to comment
Share on other sites

Скрытый текст
linux-mainline/6.2> grep -nr SSD1306 drivers/*

drivers/gpu/drm/solomon/ssd130x-i2c.c:67:               .data = &ssd130x_variants[SSD1306_ID],
drivers/gpu/drm/solomon/ssd130x-i2c.c:84:               .data = &ssd130x_variants[SSD1306_ID],
drivers/gpu/drm/solomon/ssd130x-spi.c:121:              .data = &ssd130x_variants[SSD1306_ID],
drivers/gpu/drm/solomon/ssd130x-spi.c:147:      { "ssd1306", SSD1306_ID },
drivers/gpu/drm/solomon/ssd130x.c:109:  [SSD1306_ID] = {
drivers/gpu/drm/solomon/ssd130x.h:30:   SSD1306_ID,

drivers/staging/fbtft/Kconfig:140:config FB_TFT_SSD1306
drivers/staging/fbtft/Kconfig:141:      tristate "FB driver for the SSD1306 OLED Controller"
drivers/staging/fbtft/Kconfig:144:        Framebuffer support for SSD1306

drivers/staging/fbtft/Makefile:28:obj-$(CONFIG_FB_TFT_SSD1306)     += fb_ssd1306.o
drivers/staging/fbtft/fb_sh1106.c:4: * Based on the SSD1306 driver by Noralf Tronnes
drivers/staging/fbtft/fb_sh1106.c:20:/* Init sequence based on the Adafruit SSD1306 Arduino library */
drivers/staging/fbtft/fb_ssd1305.c:5: * based on SSD1306 driver by Noralf Tronnes
drivers/staging/fbtft/fb_ssd1305.c:32:/* Init sequence taken from the Adafruit SSD1306 Arduino library */
drivers/staging/fbtft/fb_ssd1306.c:3: * FB driver for the SSD1306 OLED Controller
drivers/staging/fbtft/fb_ssd1306.c:31:/* Init sequence taken from the Adafruit SSD1306 Arduino library */
drivers/staging/fbtft/fb_ssd1306.c:226:MODULE_DESCRIPTION("SSD1306 OLED Driver");
drivers/staging/fbtft/fb_ssd1325.c:33:/* Init sequence taken from the Adafruit SSD1306 Arduino library */

 

This is a simple check on the kernel source code.

 

 

See if the necessary driver is compiled?

grep -n 'FB_TFT_SSD1306' /boot/conf*

grep -n 'DRM_SSD130X' /boot/conf*

 

If the necessary drivers are present in the kernel, it remains for you to correctly write the overlay for the device tree.

You can use the existing code from the search as a basis:

> grep -nri SSD1306 arch/arm/boot/dts/*

arch/arm/boot/dts/am335x-icev2.dts
arch/arm/boot/dts/imx28-cfa10036.dts

 

In order for the driver to be loaded automatically, there must be a line in the described node:

compatible = "solomon,ssd1306"

 

When your work is successful and you have a properly working overlay, just post it here and call me @going. I will add this overlay for everyone in the Armbian patches.

If you need more help, try looking for it in similar topics on the forum.

Well good luck.

 

P.S. Your question is not related to a specific Banana Pi. This is rather a general question of connecting the device via the SPI to the board.


Maybe it makes sense to rename the name to attract interested users?

Edited by going
Add P.S.
Link to comment
Share on other sites

Hi going

Thanks for your answer.

I found both lines and the drivers are present as modul. Also the line with .....130x_SPI=m. So the display should also work on the SPI interface.

 

This will really help if the SPI bus starts working.

But the problem is. that I get no signals on the SPI-Lines. I have started the same test-program on a Raspi B3+ under Raspian and get the attached waveform-Display. When I start the same test on the Banana Pi with Armbian I get no signals on the lines. Do you know if there is a difference in SPI-handling between Raspian and Armbian, so that my test didn't work on the BananaPi ?IMAG007.BMPsimpleTest.c

 

The simple test with 3 Bytes sent to SPIdev0.0 is also attached.( the image is from another test which sends more bytes)

Edited by KlGrom
Link to comment
Share on other sites

With a lot of help from going I finally could fix the problem.

The problem is that the GPIO-lines needed for spi are not defined neither in the basic device.tree nor in the spidev-overlay.

to get spidev0 working download  the device-tree source below and compile it with dtc.

Copy the resulting file "sun8i-r40-spi-spidev0.dtb" to "/boot/dtb/overlay/sun8i-r40-spi-spidev0.dtbo"

Ensure that in /boot/armbianEnv.txt "overlay_prefix=sun8i-r40" is set and the line overlay=.... contains spi-spidev0

reboot

 

sun8i-r40-spi-spidev0.dts

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines