简体   繁体   English

是否有 shell 命令可以更改树莓派零的 SPI 时钟?

[英]is there a shell command can change SPI clock for raspberry pi zero?

I would like to write a bash file to light up an OLED screen with SSD1306 driver, with below code I can send the SPI commands to the screen but seems the CLK is supper fast so the SSD1306 doesn't work, is there a way to change the SCLK for SPI interface(like set to 4Mhz) in the shell?我想写一个 bash 文件来点亮带有 SSD1306 驱动程序的 OLED 屏幕,使用下面的代码我可以将 SPI 命令发送到屏幕,但似乎 CLK 太快了所以 SSD1306 不起作用,有没有办法在外壳中更改 SPI 接口的 SCLK(如设置为 4Mhz)? I am using Raspberry Pi Zero W.我正在使用 Raspberry Pi 零 W。

echo -ne $cmd > /dev/spidev0.0

You can try the following for 3.9MHz:对于 3.9MHz,您可以尝试以下操作:

echo -ne "\x06\x04" > /sys/class/spi_master/spi0/of_node/spi-max-frequency

Table for different speed deviders you can find here您可以在此处找到不同速度装置的表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM