How to change spidev2.1 frequency?

64 views
Skip to first unread message

dig...@gmail.com

unread,
Dec 18, 2019, 10:11:29 AM12/18/19
to BeagleBoard

Hi, currently I'm working with Winbond Serial SPI NorFlash on PocketBeagle, C++.

Debian version:
root@beaglebone:~# cat /etc/issue
Debian GNU/Linux 9 \n \l
BeagleBoard.org Debian Image 2019-08-03

I can read and write to memory connected to spidev2.1 so it works.
But I cant get reading speed from memory upper 2 megabytes/s regardless which frequency I set in my C++ code (from 30 to 100 MHz). But in the same time - reading speed on OrangePI Zero is around 5 megabytes/s with the same SPI NorFlash module.

In OrangePI it was pretty simple to add and init SPI interface with needed frequency value by adding /boot/armbienEnv.txt:
overlays=spi-spidev
param_spidev_spi_bus
=0
param_spidev_spi_cs
=0
param_spidev_max_freq
=50000000

It seems the spidev2.1 interface in PocketBeagle has already been initialized and created by some config in Debian with some predefined frequency value (near 30 MHz).
I read on this forum that SPI is used by PRU and it is needed to edit some *.dtb file, compile and flash PRU with it, but I don't know which file must be changed, where it lays and how to flash PRU with it to change spidev2.1 frequency from default value to ~50-80 MHz.

Robert Nelson

unread,
Dec 18, 2019, 10:14:58 AM12/18/19
to Beagle Board, dig...@gmail.com
24Mhz:

https://github.com/beagleboard/BeagleBoard-DeviceTrees/blob/v4.19.x-ti/src/arm/am335x-pocketbeagle.dts#L1114-L1161

You didn't specify your kernel version, so i can't give you more
specific directions and which branch to use..

https://github.com/beagleboard/BeagleBoard-DeviceTrees


Regards,

--
Robert Nelson
https://rcn-ee.com/

Robert Nelson

unread,
Dec 18, 2019, 10:48:26 AM12/18/19
to Beagle Board, Oleg Golevych


On Wed, Dec 18, 2019 at 9:37 AM Oleg Golevych <dig...@gmail.com> wrote:
Hi! Thanks for answer!
The kernel version is 
root@beaglebone:~# uname -a
Linux beaglebone 4.14.108-ti-r113 #1 SMP PREEMPT Wed Jul 31 00:01:10 UTC 2019 armv7l GNU/Linux

I changed 24MHz to 100MHz in file am335x-pocketbeagle.dts by following instruction:
image.png
image.png


but it has no effet to read/write speed of memory module.
Perhaps the frequency must be changet additional in some other conf file?

100MHz? that's NOT going to work..

use this repo:

cd ./BeagleBoard-DeviceTrees/
nano ./src/arm/am335x-pocketbeagle.dts
make
sudo make install


i've pushed it to 50Mhz:


But, yeah...

Regards,

Robert Nelson

unread,
Dec 18, 2019, 11:58:16 AM12/18/19
to Beagle Board, Oleg Golevych
On Wed, Dec 18, 2019 at 10:18 AM Oleg Golevych <dig...@gmail.com> wrote:
100MHz? that's NOT going to work..

use this repo:

cd ./BeagleBoard-DeviceTrees/
nano ./src/arm/am335x-pocketbeagle.dts
make
sudo make install

Ok, 
I follow your instruction
cd ./BeagleBoard-DeviceTrees/
in the step nano ./src/arm/am335x-pocketbeagle.dts  i set 50MHz:
image.png
make
sudo make install
reboot

But again, no effect on spidev2.1. (Read speed is the same 2MBytes/s as on 24MHz)

Please keep the BeagleBoard group on CC..

What you've done should work.

Sorry don't have time to actually verify what's going on today, but maybe other members of the community will step up.... (i've got a real job)

Regards,

Oleg Golevych

unread,
Dec 18, 2019, 12:24:10 PM12/18/19
to Robert Nelson, Beagle Board
Will do, thanks! 



Mailtrack Sender notified by
Mailtrack 18.12.19, 19:23:31

ср, 18 дек. 2019 г. в 18:58, Robert Nelson <robert...@gmail.com>:


--
Regards,
Oleg Golevych,
Ph.D. in Engineering.
Phone: +380-98-50-71-697
Reply all
Reply to author
Forward
0 new messages