@Jake 这个需要把内核的头文件编译生成DEB包,然后系统上安装。
Posts made by george
-
RE: android 12系统怎么加入特殊分辨率?
@yushaotai 还有就是EDIE读取回来的时序,要和实际写到代码里边的数组一致,否则也不能正常显示的,你需要什么分辨率?
-
AD7606 QT demo
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets charts CONFIG += c++11 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui TRANSLATIONS += \ ad7606_zh_CN.ts CONFIG += lrelease CONFIG += embed_translations # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QSplineSeries> using namespace QtCharts; QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); void setChart(); int getValue(char *channel); int getScale(); void timerEvent(QTimerEvent *e); private slots: void on_pushButton_2_clicked(); void on_pushButton_clicked(); private: Ui::MainWindow *ui; QSplineSeries *serials0; QSplineSeries *serials1; QSplineSeries *serials2; QSplineSeries *serials3; QSplineSeries *serials4; QSplineSeries *serials5; QSplineSeries *serials6; QSplineSeries *serials7; QChart *chart; int scale; int timerid1; float value[8]; }; #endif // MAINWINDOW_H
mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QtCharts> #include <QtCharts/QChartView> #include <QSplineSeries> #include <QProcess> #include <QString> #include <QTimer> #include <fcntl.h> #include <unistd.h> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); setChart(); } MainWindow::~MainWindow() { delete ui; } void MainWindow::setChart() { scale = getScale(); serials0 = new QtCharts::QSplineSeries(); serials1 = new QtCharts::QSplineSeries(); serials2 = new QtCharts::QSplineSeries(); serials3 = new QtCharts::QSplineSeries(); serials4 = new QtCharts::QSplineSeries(); serials5 = new QtCharts::QSplineSeries(); serials6 = new QtCharts::QSplineSeries(); serials7 = new QtCharts::QSplineSeries(); chart = new QChart(); chart->addSeries(serials7); chart->createDefaultAxes(); chart->axisX()->setRange(0, 99); chart->axisY()->setRange(-10, 10); chart->legend()->hide(); ui->widget->setChart(chart); } int MainWindow::getValue(char *channel) { int dev_fd,ret; char DEV_PATH[64]; char value[5]; QString str_data; sprintf(DEV_PATH,"/sys/bus/spi/devices/spi0.0/iio:device0/in_voltage%s_raw",channel); dev_fd = open(DEV_PATH,O_RDONLY); if(dev_fd == -1) { perror("open channel failed!\n"); return -1; } if(read(dev_fd,value,5)<0) { perror("read channel failed!\n"); return -1; } ::close(dev_fd); str_data = QString::fromLocal8Bit(value,5); ret = str_data.toInt(); return ret; } int MainWindow::getScale() { int dev_fd; int ret; char DEV_PATH[64]; char value[5]; QString str_data; sprintf(DEV_PATH,"/sys/bus/spi/devices/spi0.0/iio:device0/in_voltage_scale"); dev_fd = open(DEV_PATH,O_RDONLY); if(dev_fd == -1) { perror("open scale failed!\n"); return -1; } if(read(dev_fd,value,5)<0) { perror("read scale failed!\n"); return -1; } ::close(dev_fd); str_data = QString::fromLocal8Bit(value,5); ret = str_data.toFloat()*1000; return ret; } void MainWindow::timerEvent(QTimerEvent *e) { int i; QVector<QPointF> oldData = serials7->pointsVector(); QVector<QPointF> data; if (oldData.size() < 100) { data = serials7->pointsVector(); } else { for (i = 1; i < oldData.size(); ++i) { data.append(QPointF(i - 1 , oldData.at(i).y())); } } qint64 size = data.size(); for(i = 0; i < 1; ++i){ value[7] = getValue("7"); data.append(QPointF(i + size, value[7]*scale/1000000)); } serials7->replace(data); } void MainWindow::on_pushButton_2_clicked() { serials7->clear(); timerid1 = startTimer(1); } void MainWindow::on_pushButton_clicked() { killTimer(timerid1); }
source code ad7606.zip
-
RE: CoolPi 4B硬件扩展四:GPIO
@zensation
If you need to use PWM function, it is recommended to use PIN12 (PWM3-M3). This port defaults to the pull-up port, and you can increase the resistance to ground by 2K. The default level can be reduced to below 0.6V. If you need GPIO function, except for PIN3 PIN5 PIN32 PIN40 PIN8 PIN10, all other IOs can use pull-down resistors to change the default level.
-
COOLPI CM5 AD7606 8-channel synchronous sampling
-
Using SPI serial communication interface, the circuit is as follows
-
Standard IIO driver configuration
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-cpcm5-evb-v11.dts b/arch/arm64/boot/dts/rockchip/rk3588-cpcm5-evb-v11.dts index 5b04c9d3f354..550b320403d7 100755 --- a/arch/arm64/boot/dts/rockchip/rk3588-cpcm5-evb-v11.dts +++ b/arch/arm64/boot/dts/rockchip/rk3588-cpcm5-evb-v11.dts @@ -486,6 +486,34 @@ &sdmmc { status = "okay"; }; +&spi0 { + status = "okay"; + assigned-clocks = <&cru CLK_SPI0>; + pinctrl-names = "default"; + pinctrl-0 = <&spi0m2_cs0 &spi0m2_pins>; + + ad7606@0 { + compatible = "adi,ad7606-8"; + reg = <0>; + spi-max-frequency = <20000000>; + spi-cpol; + spi-cpha; + avcc-supply = <&vcc5v0_sys>; + interrupts = <8 IRQ_TYPE_EDGE_FALLING>; + interrupt-parent = <&gpio1>; + adi,conversion-start-gpios = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>; + adi,range-gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio1 RK_PD3 GPIO_ACTIVE_HIGH>; + adi,oversampling-ratio-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_HIGH>, + <&gpio3 RK_PB6 GPIO_ACTIVE_HIGH>, + <&gpio1 RK_PD6 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&ad7606_busy &ad7606_conver &ad7606_range &ad7606_reset &ad7606_os0 &ad7606_os1 &ad7606_os2>; + //adi,sw-mode; + status = "okay"; + }; +}; + &dsi0 { status = "disabled"; //rockchip,lane-rate = <1000>; @@ -1330,6 +1358,30 @@ &rng { }; &pinctrl { + ad7606 { + ad7606_busy: ad7606-busy { + rockchip,pins = <1 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + ad7606_conver: ad7606-conver { + rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + ad7606_range: ad7606-range { + rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + ad7606_reset: ad7606-reset { + rockchip,pins = <1 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + ad7606_os0: ad7606-os0 { + rockchip,pins = <3 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + ad7606_os1: ad7606-os1 { + rockchip,pins = <3 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + ad7606_os2: ad7606-os2 { + rockchip,pins = <1 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + hym8563 { hym8563_int: hym8563-int { rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>; diff --git a/arch/arm64/configs/rk3588_cpcm5_evb_defconfig b/arch/arm64/configs/rk3588_cpcm5_evb_defconfig index 92e6983d3a40..9365319f866d 100644 --- a/arch/arm64/configs/rk3588_cpcm5_evb_defconfig +++ b/arch/arm64/configs/rk3588_cpcm5_evb_defconfig @@ -891,6 +891,8 @@ CONFIG_ARM_ROCKCHIP_BUS_DEVFREQ=y CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ=y CONFIG_DEVFREQ_EVENT_ROCKCHIP_NOCP=y CONFIG_IIO=y +CONFIG_AD7606_IFACE_PARALLEL=y +CONFIG_AD7606_IFACE_SPI=y CONFIG_ROCKCHIP_SARADC=y CONFIG_SENSORS_ISL29018=y CONFIG_SENSORS_TSL2563=y
- test method
Single sampling
cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw
Continuous Samples
/*Modify node permissions*/ sudo chmod 777 /sys/bus/iio/devices/iio:device0/ -R /*Enable sampling channel*/ echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage0_en // echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage1_en echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage2_en echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage3_en echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage4_en echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage5_en echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage6_en echo 1 > /sys/bus/iio/devices/iio:device0/scan_elements/in_voltage7_en /*Configure buffer size*/ echo 128 > /sys/bus/iio/devices/iio:device0/buffer/length /*Start sampling*/ echo 1 > /sys/bus/iio/devices/iio:device0/buffer/enable /*View Results*/ cat /dev/iio\:device0 |xxd -
- The schematic and PCB files can be downloaded from the wiki,Some empty PCBs can also be given away for free.
-
-
RE: Support for Ubuntu 22.04 Server on CoolPi
@dbtech You can download it from the following website:
https://coolpi-my.sharepoint.com/personal/coolpi_coolpi_onmicrosoft_com/_layouts/15/onedrive.aspx?ga=1&id=%2Fpersonal%2Fcoolpi_coolpi_onmicrosoft_com%2FDocuments%2Fcoolpi%2Fcoolpi%2FCoolPi 4B%2Fubuntu -
RE: CoolPi 4B硬件扩展四:GPIO
@zensation
Software modification pull-down:- specifies that the default pull-down of GPIO needs to be modified in the kernel DTS file, path:/arch/arm64/boot/dts/rockchip. After the modification is completed, compile and generate a DTB file, and then replace it.
Hardware modification pull-down:
- You can change the default pull-down situation of IO by connecting a pull-down resistor to GPIO. The default pull-up change is to connect a 2K resistor to the GND network, and the default pull-down change is to connect a 4.7K resistor to a 3.3V power supply.
-
RE: how about batocera with cool pi 4b
@cyberwisk
The firmware can be obtained from the following website
https://coolpi-my.sharepoint.com/personal/coolpi_coolpi_onmicrosoft_com/_layouts/15/onedrive.aspx?ga=1&id=%2Fpersonal%2Fcoolpi_coolpi_onmicrosoft_com%2FDocuments%2Fcoolpi%2Fcoolpi%2FCoolPi 4B%2Fbatocera] -
RE: apt update的时候报错,添加gpu驱动时添加不进去,是怎么回事啊?(Ubuntu22.04)
@diudiutong 这个看log是网络连接问题,默认的镜像已经集成GPU驱动。
-
RE: CoolPi 4B硬件扩展四:GPIO
@zensation
The current operation method does not support configuring the up and down status. If you need to modify the up and down status of GPIO, you can use DTS's PINCTRL to achieve it.lcd { lcdpwr_en: lcdpwr-en { rockchip,pins = <1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_down>; }; bl_en: bl-en { rockchip,pins = <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; }; };
-
RE: CoolPi 4B硬件扩展四:GPIO
@zensation
First, set the password for the root user, and then log in as root.coolpi@Ubuntu:~$ sudo passwd root [sudo] password for coolpi: New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: password updated successfully coolpi@Ubuntu:~$ su Password: root@Ubuntu:/home/coolpi# echo 128 > /sys/class/gpio/export root@Ubuntu:/home/coolpi# cd /sys/class/gpio/ root@Ubuntu:/sys/class/gpio# ls export gpiochip0 gpiochip32 gpiochip64 unexport gpio128 gpiochip128 gpiochip509 gpiochip96 root@Ubuntu:/sys/class/gpio#
-
RE: CoolPi 4B硬件扩展四:GPIO
@zensation
Can you be more specific about which commands are not working. -
RE: merge back to armbian source
@reddfoxx
Thank you for your suggestion. As I haven't paid too much attention to ARMBIAN, I have only tried to develop the corresponding firmware. Currently, my main focus is on Ubuntu Debian Android and the optimization and expansion of the upper and lower layers of the system. You can try adding the Armbian mainline in the future.