ti-processor-sdk-linux-rt-am335x-evm-03.03.00.04如何使用pru gpio触发蜂鸣器或者点亮led?

在am335x evm的串口终端输入以下命令时,蜂鸣器会响

echo 55 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio55/direction
echo 1 > /sys/class/gpio/gpio55/value

使用PRU可以把蜂鸣器响起来吗?

sdk的例子修改?

#include <stdint.h>
#include <pru_cfg.h>
#include "resource_table_empty.h"

volatile register uint32_t __R30;
volatile register uint32_t __R31;

void main(void)
{
volatile uint32_t gpio;

/* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */
CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;

/* Toggle GPO pins TODO: Figure out which to use */
gpio = 0x000F;

/* TODO: Create stop condition, else it will toggle indefinitely */
while (1) {
__R30 ^= gpio;
__delay_cycles(100000000);
}
}

4 个回复