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.

Orange pi zero Mainline kernel, SPI Clk is weird.

Featured Replies

Hi.

Kernel version : 4.11.7-sun8i

 

My trouble is that clk is weird in using spidev. 

This is a oscilograph when i send a command with spi.

First line is CLK and second line is CS0.

image.png.6f4f7b24f3f7faedf7a7a17b20a2dcbd.png 

 

My slave chip can not receive commands.

and I think it due to this weird CLK. 

CS seems affect CLK.

 

I just want to use spi with CS keeping active-low.

But, following code setting mode of spi occured an error.  "invalid argument exception"  

	mode = SPI_MODE_1 | SPI_NO_CS; 
	if (ioctl(file,SPI_IOC_WR_MODE32,&mode)<0){
		perror("can't set spi mode");
		return;
	}

this work properly.

	mode = SPI_MODE_1; 
	if (ioctl(file,SPI_IOC_WR_MODE32,&mode)<0){
		perror("can't set spi mode");
		return;
	}

so i used this code setting spi_ioc_transfer.

	xfer[0].cs_change = 0; /* Keep CS activated */
	xfer[0].delay_usecs = 0, //delay in us
	xfer[0].speed_hz = 12000000, //speed
	xfer[0].bits_per_word = 8, // bites per word 8

but cs still work and affect clk. 

 

this is my /boot/armbianEnv.txt

verbosity=1
logo=disabled
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
rootdev=UUID=4d25b54f-cc4d-4215-93e3-b5e3868e5a06
rootfstype=ext4
overlays=uart1 uart2 spi-spidev
param_spidev_spi_bus=1
param_spidev_spi_cs=1

Thank you.

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.