Tag: beagleboneblack

整合3轴陀螺仪的读数?

所以我用C编写了一个程序,以非常高的数据速率打印3轴陀螺仪的值。 这些值是角速度的瞬时值,如果设备静止,它会随着运动而上升并下降。 我需要它来保持高值并在返回到位置时回到零。 如果我在固定的采样时间内整合这些值,我会实现这个目标吗? 我该如何进行整合? 我是C编程的初学者。 谢谢

计算ARM Cortex-a8 BeagleBone Black上的时钟周期计数

我想计算我的c代码中特定函数的时钟周期计数,该函数将在BeagleBone Black上编译和运行。 我不知道我怎么能这样做。 我在网上搜索,发现了这条指令: Arndale板上的时钟读取方法: 步骤1:插入内核模块以启用对PMU计数器的用户空间访问。 解压附件文件“arndale_clockread.tar.bz2”,该文件包含Makefile和enableccnt.c。 在Makefile中用您的内核源目录更改“KERNELDIR”,例如/ usr/src/linux-kernel-version然后运行命令。 linaro@linaro-server:~/enableccnt$ make 上面的命令应该输出为enableccnt.ko ,这是内核模块,用于启用用户空间访问PMU计数器。 然后运行该命令。 linaro@linaro-server:~/enableccnt$ sudo insmod enableccnt.ko 以下命令应显示正在运行的内核中插入enableccnt模块。 linaro@linaro-server:~/enableccnt$ lsmod 步骤2:从用户空间应用程序中读取计数器。 一旦设置了内核模块。 以下function可用于读取计数器 static void readticks(unsigned int *result) { struct timeval t; unsigned int cc; if (!enabled) { // program the performance-counter control-register: asm volatile(“mcr p15, 0, %0, c9, c12, 0” :: “r”(17)); //enable […]

尝试在目标设备上运行交叉编译的可执行文件失败:没有这样的文件或目录

我陷入了不那么阳光明媚的交叉编译世界。 我正在尝试为我的BeagleBone Black(运行TI Cortex-A8处理器)编译一个简单的hello world应用程序。 首先,我使用gcc在x86上编译并成功运行了hello world应用程序 然后我将编译设置更改为以下内容: arm-linux-gnueabi-gcc -c -O0 -g3 -Wall main.c -o bin/obj/main.o arm-linux-gnueabi-gcc bin/obj/main.o -o bin/hello_world 我通过SCP将文件传输到BeagleBone,并使用chmod +x hello_world设置可执行权限 运行它( ./hello_world )后,我唯一的回答是: -bash: ./hello_world: No such file or directory file的输出与/sbin/init的输出匹配,正如我所期望的那样: $ file hello_world hello_world: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0x24b659b7a41fe043a6f4649d4ebfb5e692ebf0c7, […]

使用C的Beaglebone黑色PWM

我在C中为beaglebone black写了一个示例pwm函数。 每当我在其他模块或main()中进行函数调用时,我最终都会出现分段错误。 请帮助我犯错误以及如何处理这个问题。 以下是代码。 int trigger_pwm_output(unsigned input_no ) { FILE *pwm,*duty,*period,*run;“ uint16_t input=0; uint8_t input_no=0,input_state=0; unsigned int duty_cycle =500000; pwm = fopen(“/sys/devices/bone_capemgr.9/slots”, “w”); fseek(pwm,0,SEEK_SET); fprintf(pwm,”am33xx_pwm”); fflush(pwm); switch(input_no) { case 0: fprintf(pwm,”bone_pwm_P8_13″); fflush(pwm); period = fopen(“/sys/devices/ocp.3/pwm_test_P8_13.15/period”, “w”); fseek(period,0,SEEK_SET); fprintf(period,”%d”,500000); fflush(period); duty = fopen(“/sys/devices/ocp.3/pwm_test_P8_13.15/duty”, “w”); fseek(duty,0,SEEK_SET); run = fopen(“/sys/devices/ocp.3/pwm_test_P8_13.15/run”, “w”); fseek(run,0,SEEK_SET); fprintf(run,”%d”,0); fflush(run); fseek(run,0,SEEK_SET); count++; do […]